# Copyright 2018 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: images.caching.internal.knative.dev
  labels:
    app.kubernetes.io/name: knative-serving
    app.kubernetes.io/version: devel
    knative.dev/crd-install: "true"
spec:
  group: caching.internal.knative.dev
  names:
    kind: Image
    plural: images
    singular: image
    categories:
      - knative-internal
      - caching
  scope: Namespaced
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          description: |-
            Image is a Knative abstraction that encapsulates the interface by which Knative
            components express a desire to have a particular image cached.
          type: object
          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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
              type: string
            metadata:
              type: object
            spec:
              description: Spec holds the desired state of the Image (from the client).
              type: object
              required:
                - image
              properties:
                image:
                  description: Image is the name of the container image url to cache across the cluster.
                  type: string
                imagePullSecrets:
                  description: |-
                    ImagePullSecrets contains the names of the Kubernetes Secrets containing login
                    information used by the Pods which will run this container.
                  type: array
                  items:
                    description: |-
                      LocalObjectReference contains enough information to let you locate the
                      referenced object inside the same namespace.
                    type: object
                    properties:
                      name:
                        description: |-
                          Name of the referent.
                          This field is effectively required, but due to backwards compatibility is
                          allowed to be empty. Instances of this type with an empty value here are
                          almost certainly wrong.
                          More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
                        type: string
                        default: ""
                    x-kubernetes-map-type: atomic
                serviceAccountName:
                  description: |-
                    ServiceAccountName is the name of the Kubernetes ServiceAccount as which the Pods
                    will run this container.  This is potentially used to authenticate the image pull
                    if the service account has attached pull secrets.  For more information:
                    https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account
                  type: string
            status:
              description: Status communicates the observed state of the Image (from the controller).
              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
                  additionalProperties:
                    type: string
                conditions:
                  description: Conditions the latest available observations of a resource's current state.
                  type: array
                  items:
                    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
                    type: object
                    required:
                      - status
                      - type
                    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: Image
          type: string
          jsonPath: .spec.image
