apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    cert-manager.io/inject-ca-from: kamaji-system/kamaji-serving-cert
    controller-gen.kubebuilder.io/version: v0.20.0
  name: kubeconfiggenerators.kamaji.clastix.io
spec:
  group: kamaji.clastix.io
  names:
    categories:
      - kamaji
    kind: KubeconfigGenerator
    listKind: KubeconfigGeneratorList
    plural: kubeconfiggenerators
    shortNames:
      - kc
    singular: kubeconfiggenerator
  scope: Cluster
  versions:
    - additionalPrinterColumns:
        - description: Age
          jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      name: v1alpha1
      schema:
        openAPIV3Schema:
          description: KubeconfigGenerator is the Schema for the kubeconfiggenerators API.
          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:
              properties:
                controlPlaneEndpointFrom:
                  default: admin.svc
                  description: |-
                    ControlPlaneEndpointFrom is the key used to extract the Tenant Control Plane endpoint that must be used by the generator.
                    The targeted Secret is the `${TCP}-admin-kubeconfig` one, default to `admin.svc`.
                  type: string
                groups:
                  description: |-
                    Groups is resolved a set of strings used to assign the x509 organisations field.
                    It will be recognised by Kubernetes as user groups.
                  items:
                    description: |-
                      CompoundValue allows defining a static, or a dynamic value.
                      Options are mutually exclusive, just one should be picked up.
                    properties:
                      fromDefinition:
                        description: |-
                          FromDefinition is used to generate a dynamic value,
                          it uses the dot notation to access fields from the referenced TenantControlPlane object:
                          e.g.: metadata.name
                        type: string
                      stringValue:
                        description: StringValue is a static string value.
                        type: string
                    type: object
                    x-kubernetes-validations:
                      - message: Either stringValue or fromDefinition must be set, but not both.
                        rule: (has(self.stringValue) || has(self.fromDefinition)) && !(has(self.stringValue) && has(self.fromDefinition))
                  type: array
                namespaceSelector:
                  description: NamespaceSelector is used to filter Namespaces from which the generator should extract TenantControlPlane objects.
                  properties:
                    matchExpressions:
                      description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
                      items:
                        description: |-
                          A label selector requirement is a selector that contains values, a key, and an operator that
                          relates the key and values.
                        properties:
                          key:
                            description: key is the label key that the selector applies to.
                            type: string
                          operator:
                            description: |-
                              operator represents a key's relationship to a set of values.
                              Valid operators are In, NotIn, Exists and DoesNotExist.
                            type: string
                          values:
                            description: |-
                              values is an array of string values. If the operator is In or NotIn,
                              the values array must be non-empty. If the operator is Exists or DoesNotExist,
                              the values array must be empty. This array is replaced during a strategic
                              merge patch.
                            items:
                              type: string
                            type: array
                            x-kubernetes-list-type: atomic
                        required:
                          - key
                          - operator
                        type: object
                      type: array
                      x-kubernetes-list-type: atomic
                    matchLabels:
                      additionalProperties:
                        type: string
                      description: |-
                        matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
                        map is equivalent to an element of matchExpressions, whose key field is "key", the
                        operator is "In", and the values array contains only "value". The requirements are ANDed.
                      type: object
                  type: object
                  x-kubernetes-map-type: atomic
                tenantControlPlaneSelector:
                  description: TenantControlPlaneSelector is used to filter the TenantControlPlane objects that should be address by the generator.
                  properties:
                    matchExpressions:
                      description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
                      items:
                        description: |-
                          A label selector requirement is a selector that contains values, a key, and an operator that
                          relates the key and values.
                        properties:
                          key:
                            description: key is the label key that the selector applies to.
                            type: string
                          operator:
                            description: |-
                              operator represents a key's relationship to a set of values.
                              Valid operators are In, NotIn, Exists and DoesNotExist.
                            type: string
                          values:
                            description: |-
                              values is an array of string values. If the operator is In or NotIn,
                              the values array must be non-empty. If the operator is Exists or DoesNotExist,
                              the values array must be empty. This array is replaced during a strategic
                              merge patch.
                            items:
                              type: string
                            type: array
                            x-kubernetes-list-type: atomic
                        required:
                          - key
                          - operator
                        type: object
                      type: array
                      x-kubernetes-list-type: atomic
                    matchLabels:
                      additionalProperties:
                        type: string
                      description: |-
                        matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
                        map is equivalent to an element of matchExpressions, whose key field is "key", the
                        operator is "In", and the values array contains only "value". The requirements are ANDed.
                      type: object
                  type: object
                  x-kubernetes-map-type: atomic
                user:
                  description: User resolves to a string to identify the client, assigned to the x509 Common Name field.
                  properties:
                    fromDefinition:
                      description: |-
                        FromDefinition is used to generate a dynamic value,
                        it uses the dot notation to access fields from the referenced TenantControlPlane object:
                        e.g.: metadata.name
                      type: string
                    stringValue:
                      description: StringValue is a static string value.
                      type: string
                  type: object
                  x-kubernetes-validations:
                    - message: Either stringValue or fromDefinition must be set, but not both.
                      rule: (has(self.stringValue) || has(self.fromDefinition)) && !(has(self.stringValue) && has(self.fromDefinition))
              required:
                - user
              type: object
            status:
              description: KubeconfigGeneratorStatus defines the observed state of KubeconfigGenerator.
              properties:
                availableResources:
                  default: 0
                  description: |-
                    AvailableResources is the sum of successfully generated resources.
                    In case of a different value compared to Resources, check the field errors.
                  type: integer
                errors:
                  description: Errors is the list of failed kubeconfig generations.
                  items:
                    properties:
                      message:
                        description: Message is the error message recorded upon the last generator run.
                        type: string
                      resource:
                        description: Resource is the Namespaced name of the errored resource.
                        type: string
                    required:
                      - message
                      - resource
                    type: object
                  type: array
                resources:
                  default: 0
                  description: Resources is the sum of targeted TenantControlPlane objects.
                  type: integer
              required:
                - availableResources
                - resources
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
