-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(helm): correct installGatewayAPI helm value defaulting #13759
Conversation
Signed-off-by: Alex Leong <alex@buoyant.io>
@@ -1,4 +1,4 @@ | |||
{{- if .Values.enableTlsRoutes | default .Values.installGatewayAPI }} | |||
{{- if (ternary .Values.enableTcpRoutes .Values.installGatewayAPI (hasKey .Values "enableTcpRoutes")) }} |
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.
Should be enableTlsRoutes
cli/cmd/install_helm_test.go
Outdated
@@ -147,11 +167,15 @@ func testRenderHelm(t *testing.T, linkerd2Chart *chart.Chart, goldenFileName str | |||
IsInstall: true, | |||
} | |||
|
|||
fmt.Println("overrideConfig", overrideConfig) |
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.
Leftover debugging?
cli/cmd/install_helm_test.go
Outdated
valuesToRender, err := chartutil.ToRenderValues(linkerd2Chart, overrideConfig, releaseOptions, nil) | ||
if err != nil { | ||
t.Fatal("Unexpected error", err) | ||
} | ||
|
||
fmt.Println("valuesToRender", valuesToRender) |
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.
ditto
@@ -1,4 +1,4 @@ | |||
{{- if .Values.enableHttpRoutes | default .Values.installGatewayAPI }} | |||
{{- if (ternary .Values.enableHttpRoutes .Values.installGatewayAPI (hasKey .Values "enableHttpRoutes")) }} |
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.
Nit: no-parenthesis alternative:
{{- if hasKey .Values "enableHttpRoutes" | ternary .Values.enableHttpRoutes .Values.installGatewayAPI }}
The Helm function
default
will treat a boolean false value as unset and use the default instead of the false, even when it is set. When rendering CRDs during install or upgrade, this can cause Linkerd to fall back to using theinstallGatewayAPI
value even whenenableHttpRoutes
is explicitly set to false.We replace the
default
function with a ternary which checks if the key is present. We also add tests for both CLI and Helm.