#
# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: gravitee-plugins.gravitee.io
spec:
  group: gravitee.io
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                plugins:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      policy:
                        type: string
                        description: policy plugin id (jwt, rate-limit...)
                      resource:
                        type: string
                        description: resource plugin id (oauth2, oauth2-am-resource...)
                      configuration:
                        type: object
                        description: Map containing the pluging configuration (map structure based on the kind of plugin)
                        x-kubernetes-preserve-unknown-fields: true
            status:
              type: object
              properties:
                hashCodes:
                  type: object
                  description: hashCode for each plugin
                  additionalProperties:
                    type: string
                integration:
                  type: object
                  properties:
                    observedGeneration:
                      type: integer
                      format: int64
                      description: The generation of the resource
                    state:
                      type: string
                      description: The integration state of the resource
                    message:
                      type: string
                      description: Additional data about the state
      subresources:
        status: { }
      additionalPrinterColumns:
        - name: State
          type: string
          description: The integration state of the resource
          jsonPath: .status.integration.state
        - name: Message
          type: string
          description: Additional data about the state (may be empty)
          jsonPath: .status.integration.message
  scope: Namespaced
  names:
    plural: gravitee-plugins
    singular: gravitee-plugin
    kind: GraviteePlugins
    shortNames:
    - giop