Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Add topologySpreadConstraints support for server pods #863

Merged
merged 4 commits into from
Mar 19, 2021
Merged

Add topologySpreadConstraints support for server pods #863

merged 4 commits into from
Mar 19, 2021

Conversation

lawliet89
Copy link
Contributor

Changes proposed in this PR:

  • Add topologySpreadConstraints support for server pods

How I've tested this PR:

  • Deploy a new Consul cluster with server.topologySpreadConstraints set.

How I expect reviewers to test this PR:

  • Deploy a new Consul cluster with server.topologySpreadConstraints set.

Checklist:

  • Bats tests added
  • CHANGELOG entry added (HashiCorp engineers only, community PRs should not add a changelog entry)

Note:

This helps to spread server pods evenly into all AZs.

Copy link

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

Thanks so much for the contribution @lawliet89 !! This looks great. Just added a comment about ensuring we template the value for only valid kube versions.

@@ -63,6 +63,10 @@ spec:
{{- if .Values.server.tolerations }}
tolerations:
{{ tpl .Values.server.tolerations . | nindent 8 | trim }}
{{- end }}
{{- if .Values.server.topologySpreadConstraints }}

Choose a reason for hiding this comment

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

Could you add a check here similar to:
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "18" ) }} ?

There is a warning in the values file, but this might be helpful in ensuring it doesn't accidentally get templated when say re-using a values file. We have tests that do something similar in ui-ingress.bats for reference!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the checks.

A side note: do you think it's better to just have this fail instead of being silently ignored when a user tries to use this on a cluster < 1.18 though?

Copy link

@thisisnotashwin thisisnotashwin Mar 17, 2021

Choose a reason for hiding this comment

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

YES! I like this idea a lot. Would you mind updating the PR to fail if the user attempts to set this value on a cluster < 1.18?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added that in.

Copy link

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

🙏 thank you @lawliet89

@thisisnotashwin thisisnotashwin merged commit f197e10 into hashicorp:master Mar 19, 2021
@lawliet89 lawliet89 deleted the server-topologySpreadConstraints branch March 20, 2021 01:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants