# 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
#
#     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: domainmappings.serving.knative.dev
  labels:
    knative.dev/crd-install: "true"
    serving.knative.dev/release: "v1.0.0"
spec:
  group: serving.knative.dev
  names:
    kind: DomainMapping
    categories:
    - all
    - knative
    - serving
    plural: domainmappings
    shortNames:
    - dm
    singular: domainmapping
  scope: Namespaced
  versions:
  - name: v1beta1
    additionalPrinterColumns:
    - name: URL
      type: string
      jsonPath: .status.url
    - name: Ready
      type: string
      jsonPath: ".status.conditions[?(@.type=='Ready')].status"
    - name: Reason
      type: string
      jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
    "schema":
      "openAPIV3Schema":
        type: object
        description: DomainMapping is a mapping from a custom hostname to an Addressable.
        properties:
          apiVersion:
            type: string
            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/sig-architecture/api-conventions.md#resources'
          kind:
            type: string
            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/sig-architecture/api-conventions.md#types-kinds'
          metadata:
            type: object
          spec:
            type: object
            description: 'Spec is the desired state of the DomainMapping. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
            properties:
              ref:
                type: object
                description: "Ref specifies the target of the Domain Mapping. \n The object identified by the Ref must be an Addressable with a URL of the form `{name}.{namespace}.{domain}` where `{domain}` is the cluster domain, and `{name}` and `{namespace}` are the name and namespace of a Kubernetes Service. \n This contract is satisfied by Knative types such as Knative Services and Knative Routes, and by Kubernetes Services."
                properties:
                  name:
                    type: string
                    description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
                  namespace:
                    type: string
                    description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.'
                  apiVersion:
                    type: string
                    description: API version of the referent.
                  kind:
                    type: string
                    description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
                  group:
                    type: string
                    description: 'Group of the API, without the version of the group. This can be used as an alternative to the APIVersion, and then resolved using ResolveGroup. Note: This API is EXPERIMENTAL and might break anytime. For more details: https://github.com/knative/eventing/issues/5086'
                required:
                - kind
                - name
              tls:
                type: object
                description: TLS allows the DomainMapping to terminate TLS traffic with an existing secret.
                properties:
                  secretName:
                    type: string
                    description: SecretName is the name of the existing secret used to terminate TLS traffic.
                required:
                - secretName
            required:
            - ref
          status:
            type: object
            description: 'Status is the current state of the DomainMapping. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
            properties:
              annotations:
                type: object
                additionalProperties:
                  type: string
                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.
              address:
                type: object
                description: Address holds the information needed for a DomainMapping to be the target of an event.
                properties:
                  url:
                    type: string
              conditions:
                type: array
                description: Conditions the latest available observations of a resource's current state.
                items:
                  type: object
                  description: 'Condition defines a readiness condition for a Knative resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
                  properties:
                    type:
                      type: string
                      description: Type of condition.
                    status:
                      type: string
                      description: Status of the condition, one of True, False, Unknown.
                    lastTransitionTime:
                      type: string
                      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).
                      format: date-time
                    message:
                      type: string
                      description: A human readable message indicating details about the transition.
                    reason:
                      type: string
                      description: The reason for the condition's last transition.
                    severity:
                      type: string
                      description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.
                  required:
                  - status
                  - type
              observedGeneration:
                type: integer
                description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
                format: int64
              url:
                type: string
                description: URL is the URL of this DomainMapping.
    served: true
    storage: false
    subresources:
      status: {}
  - name: v1alpha1
    additionalPrinterColumns:
    - name: URL
      type: string
      jsonPath: .status.url
    - name: Ready
      type: string
      jsonPath: ".status.conditions[?(@.type=='Ready')].status"
    - name: Reason
      type: string
      jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
    schema:
      openAPIV3Schema:
        type: object
        description: DomainMapping is a mapping from a custom hostname to an Addressable.
        properties:
          apiVersion:
            type: string
            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/sig-architecture/api-conventions.md#resources'
          kind:
            type: string
            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/sig-architecture/api-conventions.md#types-kinds'
          metadata:
            type: object
          spec:
            type: object
            description: 'Spec is the desired state of the DomainMapping. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
            properties:
              ref:
                type: object
                description: "Ref specifies the target of the Domain Mapping. \n The object identified by the Ref must be an Addressable with a URL of the form `{name}.{namespace}.{domain}` where `{domain}` is the cluster domain, and `{name}` and `{namespace}` are the name and namespace of a Kubernetes Service. \n This contract is satisfied by Knative types such as Knative Services and Knative Routes, and by Kubernetes Services."
                properties:
                  name:
                    type: string
                    description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
                  namespace:
                    type: string
                    description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.'
                  apiVersion:
                    type: string
                    description: API version of the referent.
                  kind:
                    type: string
                    description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
                  group:
                    type: string
                    description: 'Group of the API, without the version of the group. This can be used as an alternative to the APIVersion, and then resolved using ResolveGroup. Note: This API is EXPERIMENTAL and might break anytime. For more details: https://github.com/knative/eventing/issues/5086'
                required:
                - kind
                - name
              tls:
                type: object
                description: TLS allows the DomainMapping to terminate TLS traffic with an existing secret.
                properties:
                  secretName:
                    type: string
                    description: SecretName is the name of the existing secret used to terminate TLS traffic.
                required:
                - secretName
            required:
            - ref
          status:
            type: object
            description: 'Status is the current state of the DomainMapping. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
            properties:
              annotations:
                type: object
                additionalProperties:
                  type: string
                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.
              address:
                type: object
                description: Address holds the information needed for a DomainMapping to be the target of an event.
                properties:
                  url:
                    type: string
              conditions:
                type: array
                description: Conditions the latest available observations of a resource's current state.
                items:
                  type: object
                  description: 'Condition defines a readiness condition for a Knative resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
                  properties:
                    type:
                      type: string
                      description: Type of condition.
                    status:
                      type: string
                      description: Status of the condition, one of True, False, Unknown.
                    lastTransitionTime:
                      type: string
                      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).
                      format: date-time
                    message:
                      type: string
                      description: A human readable message indicating details about the transition.
                    reason:
                      type: string
                      description: The reason for the condition's last transition.
                    severity:
                      type: string
                      description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.
                  required:
                  - status
                  - type
              observedGeneration:
                type: integer
                description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
                format: int64
              url:
                type: string
                description: URL is the URL of this DomainMapping.
    served: true
    storage: true
    subresources:
      status: {}
