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

[OSD-25656] Enhance the affinity rules to avoid pod mis-scheduling #62

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
21 changes: 14 additions & 7 deletions package/resources.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ spec:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
# Enforce scheduling on nodes with the correct hypershift.openshift.io/cluster label
nodeSelectorTerms:
- matchExpressions:
- key: hypershift.openshift.io/cluster
operator: In
values:
- '{{.package.metadata.namespace}}'
xiaoyu74 marked this conversation as resolved.
Show resolved Hide resolved
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 50
preference:
Expand All @@ -169,13 +177,12 @@ spec:
operator: In
values:
- "true"
- weight: 70
preference:
matchExpressions:
- key: hypershift.openshift.io/cluster
operator: In
values:
- '{{.package.metadata.namespace}}'
# Fallback preference to any worker node (for cases where labels are missing)
- weight: 30
preference:
matchExpressions:
- key: node-role.kubernetes.io/worker
operator: Exists
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
Expand Down