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

fixup(httpd & mirrorbits-lite) remove all mocks from packaged chart #825

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/httpd/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
.idea/
*.tmproj
.vscode/
tests/
6 changes: 5 additions & 1 deletion charts/httpd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
apiVersion: v1
description: httpd helm chart for Kubernetes
name: httpd
version: 0.2.0
version: 0.2.1
appVersion: v2.4
maintainers:
- email: [email protected]
name: jenkins-infra-team
12 changes: 6 additions & 6 deletions charts/httpd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ Data directory volume definition. Might be defined from parent chart templates o
based on the presence of the global value provided by the parent chart.
*/}}
{{- define "httpd.html-volume" -}}
{{- if (dig "global" "storage" "enabled" false .Values.AsMap) -}}
{{- if and (dig "global" "storage" "enabled" false .Values.AsMap) .Values.global.storage.claimNameTpl -}}
persistentVolumeClaim:
claimName: {{ include "mirrorbits-parent.pvc-name" . }}
{{- else }}
{{- if or .Values.repository.persistentVolumeClaim.enabled .Values.repository.reuseExistingPersistentVolumeClaim }}
claimName: {{ printf "%s" (tpl .Values.global.storage.claimNameTpl $) | trim | trunc 63 }}
{{- else -}}
{{- if or .Values.repository.persistentVolumeClaim.enabled .Values.repository.reuseExistingPersistentVolumeClaim -}}
persistentVolumeClaim:
claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "httpd.fullname" .)) }}
{{- else }}
claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "httpd.fullname" .)) -}}
{{- else -}}
emptyDir: {}
{{- end -}}
{{- end -}}
Expand Down
3 changes: 0 additions & 3 deletions charts/httpd/templates/mocks/_helpers.tpl

This file was deleted.

1 change: 1 addition & 0 deletions charts/httpd/tests/parent_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set:
global:
storage:
enabled: true
claimNameTpl: '{{ default "parent-chart-shared-data" }}'
Copy link
Member

Choose a reason for hiding this comment

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

I didn't realize we could use templating in tests too, good to know!

Copy link
Member

Choose a reason for hiding this comment

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

Not sure why you're not specifying "parent-chart-shared-data" directly though, what could be the other value than the default one here?

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 didn't realize we could use templating in tests too, good to know!

Neither did I until I realized that we can use the tpl function to pass custom data through values. Credits due to your idea which led me to helm-unittest/helm-unittest#171 where I learnt the trick.

⚠️ Remember that using values is dangerous for this (hence the sanitization of the rendered template to avoid user input garbage)

Not sure why you're not specifying "parent-chart-shared-data" directly though, what could be the other value than the default one here?

Oh I did it initially (and it works) but I wanted to show explicitly the fact that we can insert a template.

ingress:
enabled: true
# Try to specify a ingress which must be ignored (parent prevails)
Expand Down
2 changes: 1 addition & 1 deletion charts/mirrorbits-lite/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
.idea/
*.tmproj
.vscode/
tests/*
tests/
2 changes: 1 addition & 1 deletion charts/mirrorbits-lite/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Mirrobits lite helm chart for Kubernetes
name: mirrorbits-lite
version: 0.3.0
version: 0.3.1
appVersion: "v0.5.1"
maintainers:
- email: [email protected]
Expand Down
10 changes: 5 additions & 5 deletions charts/mirrorbits-lite/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ Data directory volume definition. Might be defined from parent chart templates o
based on the presence of the global value provided by the parent chart.
*/}}
{{- define "mirrorbits-lite.data-volume" -}}
{{- if (dig "global" "storage" "enabled" false .Values.AsMap) -}}
{{- if and (dig "global" "storage" "enabled" false .Values.AsMap) .Values.global.storage.claimNameTpl -}}
persistentVolumeClaim:
claimName: {{ include "mirrorbits-parent.pvc-name" . }}
{{- else }}
{{- if .Values.repository.persistentVolumeClaim.enabled }}
claimName: {{ printf "%s" (tpl .Values.global.storage.claimNameTpl $) | trim | trunc 63 }}
{{- else -}}
{{- if .Values.repository.persistentVolumeClaim.enabled -}}
persistentVolumeClaim:
claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "mirrorbits-lite.fullname" .)) }}
{{- else }}
{{- else -}}
emptyDir: {}
{{- end -}}
{{- end -}}
Expand Down
3 changes: 0 additions & 3 deletions charts/mirrorbits-lite/templates/mocks/_helpers.tpl

This file was deleted.

1 change: 1 addition & 0 deletions charts/mirrorbits-lite/tests/parent_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set:
global:
storage:
enabled: true
claimNameTpl: '{{ default "parent-chart-shared-data" }}'
ingress:
enabled: true
# Try to specify a ingress which must be ignored (parent prevails)
Expand Down