-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Include labelSelector for affinity and topologySpreadConstraints #4666
base: master
Are you sure you want to change the base?
Include labelSelector for affinity and topologySpreadConstraints #4666
Conversation
|
Welcome @pvickery-ParamountCommerce! |
Hi @pvickery-ParamountCommerce. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
651a289
to
8c7bd6d
Compare
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.
Thanks for the PR @pvickery-ParamountCommerce. The comments in values.yaml were incorrectly copied from a chart where this had been implemented. Did you also see that the same comment was present for affinity
? I think we have the following 3 options:
- Change the comments and don't add default label selectors
- Implement your pattern for
affinity
- Implement the other pattern
FYI you also need to add a chart CHANGELOG entry under [UNRELEASED]
.
8c7bd6d
to
fe6ba6c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for the feedback @stevehipwell! I used these values to test affinity when automatically adding the affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey : "kubernetes.io/hostname"
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - test
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey : "kubernetes.io/hostname"
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - test
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey : "kubernetes.io/hostname"
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - test
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey : "kubernetes.io/hostname"
# labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - test |
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.
Could you move the basic structure out into the deployment template, use smaller template functions and make use of with
? Something like below (untested).
{{- with .Values.affinity }}
affinity:
{{- with .podAffinity }}
podAffinity:
{{- with preferredDuringSchedulingIgnoredDuringExecution }}
{{- range . }}
{{- if dig "podAffinityTerm" "labelSelector" nil . }}
{{- toYaml (list .) | nindent 10 }}
{{- else }}
{{ include "external-dns.podAffinityPreferred" . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
PR needs rebase. 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-sigs/prow repository. |
Description
The labelSelector is used to track the pods that are used for the topologySpreadConstraints calculation. matchLabelKeys is used to only use the pods in the current version of the deployments replicaset.
I believe the following message isn't true before this PR.
external-dns/charts/external-dns/values.yaml
Lines 155 to 156 in 1ceaf79
More details about matchLabelKeys can be found here:
Checklist