Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow more comprehensive affinity config #5285

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

Merged
jsjoeio merged 2 commits into coder:main from strowk:allow-affinity-config
Jul 18, 2022

Conversation

Copy link

@strowk strowk commented Jun 21, 2022

This PR changes helm template to allow more comprehensive configuration in affinity. Instead of treating affinity as a static map, it expects a string passed there, which would be then processed as a template and therefore resolve any links, such as f.e. {{ include "code-server.name" . }} .
This then allows to configure something like this:

affinity: |
 podAntiAffinity:
 preferredDuringSchedulingIgnoredDuringExecution:
 - weight: 100
 podAffinityTerm:
 labelSelector:
 matchExpressions:
 - key: app.kubernetes.io/name
 operator: In
 values:
 - {{ include "code-server.name" . }}
 topologyKey: kubernetes.io/hostname

Above allows to properly spread pods over nodes without hardcoding any labels in values file.

This approach is somewhat common in helm ecosystem, f.e. see here:
https://github.com/codecentric/helm-charts/blob/31f44ca368cef7585760edc8f22c011cab1be284/charts/keycloakx/templates/statefulset.yaml#L184

The change is breaking though, so I am not 100 percent sure this has to be included, I am sending this as a suggestion and input for discussion.

jsjoeio reacted with thumbs up emoji
Copy link
Contributor

jsjoeio commented Jun 21, 2022

Copy link
Member

@bpmct bpmct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good to me, I did some digging and this does indeed look like a common practice. I also think it's fine to push a breaking change given we don't publish our helm charts anywhere and they are manually pulled.

However, will defer to @Matthew-Beckett to review and approve.

jsjoeio and Matthew-Beckett reacted with thumbs up emoji
Copy link
Contributor

@Matthew-Beckett Matthew-Beckett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

jsjoeio reacted with heart emoji
@jsjoeio jsjoeio enabled auto-merge (squash) July 18, 2022 19:00
@jsjoeio jsjoeio self-assigned this Jul 18, 2022
@jsjoeio jsjoeio added this to the 4.5.1 milestone Jul 18, 2022
@jsjoeio jsjoeio disabled auto-merge July 18, 2022 21:38
@jsjoeio jsjoeio merged commit de317a0 into coder:main Jul 18, 2022
@jsjoeio jsjoeio mentioned this pull request Jul 18, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@bpmct bpmct bpmct left review comments

+1 more reviewer

@Matthew-Beckett Matthew-Beckett Matthew-Beckett approved these changes

Reviewers whose approvals may not affect merge requirements
Labels
None yet
Projects
None yet
Milestone
4.5.1
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /