Closed shreyas-s-rao closed 1 year ago
/assign @unmarshall @ashwani2k PTAL
/assign
Note to reviewers to test the PR:
make deploy-with-certmanager
to deploy cert-manager as well as the kupid extensionClusterPodSchedulingPolicy
for mutating nodeAffinity
for statefulset pods (sample resource provided here)nodeAffinity
different from the policy, and ensure from kupid logs that it mutates the statefulset You may use the following examples to test the PR:
NodeAffinity
present on the pod spec:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: a
operator: In
values:
- A
- key: b
operator: In
values:
- B
- matchExpressions:
- key: c
operator: In
values:
- C
kupid-sts-test.txt (github doesn't allow me to upload YAML files, hence renamed to .txt)
NodeAffinity
defined by the ClusterPodSchedulingPolicy
:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: d
operator: In
values:
- D
- matchExpressions:
- key: e
operator: In
values:
- E
matchFields:
- key: metadata.name
operator: In
values:
- F
Expected correctly merged nodeAffinity
with this PR (note that the affinity terms are merged using cartesian product, which means that the policy specified by Kupid is truly enforced on the pod spec, so a true strategic merge patch happens here):
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: d
operator: In
values:
- D
- key: a
operator: In
values:
- A
- key: b
operator: In
values:
- B
- matchExpressions:
- key: e
operator: In
values:
- E
- key: a
operator: In
values:
- A
- key: b
operator: In
values:
- B
matchFields:
- key: metadata.name
operator: In
values:
- F
- matchExpressions:
- key: d
operator: In
values:
- D
- key: c
operator: In
values:
- C
- matchExpressions:
- key: e
operator: In
values:
- E
- key: c
operator: In
values:
- C
matchFields:
- key: metadata.name
operator: In
values:
- F
Wrongly merged nodeAffinity
, prior to this PR (observe here that the affinity rules are simply appended to each other, causing the scheduler to perform an OR amongst these NodeSelectorTerms
and choose any one for scheduling the pod, which is incorrect):
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: a
operator: In
values:
- A
- key: b
operator: In
values:
- B
- matchExpressions:
- key: c
operator: In
values:
- C
- matchExpressions:
- key: d
operator: In
values:
- D
- matchExpressions:
- key: e
operator: In
values:
- E
matchFields:
- key: metadata.name
operator: In
values:
- F
Please also change the replicas
count to 2 or 3 to test the HA mode of Kupid introduced in this PR with leader election capabilities.
In order to test the interplay of kupid webhook with other mutating webhooks such as GRM from gardener, please run kupid as an extension in the gardener local setup and deploy a HA seed and then a HA shoot and observe the effect on the etcd-main
statefulset deployed as part of the shoot control plane.
/unassign
What this PR does / why we need it: This PR brings the following changes and improvements:
NodeSelectorTerms
make [un]deploy-with-certmanager
Make targetWhich issue(s) this PR fixes: Fixes #25
Special notes for your reviewer:
Release note: