-
Notifications
You must be signed in to change notification settings - Fork 9
Repo type #58
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
base: main
Are you sure you want to change the base?
Repo type #58
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,12 +35,31 @@ Create chart name and version as used by the chart label. | |
| {{/* | ||
| Sets up the Varnish Enterprise image and its overrides (if any) | ||
| */}} | ||
| {{- define "varnish-enterprise.image" }} | ||
| {{- $base := .base | default dict }} | ||
| {{- $image := .image | default dict }} | ||
| image: "{{- if eq $image.repository "-" -}}{{ $base.repository }}{{ else }}{{ $image.repository }}{{ end }}:{{- if eq $image.tag "-" }}{{ default .Chart.AppVersion $base.tag }}{{ else }}{{ default $.Chart.AppVersion $image.tag }}{{ end }}" | ||
| {{- define "varnish-enterprise.image" -}} | ||
| {{- $base := .base | default dict -}} | ||
| {{- $image := .image | default dict -}} | ||
|
|
||
| {{- $repoType := .Values.global.repoType | default "" -}} | ||
| {{- $calculatedRepo := $base.repository -}} | ||
|
|
||
| {{- if eq $repoType "public-enterprise" }} | ||
| {{- $calculatedRepo = "varnish/varnish-enterprise" }} | ||
| {{- else if eq $repoType "private-enterprise" }} | ||
| {{- $calculatedRepo = "quay.io/varnish-software/varnish-plus" }} | ||
| {{ end }} | ||
|
Comment on lines
+38
to
+47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work, you're introducing a newline between the image and the tag. The reason it was all written on one line was probably to avoid introducing newlines. |
||
| image: "{{- if eq $image.repository "-" -}} | ||
| {{ $calculatedRepo }} | ||
| {{- else -}} | ||
| {{ $image.repository }} y | ||
| {{- end -}} | ||
| : | ||
| {{- if eq $image.tag "-" }} | ||
| {{ default .Chart.AppVersion $base.tag }} | ||
| {{- else -}} | ||
| {{ default $.Chart.AppVersion $image.tag }} | ||
| {{- end -}}" | ||
| imagePullPolicy: {{ if eq $image.pullPolicy "-" }}{{ $base.pullPolicy }}{{ else }}{{ $image.pullPolicy }}{{ end }} | ||
| {{- end }} | ||
| {{- end -}} | ||
|
|
||
| {{/* | ||
| Converts size string (e.g. 10Mi or 10M) to a number | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,4 +151,4 @@ rollingUpdate: | |
| tee -a /dev/stderr) | ||
|
|
||
| [[ "${actual}" == *"'server.extraVolumeClaimTemplates' cannot be enabled"* ]] | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep trailing newlines. |
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move these tests to the unit_common test file and change back to the original test format and let's agree on a test style before we change to something like this. Since the above code broke the varnishncsa image, and not the varnish image please test for that too. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| load _helpers | ||
|
|
||
| @test "repoType: default (no global.repoType set)" { | ||
| helm_template_compare \ | ||
| "global: {}" \ | ||
| "templates/deployment.yaml" \ | ||
| '.spec.template.spec.containers[0].image' \ | ||
| "\"quay.io/varnish-software/varnish-plus:$(app_version)\"" | ||
| } | ||
|
|
||
| @test "repoType: public-enterprise" { | ||
| helm_template_compare \ | ||
| "global: {repoType: public-enterprise}" \ | ||
| "templates/deployment.yaml" \ | ||
| '.spec.template.spec.containers[0].image' \ | ||
| "\"varnish/varnish-enterprise:$(app_version)\"" | ||
| } | ||
|
|
||
| @test "repoType: private-enterprise" { | ||
| helm_template_compare \ | ||
| "global: {repoType: private-enterprise}" \ | ||
| "templates/deployment.yaml" \ | ||
| '.spec.template.spec.containers[0].image' \ | ||
| "\"quay.io/varnish-software/varnish-plus:$(app_version)\"" | ||
| } |
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.
Please keep trailing newlines.