Skip to content

Commit

Permalink
feat(ui): extra envs
Browse files Browse the repository at this point in the history
Resolves #40
  • Loading branch information
caiofralmeida authored and eshepelyuk committed Jan 21, 2022
1 parent c19a21f commit b523709
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 5 deletions.
9 changes: 6 additions & 3 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ spec:
{{- range .Values.ui.extraArgs }}
- {{ . | quote }}
{{- end }}
{{ if .Values.ui.consumerProperties }}
env:
- name: CONSUMER_PROPERTIES_FILE
value: /conf/consumer.properties
{{- if .Values.ui.consumerProperties }}
- name: CONSUMER_PROPERTIES_FILE
value: /conf/consumer.properties
{{- end }}
{{- with .Values.ui.extraEnv -}}
{{ toYaml . | nindent 10 }}
{{- end }}
readinessProbe:
httpGet:
Expand Down
16 changes: 16 additions & 0 deletions test/linter/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@ if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ui.extraEnv=false'
if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ui.extraEnv={1,2,3}'
if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ui.extraEnv[0].name=qwe' --set 'ui.extraEnv[0].value=asd'
if [ $? -ne 0 ]; then
exit -1
fi


22 changes: 22 additions & 0 deletions test/unit/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
suite: deployment
templates:
- deployment.yaml
tests:
- it: should emit empty env by default
asserts:
- isEmpty:
path: spec.template.spec.containers[1].env
- it: should populate env when passed
set:
ui:
extraEnv:
- name: myvar
value: myvalue
asserts:
- contains:
path: spec.template.spec.containers[1].env
content:
name: myvar
value: myvalue
count: 1
any: false
5 changes: 3 additions & 2 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@
"type": "object", "title": "ui container k8s settings", "additionalProperties": false,
"properties": {
"port": {"type": "integer", "default": 9000},
"extraArgs": { "type": "array", "title": "extra cmd line arguments", "items": { "type": "string" }, "default": [] },
"extraArgs": { "type": "array", "title": "extra cmd line arguments", "items": {"type": "string"}, "default": [] },
"resources": { "$ref": "#/definitions/resources" },
"consumerProperties": { "type": "object", "title": "provide key value base pairs for consumer properties according to java docs", "default": {} },
"consumerPropertiesSsl": { "$ref": "#/definitions/consumerSsl" }
"consumerPropertiesSsl": { "$ref": "#/definitions/consumerSsl" },
"extraEnv": { "type": "array", "title": "optional environment variables", "items": {"type": "object"}, "default": [] }
}
},
"zk": {
Expand Down
15 changes: 15 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ ui:
# password: test123
# value: <some base64 encoded keystore>

# Additional environment variables (declared as k8s style)
# ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
extraEnv: []
# - name: GREETING
# value: "Warm greetings to"
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username
# - name: SPECIAL_LEVEL_KEY
# valueFrom:
# configMapKeyRef:
# name: special-config
# key: SPECIAL_LEVEL

# various settings for Zookeeper container
zk:
Expand Down

0 comments on commit b523709

Please sign in to comment.