# Copyright 2021 The Knative Authors
#
# 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
#
#     https://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: knativeeventings.operator.knative.dev
  labels:
    operator.knative.dev/release: devel
spec:
  group: operator.knative.dev
  versions:
  - name: v1alpha1
    served: true
    storage: true
    subresources:
      status: {}
    schema:
      openAPIV3Schema:
        description: Schema for the knativeeventings API
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: Spec defines the desired state of KnativeEventing
            x-kubernetes-preserve-unknown-fields: true # To allow for some fields we've deleted.
            properties:
              config:
                additionalProperties:
                  additionalProperties:
                    type: string
                  type: object
                description: A means to override the corresponding entries in the
                  upstream configmaps
                type: object
              defaultBrokerClass:
                description: The default broker type to use for the brokers Knative
                  creates. If no value is provided, MTChannelBasedBroker will be used.
                type: string
              high-availability:
                description: Allows specification of HA control plane
                properties:
                  replicas:
                    description: The number of replicas that HA parts of the control
                      plane will be scaled to
                    minimum: 1
                    type: integer
                type: object
              deployments:
                description: A mapping of deployment name to override
                type: array
                items:
                  type: object
                  properties:
                    name:
                      description: The name of the deployment
                      type: string
                    labels:
                      additionalProperties:
                        type: string
                      description: Labels overrides labels for the deployment and its template.
                      type: object
                    annotations:
                      additionalProperties:
                        type: string
                      description: Annotations overrides labels for the deployment and its template.
                      type: object
                    replicas:
                      description: The number of replicas that HA parts of the control plane will be scaled to
                      type: integer
                      minimum: 1
              resources:
                description: A mapping of deployment name to resource requirements
                items:
                  properties:
                    container:
                      description: The name of the container
                      type: string
                    limits:
                      properties:
                        cpu:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        ephemeral-storage:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        memory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        storage:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                      type: object
                    requests:
                      properties:
                        cpu:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        ephemeral-storage:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        memory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        storage:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                      type: object
                  type: object
                type: array
              sinkBindingSelectionMode:
                description: Specifies the selection mode for the sinkbinding webhook.
                  If the value is `inclusion`, only namespaces/objects labelled as
                  `bindings.knative.dev/include:true` will be considered. If `exclusion`
                  is selected, only `bindings.knative.dev/exclude:true` label is checked
                  and these will NOT be considered. The default for Openshift Serverless is `inclusion`.
                type: string
            type: object
          status:
            properties:
              conditions:
                description: The latest available observations of a resource's current
                  state.
                items:
                  properties:
                    lastTransitionTime:
                      description: LastTransitionTime is the last time the condition
                        transitioned from one status to another. We use VolatileTime
                        in place of metav1.Time to exclude this from creating equality.Semantic
                        differences (all other things held constant).
                      type: string
                    message:
                      description: A human readable message indicating details about
                        the transition.
                      type: string
                    reason:
                      description: The reason for the condition's last transition.
                      type: string
                    severity:
                      description: Severity with which to treat failures of this type
                        of condition. When this is not specified, it defaults to Error.
                      type: string
                    status:
                      description: Status of the condition, one of True, False, Unknown.
                      type: string
                    type:
                      description: Type of condition.
                      type: string
                  required:
                  - type
                  - status
                  type: object
                type: array
              manifests:
                description: The list of eventing manifests, which have been installed
                  by the operator
                items:
                  type: string
                type: array
              observedGeneration:
                description: The generation last processed by the controller
                type: integer
              version:
                description: The version of the installed release
                type: string
            type: object
        type: object
    additionalPrinterColumns:
    - jsonPath: .status.version
      name: Version
      type: string
    - jsonPath: .status.conditions[?(@.type=="Ready")].status
      name: Ready
      type: string
    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
      name: Reason
      type: string
  names:
    kind: KnativeEventing
    listKind: KnativeEventingList
    plural: knativeeventings
    singular: knativeeventing
  scope: Namespaced
  conversion:
    strategy: None
