apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: placements.cluster.open-cluster-management.io
spec:
  group: cluster.open-cluster-management.io
  names:
    kind: Placement
    listKind: PlacementList
    plural: placements
    singular: placement
  scope: Namespaced
  preserveUnknownFields: false
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: "Placement defines a rule to select a set of ManagedClusters
          from the ManagedClusterSets bound to the placement namespace. \n Here is
          how the placement policy combines with other selection methods to determine
          a matching list of ManagedClusters: 1) Kubernetes clusters are registered
          with hub as cluster-scoped ManagedClusters; 2) ManagedClusters are organized
          into cluster-scoped ManagedClusterSets; 3) ManagedClusterSets are bound
          to workload namespaces; 4) Namespace-scoped Placements specify a slice of
          ManagedClusterSets which select a working set    of potential ManagedClusters;
          5) Then Placements subselect from that working set using label/claim selection.
          \n No ManagedCluster will be selected if no ManagedClusterSet is bound to
          the placement namespace. User is able to bind a ManagedClusterSet to a namespace
          by creating a ManagedClusterSetBinding in that namespace if they have a
          RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`.
          \n A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement
          name} will be created to represent the ManagedClusters selected by this
          placement. \n If a ManagedCluster is selected and added into the PlacementDecisions,
          other components may apply workload on it; once it is removed from the PlacementDecisions,
          the workload applied on this ManagedCluster should be evicted accordingly."
        type: object
        required:
        - spec
        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: Spec defines the attributes of Placement.
            type: object
            properties:
              clusterSets:
                description: ClusterSets represent the ManagedClusterSets from which
                  the ManagedClusters are selected. If the slice is empty, ManagedClusters
                  will be selected from the ManagedClusterSets bound to the placement
                  namespace, otherwise ManagedClusters will be selected from the intersection
                  of this slice and the ManagedClusterSets bound to the placement
                  namespace.
                type: array
                items:
                  type: string
              numberOfClusters:
                description: NumberOfClusters represents the desired number of ManagedClusters
                  to be selected which meet the placement requirements. 1) If not
                  specified, all ManagedClusters which meet the placement requirements
                  (including ClusterSets,    and Predicates) will be selected; 2)
                  Otherwise if the nubmer of ManagedClusters meet the placement requirements
                  is larger than    NumberOfClusters, a random subset with desired
                  number of ManagedClusters will be selected; 3) If the nubmer of
                  ManagedClusters meet the placement requirements is equal to NumberOfClusters,    all
                  of them will be selected; 4) If the nubmer of ManagedClusters meet
                  the placement requirements is less than NumberOfClusters,    all
                  of them will be selected, and the status of condition `PlacementConditionSatisfied`
                  will be    set to false;
                type: integer
                format: int32
              predicates:
                description: Predicates represent a slice of predicates to select
                  ManagedClusters. The predicates are ORed.
                type: array
                items:
                  description: ClusterPredicate represents a predicate to select ManagedClusters.
                  type: object
                  properties:
                    requiredClusterSelector:
                      description: RequiredClusterSelector represents a selector of
                        ManagedClusters by label and claim. If specified, 1) Any ManagedCluster,
                        which does not match the selector, should not be selected
                        by this ClusterPredicate; 2) If a selected ManagedCluster
                        (of this ClusterPredicate) ceases to match the selector (e.g.
                        due to    an update) of any ClusterPredicate, it will be eventually
                        removed from the placement decisions; 3) If a ManagedCluster
                        (not selected previously) starts to match the selector, it
                        will either    be selected or at least has a chance to be
                        selected (when NumberOfClusters is specified);
                      type: object
                      properties:
                        claimSelector:
                          description: ClaimSelector represents a selector of ManagedClusters
                            by clusterClaims in status
                          type: object
                          properties:
                            matchExpressions:
                              description: matchExpressions is a list of cluster claim
                                selector requirements. The requirements are ANDed.
                              type: array
                              items:
                                description: A label selector requirement is a selector
                                  that contains values, a key, and an operator that
                                  relates the key and values.
                                type: object
                                required:
                                - key
                                - operator
                                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.
                                    type: array
                                    items:
                                      type: string
                        labelSelector:
                          description: LabelSelector represents a selector of ManagedClusters
                            by label
                          type: object
                          properties:
                            matchExpressions:
                              description: matchExpressions is a list of label selector
                                requirements. The requirements are ANDed.
                              type: array
                              items:
                                description: A label selector requirement is a selector
                                  that contains values, a key, and an operator that
                                  relates the key and values.
                                type: object
                                required:
                                - key
                                - operator
                                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.
                                    type: array
                                    items:
                                      type: string
                            matchLabels:
                              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
                              additionalProperties:
                                type: string
          status:
            description: Status represents the current status of the Placement
            type: object
            properties:
              conditions:
                description: Conditions contains the different condition statuses
                  for this Placement.
                type: array
                items:
                  description: "Condition contains details for one aspect of the current
                    state of this API Resource. --- This struct is intended for direct
                    use as an array at the field path .status.conditions.  For example,
                    type FooStatus struct{     // Represents the observations of a
                    foo's current state.     // Known .status.conditions.type are:
                    \"Available\", \"Progressing\", and \"Degraded\"     // +patchMergeKey=type
                    \    // +patchStrategy=merge     // +listType=map     // +listMapKey=type
                    \    Conditions []metav1.Condition `json:\"conditions,omitempty\"
                    patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
                    \n     // other fields }"
                  type: object
                  required:
                  - lastTransitionTime
                  - message
                  - reason
                  - status
                  - type
                  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.
                      type: string
                      format: date-time
                    message:
                      description: message is a human readable message indicating
                        details about the transition. This may be an empty string.
                      type: string
                      maxLength: 32768
                    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.
                      type: integer
                      format: int64
                      minimum: 0
                    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.
                      type: string
                      maxLength: 1024
                      minLength: 1
                      pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                    status:
                      description: status of the condition, one of True, False, Unknown.
                      type: string
                      enum:
                      - "True"
                      - "False"
                      - Unknown
                    type:
                      description: type of condition in CamelCase or in foo.example.com/CamelCase.
                        --- Many .condition.type values are consistent across resources
                        like Available, but because arbitrary conditions can be useful
                        (see .node.status.conditions), the ability to deconflict is
                        important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
                      type: string
                      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])$
              numberOfSelectedClusters:
                description: NumberOfSelectedClusters represents the number of selected
                  ManagedClusters
                type: integer
                format: int32
    served: true
    storage: true
    subresources:
      status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
