apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: sparkapplications.spark-operator.cloudchef-labs.com
spec:
  group: spark-operator.cloudchef-labs.com
  names:
    plural: sparkapplications
    singular: sparkapplication
    kind: SparkApplication
    shortNames:
      - sparkapp
  scope: Namespaced
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                core:
                  type: object
                  properties:
                    applicationType:
                      type: string
                      enum:
                        - Batch
                        - EndlessRun
                    deployMode:
                      type: string
                      enum:
                        - Cluster
                        - Client
                    container:
                      type: object
                      properties:
                        image:
                          type: string
                        imagePullPolicy:
                          type: string
                          enum:
                            - IfNotPresent
                            - Always
                            - Never
                    class:
                      type: string
                    args:
                      type: array
                      items:
                        type: string
                    applicationFileUrl:
                      type: string
                    pyFilesUrl:
                      type: string
                    namespace:
                      type: string
                    s3:
                      type: object
                      properties:
                        bucket:
                          type: string
                        accessKey:
                          type: object
                          properties:
                            valueFrom:
                              type: object
                              properties:
                                secretKeyRef:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    key:
                                      type: string
                                  required:
                                    - name
                                    - key
                        secretKey:
                          type: object
                          properties:
                            valueFrom:
                              type: object
                              properties:
                                secretKeyRef:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    key:
                                      type: string
                                  required:
                                    - name
                                    - key
                        endpoint:
                          type: string
                    hive:
                      type: object
                      properties:
                        metastoreUris:
                          type: array
                          items:
                            type: string
                driver:
                  type: object
                  properties:
                    serviceAccountName:
                      type: string
                    label:
                      type: object
                      additionalProperties:
                        type: string
                    annotation:
                      type: object
                      additionalProperties:
                        type: string
                    resources:
                      type: object
                      properties:
                        cores:
                          type: string
                        limitCores:
                          type: string
                        memory:
                          type: string
                    volumeMounts:
                      type: array
                      items:
                        type: object
                        properties:
                          mountPath:
                            type: string
                          mountPropagation:
                            type: string
                          name:
                            type: string
                          readOnly:
                            type: boolean
                          subPath:
                            type: string
                          subPathExpr:
                            type: string
                        required:
                          - mountPath
                          - name
                    podTemplate:
                      type: object
                      properties:
                        affinity:
                          properties:
                            nodeAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      preference:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchFields:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - preference
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  properties:
                                    nodeSelectorTerms:
                                      items:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchFields:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                        type: object
                                      type: array
                                  required:
                                    - nodeSelectorTerms
                                  type: object
                              type: object
                            podAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      podAffinityTerm:
                                        properties:
                                          labelSelector:
                                            properties:
                                              matchExpressions:
                                                items:
                                                  properties:
                                                    key:
                                                      type: string
                                                    operator:
                                                      type: string
                                                    values:
                                                      items:
                                                        type: string
                                                      type: array
                                                  required:
                                                    - key
                                                    - operator
                                                  type: object
                                                type: array
                                              matchLabels:
                                                additionalProperties:
                                                  type: string
                                                type: object
                                            type: object
                                          namespaces:
                                            items:
                                              type: string
                                            type: array
                                          topologyKey:
                                            type: string
                                        required:
                                          - topologyKey
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - podAffinityTerm
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      labelSelector:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchLabels:
                                            additionalProperties:
                                              type: string
                                            type: object
                                        type: object
                                      namespaces:
                                        items:
                                          type: string
                                        type: array
                                      topologyKey:
                                        type: string
                                    required:
                                      - topologyKey
                                    type: object
                                  type: array
                              type: object
                            podAntiAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      podAffinityTerm:
                                        properties:
                                          labelSelector:
                                            properties:
                                              matchExpressions:
                                                items:
                                                  properties:
                                                    key:
                                                      type: string
                                                    operator:
                                                      type: string
                                                    values:
                                                      items:
                                                        type: string
                                                      type: array
                                                  required:
                                                    - key
                                                    - operator
                                                  type: object
                                                type: array
                                              matchLabels:
                                                additionalProperties:
                                                  type: string
                                                type: object
                                            type: object
                                          namespaces:
                                            items:
                                              type: string
                                            type: array
                                          topologyKey:
                                            type: string
                                        required:
                                          - topologyKey
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - podAffinityTerm
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      labelSelector:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchLabels:
                                            additionalProperties:
                                              type: string
                                            type: object
                                        type: object
                                      namespaces:
                                        items:
                                          type: string
                                        type: array
                                      topologyKey:
                                        type: string
                                    required:
                                      - topologyKey
                                    type: object
                                  type: array
                              type: object
                          type: object
                        tolerations:
                          items:
                            properties:
                              effect:
                                type: string
                              key:
                                type: string
                              operator:
                                type: string
                              tolerationSeconds:
                                format: int64
                                type: integer
                              value:
                                type: string
                            type: object
                          type: array
                        securityContext:
                          properties:
                            fsGroup:
                              format: int64
                              type: integer
                            runAsGroup:
                              format: int64
                              type: integer
                            runAsNonRoot:
                              type: boolean
                            runAsUser:
                              format: int64
                              type: integer
                            seLinuxOptions:
                              properties:
                                level:
                                  type: string
                                role:
                                  type: string
                                type:
                                  type: string
                                user:
                                  type: string
                              type: object
                            supplementalGroups:
                              items:
                                format: int64
                                type: integer
                              type: array
                            sysctls:
                              items:
                                properties:
                                  name:
                                    type: string
                                  value:
                                    type: string
                                required:
                                  - name
                                  - value
                                type: object
                              type: array
                            windowsOptions:
                              properties:
                                gmsaCredentialSpec:
                                  type: string
                                gmsaCredentialSpecName:
                                  type: string
                                runAsUserName:
                                  type: string
                              type: object
                          type: object
                        schedulerName:
                          type: string
                        priorityClassName:
                          type: string
                        hostNetwork:
                          type: boolean
                        nodeSelector:
                          additionalProperties:
                            type: string
                          type: object
                executor:
                  type: object
                  properties:
                    instances:
                      type: integer
                    label:
                      type: object
                      additionalProperties:
                        type: string
                    annotation:
                      type: object
                      additionalProperties:
                        type: string
                    resources:
                      type: object
                      properties:
                        cores:
                          type: string
                        limitCores:
                          type: string
                        memory:
                          type: string
                    volumeMounts:
                      type: array
                      items:
                        type: object
                        properties:
                          mountPath:
                            type: string
                          mountPropagation:
                            type: string
                          name:
                            type: string
                          readOnly:
                            type: boolean
                          subPath:
                            type: string
                          subPathExpr:
                            type: string
                        required:
                          - mountPath
                          - name
                    podTemplate:
                      type: object
                      properties:
                        affinity:
                          properties:
                            nodeAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      preference:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchFields:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - preference
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  properties:
                                    nodeSelectorTerms:
                                      items:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchFields:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                        type: object
                                      type: array
                                  required:
                                    - nodeSelectorTerms
                                  type: object
                              type: object
                            podAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      podAffinityTerm:
                                        properties:
                                          labelSelector:
                                            properties:
                                              matchExpressions:
                                                items:
                                                  properties:
                                                    key:
                                                      type: string
                                                    operator:
                                                      type: string
                                                    values:
                                                      items:
                                                        type: string
                                                      type: array
                                                  required:
                                                    - key
                                                    - operator
                                                  type: object
                                                type: array
                                              matchLabels:
                                                additionalProperties:
                                                  type: string
                                                type: object
                                            type: object
                                          namespaces:
                                            items:
                                              type: string
                                            type: array
                                          topologyKey:
                                            type: string
                                        required:
                                          - topologyKey
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - podAffinityTerm
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      labelSelector:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchLabels:
                                            additionalProperties:
                                              type: string
                                            type: object
                                        type: object
                                      namespaces:
                                        items:
                                          type: string
                                        type: array
                                      topologyKey:
                                        type: string
                                    required:
                                      - topologyKey
                                    type: object
                                  type: array
                              type: object
                            podAntiAffinity:
                              properties:
                                preferredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      podAffinityTerm:
                                        properties:
                                          labelSelector:
                                            properties:
                                              matchExpressions:
                                                items:
                                                  properties:
                                                    key:
                                                      type: string
                                                    operator:
                                                      type: string
                                                    values:
                                                      items:
                                                        type: string
                                                      type: array
                                                  required:
                                                    - key
                                                    - operator
                                                  type: object
                                                type: array
                                              matchLabels:
                                                additionalProperties:
                                                  type: string
                                                type: object
                                            type: object
                                          namespaces:
                                            items:
                                              type: string
                                            type: array
                                          topologyKey:
                                            type: string
                                        required:
                                          - topologyKey
                                        type: object
                                      weight:
                                        format: int32
                                        type: integer
                                    required:
                                      - podAffinityTerm
                                      - weight
                                    type: object
                                  type: array
                                requiredDuringSchedulingIgnoredDuringExecution:
                                  items:
                                    properties:
                                      labelSelector:
                                        properties:
                                          matchExpressions:
                                            items:
                                              properties:
                                                key:
                                                  type: string
                                                operator:
                                                  type: string
                                                values:
                                                  items:
                                                    type: string
                                                  type: array
                                              required:
                                                - key
                                                - operator
                                              type: object
                                            type: array
                                          matchLabels:
                                            additionalProperties:
                                              type: string
                                            type: object
                                        type: object
                                      namespaces:
                                        items:
                                          type: string
                                        type: array
                                      topologyKey:
                                        type: string
                                    required:
                                      - topologyKey
                                    type: object
                                  type: array
                              type: object
                          type: object
                        tolerations:
                          items:
                            properties:
                              effect:
                                type: string
                              key:
                                type: string
                              operator:
                                type: string
                              tolerationSeconds:
                                format: int64
                                type: integer
                              value:
                                type: string
                            type: object
                          type: array
                        securityContext:
                          properties:
                            fsGroup:
                              format: int64
                              type: integer
                            runAsGroup:
                              format: int64
                              type: integer
                            runAsNonRoot:
                              type: boolean
                            runAsUser:
                              format: int64
                              type: integer
                            seLinuxOptions:
                              properties:
                                level:
                                  type: string
                                role:
                                  type: string
                                type:
                                  type: string
                                user:
                                  type: string
                              type: object
                            supplementalGroups:
                              items:
                                format: int64
                                type: integer
                              type: array
                            sysctls:
                              items:
                                properties:
                                  name:
                                    type: string
                                  value:
                                    type: string
                                required:
                                  - name
                                  - value
                                type: object
                              type: array
                            windowsOptions:
                              properties:
                                gmsaCredentialSpec:
                                  type: string
                                gmsaCredentialSpecName:
                                  type: string
                                runAsUserName:
                                  type: string
                              type: object
                          type: object
                        schedulerName:
                          type: string
                        priorityClassName:
                          type: string
                        hostNetwork:
                          type: boolean
                        nodeSelector:
                          additionalProperties:
                            type: string
                          type: object
                confs:
                  type: object
                  additionalProperties:
                    type: string
                volumes:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      type:
                        type: string
                        enum:
                          - SparkLocalDir
                          - Any
                      emptyDir:
                        type: object
                        properties:
                          medium:
                            type: string
                          sizeLimit:
                            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
                      hostPath:
                        type: object
                        properties:
                          path:
                            type: string
                          type:
                            type: string
                        required:
                          - path
                      persistentVolumeClaim:
                        type: object
                        properties:
                          claimName:
                            type: string
                          readOnly:
                            type: boolean
                        required:
                          - claimName
                    required:
                      - name


