apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: nodegroups.atlassian.com
spec:
  group: atlassian.com
  names:
    kind: NodeGroup
    listKind: NodeGroupList
    plural: nodegroups
    shortNames:
    - ng
    singular: nodegroup
  scope: Cluster
  versions:
  - additionalPrinterColumns:
    - description: The name of the node group in the cloud provider
      jsonPath: .spec.nodeGroupName
      name: Node Group Name
      type: string
    - description: The method to use when cycling nodes
      jsonPath: .spec.cycleSettings.method
      name: Method
      type: string
    - description: The number of nodes to cycle in parallel
      jsonPath: .spec.cycleSettings.concurrency
      name: Concurrency
      type: integer
    name: v1
    schema:
      openAPIV3Schema:
        description: NodeGroup is the Schema for the nodegroups 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:
            description: NodeGroupSpec defines the desired state of NodeGroup
            properties:
              cycleSettings:
                description: CycleSettings stores the settings to use for cycling
                  the nodes.
                properties:
                  concurrency:
                    description: Concurrency is the number of nodes that one CycleNodeRequest
                      will work on in parallel. Defaults to the size of the node group.
                    format: int64
                    type: integer
                  cyclingTimeout:
                    description: CyclingTimeout is a string in time duration format
                      that defines how long a until an in-progress CNS request timeout
                      from the time it's worked on by the controller. If no cyclingTimeout
                      is provided, CNS will use the default controller CNS cyclingTimeout.
                    type: string
                  ignoreNamespaces:
                    description: IgnoreNamespaces is a list of namespace names in
                      which running pods should be ignored when deciding whether a
                      node has no more pods running.
                    items:
                      type: string
                    type: array
                  ignorePodsLabels:
                    additionalProperties:
                      items:
                        type: string
                      type: array
                    description: 'IgnorePodLabels is a map of values for labels that
                      describes which pods should be ignored when deciding whether
                      a node has no more pods running. This map defines a union: any
                      pod that matches any of the values for a given label name will
                      be ignored.'
                    type: object
                  labelsToRemove:
                    description: LabelsToRemove is an array of labels to remove off
                      of the pods running on the node This can be used to remove a
                      pod from a service/endpoint before evicting/deleting it to prevent
                      traffic being sent to it.
                    items:
                      type: string
                    type: array
                  method:
                    description: Method describes the type of cycle operation to use.
                    enum:
                    - Drain
                    - Wait
                    type: string
                required:
                - method
                type: object
              healthChecks:
                description: Healthchecks stores the settings to configure instance
                  custom health checks
                items:
                  description: HealthCheck defines the health check configuration
                    for the NodeGroup
                  properties:
                    endpoint:
                      description: 'Endpoint url of the health check. Optional: {{
                        .NodeIP }} gets replaced by the private IP of the node being
                        scaled up.'
                      type: string
                    regexMatch:
                      description: RegexMatch specifies a regex string the body of
                        the http result to should. By default no matching is done.
                      type: string
                    validStatusCodes:
                      description: ValidStatusCodes keeps track of the list of possible
                        status codes returned by the endpoint denoting the service
                        as healthy. Defaults to [200].
                      items:
                        type: integer
                      type: array
                    waitPeriod:
                      description: WaitPeriod is the time allowed for the health check
                        to pass before considering the service unhealthy and failing
                        the CycleNodeRequest.
                      type: string
                  required:
                  - endpoint
                  - waitPeriod
                  type: object
                type: array
              nodeGroupName:
                description: NodeGroupName is the name of the node group in the cloud
                  provider that corresponds to this NodeGroup resource.
                type: string
              nodeGroupsList:
                description: NodeGroupsList is a list of cloud provider node groups
                  that corresponds to this NodeGroup resource.
                items:
                  type: string
                type: array
              nodeSelector:
                description: NodeSelector is the label selector used to select nodes
                  that belong to this NodeGroup.
                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
                      required:
                      - key
                      - operator
                      type: object
                    type: array
                  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
            required:
            - cycleSettings
            - nodeGroupName
            - nodeSelector
            type: object
          status:
            description: NodeGroupStatus defines the observed state of NodeGroup
            type: object
        type: object
    served: true
    storage: true
    subresources: {}
