{{- if .Values.crds.managed }}

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.7.0
  creationTimestamp: null
  name: workloadspreads.apps.kruise.io
spec:
  group: apps.kruise.io
  names:
    kind: WorkloadSpread
    listKind: WorkloadSpreadList
    plural: workloadspreads
    shortNames:
      - ws
    singular: workloadspread
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .spec.targetRef.name
          name: WorkloadName
          type: string
        - jsonPath: .spec.targetRef.kind
          name: WorkloadKind
          type: string
        - description: Whether use the adaptive reschedule strategy
          jsonPath: .spec.scheduleStrategy.type[?(@ == "Adaptive")]
          name: Adaptive
          type: boolean
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      name: v1alpha1
      schema:
        openAPIV3Schema:
          description: WorkloadSpread is the Schema for the WorkloadSpread 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: WorkloadSpreadSpec defines the desired state of WorkloadSpread.
              properties:
                scheduleStrategy:
                  description: ScheduleStrategy indicates the strategy the WorkloadSpread used to preform the schedule between each of subsets.
                  properties:
                    adaptive:
                      description: Adaptive is used to communicate parameters when Type is AdaptiveWorkloadSpreadScheduleStrategyType.
                      properties:
                        disableSimulationSchedule:
                          description: DisableSimulationSchedule indicates whether to disable the feature of simulation schedule. Default is false. Webhook can take a simple general predicates to check whether Pod can be scheduled into this subset, but it just considers the Node resource and cannot replace scheduler to do richer predicates practically.
                          type: boolean
                        rescheduleCriticalSeconds:
                          description: RescheduleCriticalSeconds indicates how long controller will reschedule a schedule failed Pod to the subset that has redundant capacity after the subset where the Pod lives. If a Pod was scheduled failed and still in a unschedulabe status over RescheduleCriticalSeconds duration, the controller will reschedule it to a suitable subset.
                          format: int32
                          type: integer
                      type: object
                    type:
                      description: Type indicates the type of the WorkloadSpreadScheduleStrategy. Default is Fixed
                      enum:
                        - Adaptive
                        - Fixed
                        - ""
                      type: string
                  type: object
                subsets:
                  description: Subsets describes the pods distribution details between each of subsets.
                  items:
                    description: WorkloadSpreadSubset defines the details of a subset.
                    properties:
                      maxReplicas:
                        anyOf:
                          - type: integer
                          - type: string
                        description: MaxReplicas indicates the desired max replicas of this subset.
                        x-kubernetes-int-or-string: true
                      name:
                        description: Name should be unique between all of the subsets under one WorkloadSpread.
                        type: string
                      patch:
                        description: Patch indicates patching podTemplate to the Pod.
                        x-kubernetes-preserve-unknown-fields: true
                      preferredNodeSelectorTerms:
                        description: Indicates the node preferred selector to form the subset.
                        items:
                          description: An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).
                          properties:
                            preference:
                              description: A node selector term, associated with the corresponding weight.
                              properties:
                                matchExpressions:
                                  description: A list of node selector requirements by node's labels.
                                  items:
                                    description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
                                    properties:
                                      key:
                                        description: The label key that the selector applies to.
                                        type: string
                                      operator:
                                        description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
                                        type: string
                                      values:
                                        description: 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. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
                                        items:
                                          type: string
                                        type: array
                                    required:
                                      - key
                                      - operator
                                    type: object
                                  type: array
                                matchFields:
                                  description: A list of node selector requirements by node's fields.
                                  items:
                                    description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
                                    properties:
                                      key:
                                        description: The label key that the selector applies to.
                                        type: string
                                      operator:
                                        description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
                                        type: string
                                      values:
                                        description: 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. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
                                        items:
                                          type: string
                                        type: array
                                    required:
                                      - key
                                      - operator
                                    type: object
                                  type: array
                              type: object
                            weight:
                              description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
                              format: int32
                              type: integer
                          required:
                            - preference
                            - weight
                          type: object
                        type: array
                      requiredNodeSelectorTerm:
                        description: Indicates the node required selector to form the subset.
                        properties:
                          matchExpressions:
                            description: A list of node selector requirements by node's labels.
                            items:
                              description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
                              properties:
                                key:
                                  description: The label key that the selector applies to.
                                  type: string
                                operator:
                                  description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
                                  type: string
                                values:
                                  description: 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. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
                                  items:
                                    type: string
                                  type: array
                              required:
                                - key
                                - operator
                              type: object
                            type: array
                          matchFields:
                            description: A list of node selector requirements by node's fields.
                            items:
                              description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
                              properties:
                                key:
                                  description: The label key that the selector applies to.
                                  type: string
                                operator:
                                  description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
                                  type: string
                                values:
                                  description: 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. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
                                  items:
                                    type: string
                                  type: array
                              required:
                                - key
                                - operator
                              type: object
                            type: array
                        type: object
                      tolerations:
                        description: Indicates the tolerations the pods under this subset have.
                        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 and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
                              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
                    required:
                      - name
                    type: object
                  type: array
                targetRef:
                  description: TargetReference is the target workload that WorkloadSpread want to control.
                  properties:
                    apiVersion:
                      description: API version of the referent.
                      type: string
                    kind:
                      description: Kind of the referent.
                      type: string
                    name:
                      description: Name of the referent.
                      type: string
                  required:
                    - apiVersion
                    - kind
                    - name
                  type: object
              required:
                - subsets
                - targetRef
              type: object
            status:
              description: WorkloadSpreadStatus defines the observed state of WorkloadSpread.
              properties:
                observedGeneration:
                  description: ObservedGeneration is the most recent generation observed for this WorkloadSpread. It corresponds to the WorkloadSpread's generation, which is updated on mutation by the API Server.
                  format: int64
                  type: integer
                subsetStatuses:
                  description: Contains the status of each subset. Each element in this array represents one subset
                  items:
                    description: WorkloadSpreadSubsetStatus defines the observed state of subset
                    properties:
                      conditions:
                        description: Conditions is an array of current observed subset conditions.
                        items:
                          properties:
                            lastTransitionTime:
                              description: Last time the condition transitioned from one status to another.
                              format: date-time
                              type: string
                            message:
                              description: A human readable message indicating details about the transition.
                              type: string
                            reason:
                              description: The reason for the condition's last transition.
                              type: string
                            status:
                              description: Status of the condition, one of True, False, Unknown.
                              type: string
                            type:
                              description: Type of in place set condition.
                              type: string
                          required:
                            - status
                            - type
                          type: object
                        type: array
                      creatingPods:
                        additionalProperties:
                          format: date-time
                          type: string
                        description: CreatingPods contains information about pods whose creation was processed by the webhook handler but not yet been observed by the WorkloadSpread controller. A pod will be in this map from the time when the webhook handler processed the creation request to the time when the pod is seen by controller. The key in the map is the name of the pod and the value is the time when the webhook handler process the creation request. If the real creation didn't happen and a pod is still in this map, it will be removed from the list automatically by WorkloadSpread controller after some time. If everything goes smooth this map should be empty for the most of the time. Large number of entries in the map may indicate problems with pod creations.
                        type: object
                      deletingPods:
                        additionalProperties:
                          format: date-time
                          type: string
                        description: DeletingPods is similar with CreatingPods and it contains information about pod deletion.
                        type: object
                      missingReplicas:
                        description: MissingReplicas is the number of active replicas belong to this subset not be found. MissingReplicas > 0 indicates the subset is still missing MissingReplicas pods to create MissingReplicas = 0 indicates the subset already has enough pods, there is no need to create MissingReplicas = -1 indicates the subset's MaxReplicas not set, then there is no limit for pods number
                        format: int32
                        type: integer
                      name:
                        description: Name should be unique between all of the subsets under one WorkloadSpread.
                        type: string
                      replicas:
                        description: Replicas is the most recently observed number of active replicas for subset.
                        format: int32
                        type: integer
                    required:
                      - missingReplicas
                      - name
                      - replicas
                    type: object
                  type: array
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
{{- end }}
