apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.20.0
  name: sqljobs.k8s.mariadb.com
spec:
  group: k8s.mariadb.com
  names:
    kind: SqlJob
    listKind: SqlJobList
    plural: sqljobs
    shortNames:
      - smdb
    singular: sqljob
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .status.conditions[?(@.type=="Complete")].status
          name: Complete
          type: string
        - jsonPath: .status.conditions[?(@.type=="Complete")].message
          name: Status
          type: string
        - jsonPath: .spec.mariaDbRef.name
          name: MariaDB
          type: string
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      name: v1alpha1
      schema:
        openAPIV3Schema:
          description: SqlJob is the Schema for the sqljobs API. It is used to run sql scripts as jobs.
          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: SqlJobSpec defines the desired state of SqlJob
              properties:
                affinity:
                  description: Affinity to be used in the Pod.
                  properties:
                    antiAffinityEnabled:
                      description: |-
                        AntiAffinityEnabled configures PodAntiAffinity so each Pod is scheduled in a different Node, enabling HA.
                        Make sure you have at least as many Nodes available as the replicas to not end up with unscheduled Pods.
                      type: boolean
                    nodeAffinity:
                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeaffinity-v1-core'
                      properties:
                        preferredDuringSchedulingIgnoredDuringExecution:
                          items:
                            description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#preferredschedulingterm-v1-core'
                            properties:
                              preference:
                                description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorterm-v1-core'
                                properties:
                                  matchExpressions:
                                    items:
                                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorrequirement-v1-core'
                                      properties:
                                        key:
                                          type: string
                                        operator:
                                          description: |-
                                            A node selector operator is the set of operators that can be used in
                                            a node selector requirement.
                                          type: string
                                        values:
                                          items:
                                            type: string
                                          type: array
                                          x-kubernetes-list-type: atomic
                                      required:
                                        - key
                                        - operator
                                      type: object
                                    type: array
                                    x-kubernetes-list-type: atomic
                                  matchFields:
                                    items:
                                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorrequirement-v1-core'
                                      properties:
                                        key:
                                          type: string
                                        operator:
                                          description: |-
                                            A node selector operator is the set of operators that can be used in
                                            a node selector requirement.
                                          type: string
                                        values:
                                          items:
                                            type: string
                                          type: array
                                          x-kubernetes-list-type: atomic
                                      required:
                                        - key
                                        - operator
                                      type: object
                                    type: array
                                    x-kubernetes-list-type: atomic
                                type: object
                              weight:
                                format: int32
                                type: integer
                            required:
                              - preference
                              - weight
                            type: object
                          type: array
                          x-kubernetes-list-type: atomic
                        requiredDuringSchedulingIgnoredDuringExecution:
                          description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselector-v1-core'
                          properties:
                            nodeSelectorTerms:
                              items:
                                description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorterm-v1-core'
                                properties:
                                  matchExpressions:
                                    items:
                                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorrequirement-v1-core'
                                      properties:
                                        key:
                                          type: string
                                        operator:
                                          description: |-
                                            A node selector operator is the set of operators that can be used in
                                            a node selector requirement.
                                          type: string
                                        values:
                                          items:
                                            type: string
                                          type: array
                                          x-kubernetes-list-type: atomic
                                      required:
                                        - key
                                        - operator
                                      type: object
                                    type: array
                                    x-kubernetes-list-type: atomic
                                  matchFields:
                                    items:
                                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#nodeselectorrequirement-v1-core'
                                      properties:
                                        key:
                                          type: string
                                        operator:
                                          description: |-
                                            A node selector operator is the set of operators that can be used in
                                            a node selector requirement.
                                          type: string
                                        values:
                                          items:
                                            type: string
                                          type: array
                                          x-kubernetes-list-type: atomic
                                      required:
                                        - key
                                        - operator
                                      type: object
                                    type: array
                                    x-kubernetes-list-type: atomic
                                type: object
                              type: array
                              x-kubernetes-list-type: atomic
                          required:
                            - nodeSelectorTerms
                          type: object
                      type: object
                    podAntiAffinity:
                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#podantiaffinity-v1-core.'
                      properties:
                        preferredDuringSchedulingIgnoredDuringExecution:
                          items:
                            description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#weightedpodaffinityterm-v1-core.'
                            properties:
                              podAffinityTerm:
                                description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#podaffinityterm-v1-core.'
                                properties:
                                  labelSelector:
                                    description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#labelselector-v1-meta'
                                    properties:
                                      matchExpressions:
                                        items:
                                          description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#labelselectorrequirement-v1-meta'
                                          properties:
                                            key:
                                              type: string
                                            operator:
                                              description: A label selector operator is the set of operators that can be used in a selector requirement.
                                              type: string
                                            values:
                                              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
                                        type: object
                                    type: object
                                  topologyKey:
                                    type: string
                                required:
                                  - topologyKey
                                type: object
                              weight:
                                format: int32
                                type: integer
                            required:
                              - podAffinityTerm
                              - weight
                            type: object
                          type: array
                          x-kubernetes-list-type: atomic
                        requiredDuringSchedulingIgnoredDuringExecution:
                          items:
                            description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#podaffinityterm-v1-core.'
                            properties:
                              labelSelector:
                                description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#labelselector-v1-meta'
                                properties:
                                  matchExpressions:
                                    items:
                                      description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#labelselectorrequirement-v1-meta'
                                      properties:
                                        key:
                                          type: string
                                        operator:
                                          description: A label selector operator is the set of operators that can be used in a selector requirement.
                                          type: string
                                        values:
                                          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
                                    type: object
                                type: object
                              topologyKey:
                                type: string
                            required:
                              - topologyKey
                            type: object
                          type: array
                          x-kubernetes-list-type: atomic
                      type: object
                  type: object
                args:
                  description: Args to be used in the Container.
                  items:
                    type: string
                  type: array
                backoffLimit:
                  default: 5
                  description: BackoffLimit defines the maximum number of attempts to successfully execute a SqlJob.
                  format: int32
                  type: integer
                database:
                  description: Username to be used when executing the SqlJob.
                  type: string
                dependsOn:
                  description: DependsOn defines dependencies with other SqlJob objectecs.
                  items:
                    description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#localobjectreference-v1-core.'
                    properties:
                      name:
                        default: ""
                        type: string
                    type: object
                  type: array
                failedJobsHistoryLimit:
                  description: FailedJobsHistoryLimit defines the maximum number of failed Jobs to be displayed.
                  format: int32
                  minimum: 0
                  type: integer
                imagePullSecrets:
                  description: ImagePullSecrets is the list of pull Secrets to be used to pull the image.
                  items:
                    description: 'Refer to the Kubernetes docs: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#localobjectreference-v1-core.'
                    properties:
                      name:
                        default: ""
                        type: string
                    type: object
                  type: array
                inheritMetadata:
                  description: InheritMetadata defines the metadata to be inherited by children resources.
                  properties:
                    annotations:
                      additionalProperties:
                        type: string
                      description: Annotations to be added to children resources.
                      type: object
                    labels:
                      additionalProperties:
                        type: string
                      description: Labels to be added to children resources.
                      type: object
                  type: object
                mariaDbRef:
                  description: MariaDBRef is a reference to a MariaDB object.
                  properties:
                    kind:
                      description: Kind of the referent.
                      type: string
                    name:
                      type: string
                    namespace:
                      type: string
                    waitForIt:
                      default: true
                      description: WaitForIt indicates whether the controller using this reference should wait for MariaDB to be ready.
                      type: boolean
                  type: object
                nodeSelector:
                  additionalProperties:
                    type: string
                  description: NodeSelector to be used in the Pod.
                  type: object
                passwordSecretKeyRef:
                  description: UserPasswordSecretKeyRef is a reference to the impersonated user's password to be used when executing the SqlJob.
                  properties:
                    key:
                      type: string
                    name:
                      default: ""
                      type: string
                  required:
                    - key
                  type: object
                  x-kubernetes-map-type: atomic
                podMetadata:
                  description: PodMetadata defines extra metadata for the Pod.
                  properties:
                    annotations:
                      additionalProperties:
                        type: string
                      description: Annotations to be added to children resources.
                      type: object
                    labels:
                      additionalProperties:
                        type: string
                      description: Labels to be added to children resources.
                      type: object
                  type: object
                podSecurityContext:
                  description: SecurityContext holds pod-level security attributes and common container settings.
                  properties:
                    appArmorProfile:
                      description: AppArmorProfile defines a pod or container's AppArmor settings.
                      properties:
                        localhostProfile:
                          description: |-
                            localhostProfile indicates a profile loaded on the node that should be used.
                            The profile must be preconfigured on the node to work.
                            Must match the loaded name of the profile.
                            Must be set if and only if type is "Localhost".
                          type: string
                        type:
                          description: |-
                            type indicates which kind of AppArmor profile will be applied.
                            Valid options are:
                              Localhost - a profile pre-loaded on the node.
                              RuntimeDefault - the container runtime's default profile.
                              Unconfined - no AppArmor enforcement.
                          type: string
                      required:
                        - type
                      type: object
                    fsGroup:
                      format: int64
                      type: integer
                    fsGroupChangePolicy:
                      description: |-
                        PodFSGroupChangePolicy holds policies that will be used for applying fsGroup to a volume
                        when volume is mounted.
                      type: string
                    runAsGroup:
                      format: int64
                      type: integer
                    runAsNonRoot:
                      type: boolean
                    runAsUser:
                      format: int64
                      type: integer
                    seLinuxOptions:
                      description: SELinuxOptions are the labels to be applied to the container
                      properties:
                        level:
                          description: Level is SELinux level label that applies to the container.
                          type: string
                        role:
                          description: Role is a SELinux role label that applies to the container.
                          type: string
                        type:
                          description: Type is a SELinux type label that applies to the container.
                          type: string
                        user:
                          description: User is a SELinux user label that applies to the container.
                          type: string
                      type: object
                    seccompProfile:
                      description: |-
                        SeccompProfile defines a pod/container's seccomp profile settings.
                        Only one profile source may be set.
                      properties:
                        localhostProfile:
                          description: |-
                            localhostProfile indicates a profile defined in a file on the node should be used.
                            The profile must be preconfigured on the node to work.
                            Must be a descending path, relative to the kubelet's configured seccomp profile location.
                            Must be set if type is "Localhost". Must NOT be set for any other type.
                          type: string
                        type:
                          description: |-
                            type indicates which kind of seccomp profile will be applied.
                            Valid options are:

                            Localhost - a profile defined in a file on the node should be used.
                            RuntimeDefault - the container runtime default profile should be used.
                            Unconfined - no profile should be applied.
                          type: string
                      required:
                        - type
                      type: object
                    supplementalGroups:
                      items:
                        format: int64
                        type: integer
                      type: array
                      x-kubernetes-list-type: atomic
                  type: object
                priorityClassName:
                  description: PriorityClassName to be used in the Pod.
                  type: string
                resources:
                  description: Resources describes the compute resource requirements.
                  properties:
                    limits:
                      additionalProperties:
                        anyOf:
                          - type: integer
                          - type: string
                        pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                        x-kubernetes-int-or-string: true
                      description: ResourceList is a set of (resource name, quantity) pairs.
                      type: object
                    requests:
                      additionalProperties:
                        anyOf:
                          - type: integer
                          - type: string
                        pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                        x-kubernetes-int-or-string: true
                      description: ResourceList is a set of (resource name, quantity) pairs.
                      type: object
                  type: object
                restartPolicy:
                  default: OnFailure
                  description: RestartPolicy to be added to the SqlJob Pod.
                  enum:
                    - Always
                    - OnFailure
                    - Never
                  type: string
                schedule:
                  description: Schedule defines when the SqlJob will be executed.
                  properties:
                    cron:
                      description: Cron is a cron expression that defines the schedule.
                      type: string
                    suspend:
                      default: false
                      description: Suspend defines whether the schedule is active or not.
                      type: boolean
                  required:
                    - cron
                  type: object
                securityContext:
                  description: SecurityContext holds security configuration that will be applied to a container.
                  properties:
                    allowPrivilegeEscalation:
                      type: boolean
                    capabilities:
                      description: Adds and removes POSIX capabilities from running containers.
                      properties:
                        add:
                          description: Added capabilities
                          items:
                            description: Capability represent POSIX capabilities type
                            type: string
                          type: array
                          x-kubernetes-list-type: atomic
                        drop:
                          description: Removed capabilities
                          items:
                            description: Capability represent POSIX capabilities type
                            type: string
                          type: array
                          x-kubernetes-list-type: atomic
                      type: object
                    privileged:
                      type: boolean
                    readOnlyRootFilesystem:
                      type: boolean
                    runAsGroup:
                      format: int64
                      type: integer
                    runAsNonRoot:
                      type: boolean
                    runAsUser:
                      format: int64
                      type: integer
                  type: object
                serviceAccountName:
                  description: ServiceAccountName is the name of the ServiceAccount to be used by the Pods.
                  type: string
                sql:
                  description: Sql is the script to be executed by the SqlJob.
                  type: string
                sqlConfigMapKeyRef:
                  description: |-
                    SqlConfigMapKeyRef is a reference to a ConfigMap containing the Sql script.
                    It is defaulted to a ConfigMap with the contents of the Sql field.
                  properties:
                    key:
                      type: string
                    name:
                      default: ""
                      type: string
                  required:
                    - key
                  type: object
                  x-kubernetes-map-type: atomic
                successfulJobsHistoryLimit:
                  description: SuccessfulJobsHistoryLimit defines the maximum number of successful Jobs to be displayed.
                  format: int32
                  minimum: 0
                  type: integer
                timeZone:
                  description: TimeZone defines the timezone associated with the cron expression.
                  type: string
                tlsCASecretRef:
                  description: |-
                    TLSCACertSecretRef is a reference toa CA Secret used to establish trust when executing the SqlJob.
                    If not provided, the CA bundle provided by the referred MariaDB is used.
                  properties:
                    name:
                      default: ""
                      type: string
                  type: object
                tlsClientCertSecretRef:
                  description: |-
                    TLSClientCertSecretRef is a reference to a Kubernetes TLS Secret used as authentication when executing the SqlJob.
                    If not provided, the client certificate provided by the referred MariaDB is used.
                  properties:
                    name:
                      default: ""
                      type: string
                  type: object
                tolerations:
                  description: Tolerations to be used in the Pod.
                  items:
                    description: |-
                      The pod this Toleration is attached to tolerates any taint that matches
                      the triple <key,value,effect> using the matching operator <operator>.
                    properties:
                      effect:
                        description: |-
                          Effect indicates the taint effect to match. Empty means match all taint effects.
                          When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
                        type: string
                      key:
                        description: |-
                          Key is the taint key that the toleration applies to. Empty means match all taint keys.
                          If the key is empty, operator must be Exists; this combination means to match all values and all keys.
                        type: string
                      operator:
                        description: |-
                          Operator represents a key's relationship to the value.
                          Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal.
                          Exists is equivalent to wildcard for value, so that a pod can
                          tolerate all taints of a particular category.
                          Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators).
                        type: string
                      tolerationSeconds:
                        description: |-
                          TolerationSeconds represents the period of time the toleration (which must be
                          of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
                          it is not set, which means tolerate the taint forever (do not evict). Zero and
                          negative values will be treated as 0 (evict immediately) by the system.
                        format: int64
                        type: integer
                      value:
                        description: |-
                          Value is the taint value the toleration matches to.
                          If the operator is Exists, the value should be empty, otherwise just a regular string.
                        type: string
                    type: object
                  type: array
                username:
                  description: Username to be impersonated when executing the SqlJob.
                  type: string
              required:
                - mariaDbRef
                - passwordSecretKeyRef
                - username
              type: object
            status:
              description: SqlJobStatus defines the observed state of SqlJob
              properties:
                conditions:
                  description: Conditions for the SqlJob object.
                  items:
                    description: Condition contains details for one aspect of the current state of this API Resource.
                    properties:
                      lastTransitionTime:
                        description: |-
                          lastTransitionTime is the last time the condition transitioned from one status to another.
                          This should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.
                        format: date-time
                        type: string
                      message:
                        description: |-
                          message is a human readable message indicating details about the transition.
                          This may be an empty string.
                        maxLength: 32768
                        type: string
                      observedGeneration:
                        description: |-
                          observedGeneration represents the .metadata.generation that the condition was set based upon.
                          For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
                          with respect to the current state of the instance.
                        format: int64
                        minimum: 0
                        type: integer
                      reason:
                        description: |-
                          reason contains a programmatic identifier indicating the reason for the condition's last transition.
                          Producers of specific condition types may define expected values and meanings for this field,
                          and whether the values are considered a guaranteed API.
                          The value should be a CamelCase string.
                          This field may not be empty.
                        maxLength: 1024
                        minLength: 1
                        pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                        type: string
                      status:
                        description: status of the condition, one of True, False, Unknown.
                        enum:
                          - "True"
                          - "False"
                          - Unknown
                        type: string
                      type:
                        description: type of condition in CamelCase or in foo.example.com/CamelCase.
                        maxLength: 316
                        pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
                        type: string
                    required:
                      - lastTransitionTime
                      - message
                      - reason
                      - status
                      - type
                    type: object
                  type: array
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
