# Copyright 2019 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: approverequests.custom.tekton.dev
  labels:
    samples.knative.dev/release: devel
    knative.dev/crd-install: "true"
spec:
  group: custom.tekton.dev
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: { }
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              description: Spec holds the desired state of the AddressableService (from the client).
              type: object
              properties:
                dummy:
                  description: RequstName holds the name of the Tekton.Run which request a manual approve.
                  type: string
            status:
              description: Status communicates the observed state of the AddressableService (from the controller).
              type: object
              properties:
                requests:
                  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
                    properties:
                      approved:
                        description: approved display if the approve request has been approved.
                        type: boolean
                      requstName:
                        description: RequstName holds the name of the Tekton.Run which request a manual approve.
                        type: string
                      requestTimestamp:
                        description: RequstName holds the name of the Tekton.Run which request a manual approve.
                        type: string
                        format: date-time
                      approveTimestamp:
                        description: RequstName holds the name of the Tekton.Run which request a manual approve.
                        type: string
                        format: date-time
                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
                        format: date-time
                      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: Ready
          type: string
          jsonPath: ".status.conditions[?(@.type=='Ready')].status"
        - name: Reason
          type: string
          jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
  names:
    kind: ApproveRequest
    plural: approverequests
    singular: approverequest
    categories:
    - all
    - tekton
    shortNames:
    - areq
  scope: Namespaced

