# Copyright 2020 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
#
#     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: eventtypes.eventing.knative.dev
  labels:
    eventing.knative.dev/release: devel
    knative.dev/crd-install: "true"
    app.kubernetes.io/version: devel
    app.kubernetes.io/part-of: knative-eventing
spec:
  group: eventing.knative.dev
  versions:
  - name: v1beta1
    served: true
    storage: true
    subresources:
      status: {}
    schema:
      openAPIV3Schema:
        type: object
        description: 'EventType represents a type of event that can be consumed from a Broker.'
        properties:
          spec:
            description: 'Spec defines the desired state of the EventType.'
            type: object
            properties:
              broker:
                type: string
              description:
                description: 'Description is an optional field used to describe the
                    EventType, in any meaningful way.'
                type: string
              schema:
                description: 'Schema is a URI, it represents the CloudEvents schemaurl
                    extension attribute. It may be a JSON schema, a protobuf schema,
                    etc. It is optional.'
                type: string
              schemaData:
                description: 'SchemaData allows the CloudEvents schema to be stored
                    directly in the EventType. Content is dependent on the encoding.
                    Optional attribute. The contents are not validated or manipulated
                    by the system.'
                type: string
              source:
                description: 'Source is a URI, it represents the CloudEvents source.'
                type: string
              type:
                description: 'Type represents the CloudEvents type. It is authoritative.'
                type: string
          status:
            description: 'Status represents the current state of the EventType. This data
                may be out of date.'
            type: object
            properties:
              annotations:
                description: 'Annotations is additional Status fields for the Resource
                    to save some additional State as well as convey more information
                    to the user. This is roughly akin to Annotations on any k8s resource,
                    just the reconciler conveying richer information outwards.'
                type: object
                x-kubernetes-preserve-unknown-fields: true
              conditions:
                description: 'Conditions the latest available observations of a resource''s
                    current state.'
                type: array
                items:
                  type: object
                  required:
                    - type
                    - status
                  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
              observedGeneration:
                description: 'ObservedGeneration is the ''Generation'' of the Service
                    that was last processed by the controller.'
                type: integer
                format: int64
    additionalPrinterColumns:
    - name: Type
      type: string
      jsonPath: ".spec.type"
    - name: Source
      type: string
      jsonPath: ".spec.source"
    - name: Schema
      type: string
      jsonPath: ".spec.schema"
    - name: Broker
      type: string
      jsonPath: ".spec.broker"
    - name: Description
      type: string
      jsonPath: ".spec.description"
    # TODO remove Status https://github.com/knative/eventing/issues/2750
    - name: Ready
      type: string
      jsonPath: ".status.conditions[?(@.type==\"Ready\")].status"
    - name: Reason
      type: string
      jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason"
  names:
    kind: EventType
    plural: eventtypes
    singular: eventtype
    categories:
      - all
      - knative
      - eventing
  scope: Namespaced
