-
Notifications
You must be signed in to change notification settings - Fork 326
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 validation that externalServers.hosts is not set to HCP-managed cluster's addresses when global.cloud.enabled #3315
Add validation that externalServers.hosts is not set to HCP-managed cluster's addresses when global.cloud.enabled #3315
Conversation
aae9b78
to
8089391
Compare
8089391
to
a1768e7
Compare
{{- if and .Values.externalServers.enabled .Values.global.cloud.enabled }} | ||
{{- if and (gt (len .Values.externalServers.hosts) 0) (regexMatch ".+.hashicorp.cloud$" ( first .Values.externalServers.hosts )) }}{{fail "global.cloud.enabled cannot be used in combination with an HCP-managed cluster address in externalServers.hosts. global.cloud.enabled is for linked self-managed clusters."}}{{- end }} | ||
{{- end }} |
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.
Because of the check directly above this one, we should never attempt to evaluate the inner if
unless .Values.externalServers.hosts
has been set.
…luster's addresses when global.cloud.enabled (#3218)
This ensures that we validate prerequisite conditions before applying the more specific validation for `global.cloud.enabled`.
a1768e7
to
2dd26bf
Compare
Updated changelog filename to match this PR |
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.
Thank you @zalimeni for this fix! I'm checking since I didn't last time: are these acceptance test failures an issue or possibly broken because of this change? https://github.com/hashicorp/consul-k8s-workflows/actions/runs/7119514288
@jjti sure thing! Re: the acceptance test failure, I think you are ok. Given the vanilla acceptance suite passed and this change isn't specific to CNI, I expect you just hit a flake, which unfortunately isn't uncommon r/n w/ the acceptance tests (particularly CNI). Consider me "approved" even though I opened the PR, and feel free to merge + backport when it makes sense. |
…luster's addresses when global.cloud.enabled (#3315)
This reintroduces #3218 with an additional small change to ensure Helm template validation is applied with necessary short-circuits. I've added the fix as a separate commit to simplify review based on the original.
Original PR description below:
Overview
If we set
externalServers.hosts
to the public or private address of an HCP-manged cluster, we run into the following because we're hardcoding-tls-server-name
toserver.{{ .Values.global.datacenter}}.{{ .Values.global.domain}}
:We hard-code
-tls-server-name
in many places like:consul-k8s/charts/consul/templates/_helpers.tpl
Lines 229 to 231 in 4d7a187
Changes proposed in this PR:
global.cloud.enabled
while also usingexternalServers.hosts
that point at an HCP-managed cluster (any address that has the suffix ".hashicorp.cloud")values.yaml
describing howglobal.cloud
is really for linking clusters, not for HCP-managed cloud clusters.How I've tested this PR:
How I expect reviewers to test this PR:
Checklist: