-
Notifications
You must be signed in to change notification settings - Fork 982
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
Add topologySpreadConstraints configuration to pod spec. #2530
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -895,6 +895,16 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{ | |
}, | ||
}, | ||
}, | ||
"topologySpreadConstraints": { | ||
Type: "array", | ||
Nullable: true, | ||
Items: &apiextv1.JSONSchemaPropsOrArray{ | ||
Schema: &apiextv1.JSONSchemaProps{ | ||
Type: "object", | ||
XPreserveUnknownFields: util.True(), | ||
}, | ||
}, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here with the |
||
"useLoadBalancer": { | ||
Type: "boolean", | ||
Description: "deprecated", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -494,6 +494,11 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa | |
needsRollUpdate = true | ||
reasons = append(reasons, "new statefulset's pod affinity does not match the current one") | ||
} | ||
if !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.TopologySpreadConstraints, statefulSet.Spec.Template.Spec.TopologySpreadConstraints) { | ||
needsReplace = true | ||
needsRollUpdate = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this really need to trigger a rolling update of pods executed by operator? Will not K8s take care of it then once the statefulset is replaced? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, but is this wrong too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm good point. Maybe we can leave as is for now. With rolling update we make sure pods immediately adhere the new constraints. |
||
reasons = append(reasons, "new statefulset's pod topologySpreadConstraints does not match the current one") | ||
} | ||
if len(c.Statefulset.Spec.Template.Spec.Tolerations) != len(statefulSet.Spec.Template.Spec.Tolerations) { | ||
needsReplace = true | ||
needsRollUpdate = true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not add all the fields of a topologySpreadConstraint like with what we have for
nodeAffinity
. I feel, it's too lazy and unsafe to allow arbitrary fields withx-kubernetes-preserve-unknown-fields: true