---
# For backwards compatibility it's not possible to take the community based VPA definition since it tightens
# the validation too much. Instead, the CRD needs to retain and permit unknown fields as it used to be with
# the `v1beta1` CRD version.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: verticalpodautoscalers.autoscaling.k8s.io
  annotations:
    api-approved.kubernetes.io: https://github.com/kubernetes/kubernetes/pull/63797
    resources.gardener.cloud/keep-object: "true"
  labels:
    gardener.cloud/role: vpa
spec:
  group: autoscaling.k8s.io
  names:
    kind: VerticalPodAutoscaler
    listKind: VerticalPodAutoscalerList
    plural: verticalpodautoscalers
    shortNames:
    - vpa
    singular: verticalpodautoscaler
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        type: object
        x-kubernetes-preserve-unknown-fields: true
        properties:
          spec:
            type: object
            x-kubernetes-preserve-unknown-fields: true
            required: []
            properties:
              targetRef:
                type: object
                x-kubernetes-preserve-unknown-fields: true
              updatePolicy:
                type: object
                x-kubernetes-preserve-unknown-fields: true
                properties:
                  updateMode:
                    type: string
              resourcePolicy:
                type: object
                x-kubernetes-preserve-unknown-fields: true
                properties:
                  containerPolicies:
                    type: array
                    items:
                      type: object
                      x-kubernetes-preserve-unknown-fields: true
                      properties:
                        containerName:
                          type: string
                        mode:
                          type: string
                          enum: ["Auto", "Off"]
                        minAllowed:
                          type: object
                          x-kubernetes-preserve-unknown-fields: true
                        maxAllowed:
                          type: object
                          x-kubernetes-preserve-unknown-fields: true
                        controlledResources:
                          type: array
                          items:
                            type: string
                            enum: ["cpu", "memory"]
    served: true
    storage: true
  - name: v1beta2
    schema:
      openAPIV3Schema:
        type: object
        x-kubernetes-preserve-unknown-fields: true
        properties:
          spec:
            type: object
            x-kubernetes-preserve-unknown-fields: true
            required: []
            properties:
              targetRef:
                type: object
                x-kubernetes-preserve-unknown-fields: true
              updatePolicy:
                type: object
                x-kubernetes-preserve-unknown-fields: true
                properties:
                  updateMode:
                    type: string
              resourcePolicy:
                type: object
                x-kubernetes-preserve-unknown-fields: true
                properties:
                  containerPolicies:
                    type: array
                    items:
                      type: object
                      x-kubernetes-preserve-unknown-fields: true
                      properties:
                        containerName:
                          type: string
                        mode:
                          type: string
                          enum: ["Auto", "Off"]
                        minAllowed:
                          type: object
                          x-kubernetes-preserve-unknown-fields: true
                        maxAllowed:
                          type: object
                          x-kubernetes-preserve-unknown-fields: true
                        controlledResources:
                          type: array
                          items:
                            type: string
                            enum: ["cpu", "memory"]
    served: true
    storage: false
