Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placement enhancement: support spread policy #49

Closed
qiujian16 opened this issue Jun 7, 2021 · 9 comments
Closed

Placement enhancement: support spread policy #49

qiujian16 opened this issue Jun 7, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request kind/feature

Comments

@qiujian16
Copy link
Member

We should be able to support policy in placement:

  1. cluster affinity
  2. cluster anti affinity
  3. spreading
@qiujian16
Copy link
Member Author

/assign @qiujian16
/assign @elgnay

@jnpacker
Copy link
Member

jnpacker commented Jun 9, 2021

To add to the spreading. I was originally interested in putting a NumberOfClusters per predicate, to guarantee each predicate received some clusters, when a subset of all your clusters.

Example:

---
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: Placement
metadata:
  name: two-cloud-providers
  namespace: default
spec:
  clusterSets:
  - all-clusters
  predicates:
  - requiredClusterSelector:
      numberOfClusters: 3
      labelSelector:
        matchLabels:
          cloud: aws
  - requiredClusterSelector:
      numberOfClusters: 2
      labelSelector:
        matchLabels:
          cloud: gcp

So in this scenario, even if each cloud: type had 6 clusters, placement would return a list of 5 clusters, 3x in AWS and 2x in GCP. If AWS had less then 3 clusters, then as many as are available would be returned. There was also a suggestion to add minNumberOfClusters as a predicate option as well.

@qiujian16
Copy link
Member Author

we were try to build a controller by putting noc in the predicate, but controller cannot easily reason about it. Especially when we add other properties like workload anitaffinity etc...I think we could consider having to placements to achieve this. And set a common label on the placement decision, so consumers can filter all related placementdecision by labels. WDYT @jnpacker @elgnay

@jnpacker
Copy link
Member

jnpacker commented Jun 9, 2021

I see the same thing being achievable if an anti-affinity labelSelector, where I might use the label key or keys, like cloud.

And so if Spec.NumberOfClusters is 4 and I have two distinct values of label key cloud then I would spread out my results from the two, and is consumed in a single predicate.

@qiujian16
Copy link
Member Author

qiujian16 commented Jun 9, 2021

This is current in progress document https://docs.google.com/document/d/1aaRSnyChczgJvejzug-fkY2eYhhQWfa2CPmqRq5s-SA/edit#heading=h.t2wrspluvypn

I think what you mention according to the doc could be done by

spreadPolicy:
   spreadConstraints:
   - maxSkew: 1
     whenUnsatisfiable: DoNotSelect
     topologyKey: region.open-cluster-management.io
     topologyKeyType: Claim

so if we want 4 clusters only from aws and gcp and we want them to spread to them. It will be like

apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: Placement
metadata:
 name: ocp-placement
spec:
  numberOfClusters: 4
  predicates:
    requiredClusterSelector:
      claimSelector:
         matchExpressions:
           claimSelector:
             matchExpressions:
             - key: platform.open-cluster-management.io
               operator: In
               values:
               - AWS
               - GCP
 spreadPolicy:
   spreadConstraints:
   - maxSkew: 1
     whenUnsatisfiable: DoNotSelect
     topologyKey: platform.open-cluster-management.io
     topologyKeyType: Claim

@qiujian16 qiujian16 added the enhancement New feature or request label Jun 24, 2021
@qiujian16
Copy link
Member Author

/kind feature

@mikeshng mikeshng added this to the v0.5.0 milestone Jul 15, 2021
@qiujian16 qiujian16 removed this from the v0.5.0 milestone Oct 27, 2021
@haoqing0110
Copy link
Member

The proposal about Spread policy in Placement is merged.

@qiujian16
Copy link
Member Author

/close

@openshift-ci openshift-ci bot closed this as completed Nov 3, 2022
@openshift-ci
Copy link

openshift-ci bot commented Nov 3, 2022

@qiujian16: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kind/feature
Projects
Status: Done
Development

No branches or pull requests

5 participants