# For Kubernetes before 1.16.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: statefulsets.apps.pingcap.com
spec:
  group: apps.pingcap.com
  scope: Namespaced
  names:
    plural: statefulsets
    singular: statefulset
    kind: StatefulSet
    shortNames:
    - asts
  versions:
  - name: v1alpha1
    served: true
    storage: false
  - name: v1
    served: true
    storage: true
  validation:
    openAPIV3Schema:
      type: object
      properties:
        spec:
          type: object
          required:
          - replicas
          - selector
          - template
          - serviceName
          properties:
            replicas:
              type: integer
              minimum: 0
            selector:
              type: object
            template:
              type: object
            volumeClaimTemplates:
              type: array
            serviceName:
              type: string
            podManagementPolicy:
              type: string
              pattern: '^(OrderedReady|Parallel)$'
            updateStrategy:
              type: object
            revisionHistoryLimit:
              type: integer
              minimum: 0
  # subresources describes the subresources for custom resources.
  subresources:
    # status enables the status subresource.
    status: {}
    # scale enables the scale subresource.
    scale:
      # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
      specReplicasPath: .spec.replicas
      # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
      statusReplicasPath: .status.replicas
      # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
      labelSelectorPath: .status.labelSelector
  additionalPrinterColumns:
  - name: Desired
    type: integer
    JSONPath: .spec.replicas
  - name: Current
    type: integer
    JSONPath: .status.readyReplicas
  - name: Age
    type: date
    JSONPath: .metadata.creationTimestamp
