Skip to content
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

BUG: kubernetes-ingress: Replace tpl with default #244

Merged

Conversation

mecampbellsoup
Copy link
Contributor

@mecampbellsoup mecampbellsoup commented May 23, 2024

Follow on from #243.

Summary

Instead of passing a templated string value tag: "{{ .Chart.AppVersion }}" and relying on tpl inside the templates that consume it, it is safer, less complicated, and more standardized to:

  1. Default to a falsey value i.e. tag: ""; and
  2. place the "or default to the .Chart.AppVersion" logic inside the templates that consume that value.

For example, grafana's charts use this same pattern (I lifted it from there):

Context

Since tpl expects a string, passing an unqouted, fully-numeric image tag value (imagine a git commit SHA1 of 53349267) results in a helm templating error, e.g.:

INFO[0000] install.go:214: [debug] Original chart version: ""
install.go:231: [debug] CHART PATH:
/home/mcampbell/github/coreweave/api-gateway/integration_tests

Error: template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64
helm.go:84: [debug] template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64  subtask=0 task=Render
std out err:
%!(EXTRA *errors.errorString=install.go:214: [debug] Original chart
version: ""
install.go:231: [debug] CHART PATH:
/home/mcampbell/github/coreweave/api-gateway/integration_tests

Error: template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64
helm.go:84: [debug] template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64

Since `tpl` expects a string, passing an unqouted, fully-numeric image tag
value results in a helm templating error, e.g.:

```
INFO[0000] install.go:214: [debug] Original chart version: ""
install.go:231: [debug] CHART PATH:
/home/mcampbell/github/coreweave/api-gateway/integration_tests

Error: template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64
helm.go:84: [debug] template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64  subtask=0 task=Render
std out err:
%!(EXTRA *errors.errorString=install.go:214: [debug] Original chart
version: ""
install.go:231: [debug] CHART PATH:
/home/mcampbell/github/coreweave/api-gateway/integration_tests

Error: template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64
helm.go:84: [debug] template:
cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml:91:74:
executing
"cloud-integration-tests/charts/cloud-app/charts/api-gateway/charts/kubernetes-ingress/templates/controller-deployment.yaml"
at <.Values.controller.image.tag>: wrong type for value; expected
string; got int64
```
@dkorunic dkorunic merged commit 2c1bb4b into haproxytech:main May 23, 2024
1 check passed
dkorunic added a commit that referenced this pull request May 23, 2024
Changes in kubernetes-ingress:
- Replace tpl with default for Ingress Controller image tag (#244)

Signed-off-by: Dinko Korunic <[email protected]>
@mecampbellsoup mecampbellsoup deleted the mc/replace-tpl-with-default branch May 23, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants