test(env): add envFrom support tests and deployment notes
Add helm-unittest tests for envFrom functionality: - No envFrom by default - ConfigMap reference support - Secret reference support - Multiple envFrom sources - Optional ConfigMap/Secret support - Prefix support for variable namespacing - Compatibility with regular env variables Add NOTES.txt with envFrom information: - Show count of envFrom sources - List each source (ConfigMap or Secret) - Display optional and prefix settings Tests ensure envFrom works correctly for loading environment variables from ConfigMaps and Secrets. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
1 parent
d20aac5794
commit
ae2e042e80
2 files changed
+158
No files matched your search
@@ -0,0 +1,36 @@
|
|||||||
|
Thank you for installing {{ .Chart.Name }}.
|
||||||
|
|
||||||
|
Your release is named {{ .Release.Name }}.
|
||||||
|
|
||||||
|
To learn more about the release, try:
|
||||||
|
|
||||||
|
$ helm status {{ .Release.Name }}
|
||||||
|
$ helm get all {{ .Release.Name }}
|
||||||
|
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
|
||||||
|
Jellyfin is available via Ingress at:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}{{ (index .paths 0).path }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
To access Jellyfin, you can use port-forwarding:
|
||||||
|
|
||||||
|
$ kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "jellyfin.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }}
|
||||||
|
|
||||||
|
Then visit http://localhost:{{ .Values.service.port }} in your browser.
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.jellyfin.envFrom }}
|
||||||
|
|
||||||
|
Environment Configuration:
|
||||||
|
Loading environment variables from {{ len .Values.jellyfin.envFrom }} source(s):
|
||||||
|
{{- range .Values.jellyfin.envFrom }}
|
||||||
|
{{- if .configMapRef }}
|
||||||
|
- ConfigMap: {{ .configMapRef.name }}{{ if .configMapRef.optional }} (optional){{ end }}{{ if .prefix }} with prefix: {{ .prefix }}{{ end }}
|
||||||
|
{{- else if .secretRef }}
|
||||||
|
- Secret: {{ .secretRef.name }}{{ if .secretRef.optional }} (optional){{ end }}{{ if .prefix }} with prefix: {{ .prefix }}{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
suite: test envFrom
|
||||||
|
templates:
|
||||||
|
- deployment.yaml
|
||||||
|
tests:
|
||||||
|
- it: should not have envFrom by default
|
||||||
|
asserts:
|
||||||
|
- isNull:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
|
||||||
|
- it: should add envFrom from ConfigMap
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: jellyfin-config
|
||||||
|
asserts:
|
||||||
|
- isNotNull:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
- lengthEqual:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
count: 1
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].configMapRef.name
|
||||||
|
value: jellyfin-config
|
||||||
|
|
||||||
|
- it: should add envFrom from Secret
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: jellyfin-secrets
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].secretRef.name
|
||||||
|
value: jellyfin-secrets
|
||||||
|
|
||||||
|
- it: should support multiple envFrom sources
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: jellyfin-config
|
||||||
|
- secretRef:
|
||||||
|
name: jellyfin-secrets
|
||||||
|
- configMapRef:
|
||||||
|
name: jellyfin-extra-config
|
||||||
|
asserts:
|
||||||
|
- lengthEqual:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
count: 3
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].configMapRef.name
|
||||||
|
value: jellyfin-config
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[1].secretRef.name
|
||||||
|
value: jellyfin-secrets
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[2].configMapRef.name
|
||||||
|
value: jellyfin-extra-config
|
||||||
|
|
||||||
|
- it: should support optional ConfigMap
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: optional-config
|
||||||
|
optional: true
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].configMapRef.optional
|
||||||
|
value: true
|
||||||
|
|
||||||
|
- it: should support optional Secret
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: optional-secret
|
||||||
|
optional: true
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].secretRef.optional
|
||||||
|
value: true
|
||||||
|
|
||||||
|
- it: should support prefix for ConfigMap
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: my-config
|
||||||
|
prefix: CONFIG_
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].prefix
|
||||||
|
value: CONFIG_
|
||||||
|
|
||||||
|
- it: should support prefix for Secret
|
||||||
|
set:
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: my-secret
|
||||||
|
prefix: SECRET_
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].prefix
|
||||||
|
value: SECRET_
|
||||||
|
|
||||||
|
- it: should work alongside regular env variables
|
||||||
|
set:
|
||||||
|
jellyfin.env:
|
||||||
|
- name: CUSTOM_VAR
|
||||||
|
value: custom-value
|
||||||
|
jellyfin.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: jellyfin-config
|
||||||
|
asserts:
|
||||||
|
- isNotNull:
|
||||||
|
path: spec.template.spec.containers[0].env
|
||||||
|
- isNotNull:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.containers[0].env
|
||||||
|
content:
|
||||||
|
name: CUSTOM_VAR
|
||||||
|
value: custom-value
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom[0].configMapRef.name
|
||||||
|
value: jellyfin-config
|
||||||
Reference in new issue
Block a user