templatized env & args redundancy

This commit is contained in:
beyondszine 2019-08-18 15:43:30 +05:30
parent e49de34786
commit 182ab89d1e
2 changed files with 32 additions and 37 deletions

View file

@ -19,42 +19,21 @@ spec:
app.kubernetes.io/name: {{ include "transfersh.name" . }} app.kubernetes.io/name: {{ include "transfersh.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
{{- $keyRefSource := .Values.argValues.source.type -}}
{{- $keyRefName := .Values.argValues.source.name -}}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- range .Values.argValues.paramNames }}
env: env:
- name: HTTP_AUTH_USER - name: {{ . | upper }}
valueFrom: valueFrom:
secretKeyRef: {{ $keyRefSource }}:
name: transfersh-secrets name: {{ $keyRefName }}
key: HTTP_AUTH_USER key: {{ . | upper }}
- name: HTTP_AUTH_PASS {{- end }}
valueFrom: args: [ {{- range .Values.argValues.paramNames }} {{ printf "%s%s" $.Values.argIdentifier . | quote}},{{ printf "%s%s%s" "$(" . ")" | upper | quote}},{{- end }} ]
secretKeyRef:
name: transfersh-secrets
key: HTTP_AUTH_PASS
- name: AWS_ACCESS_KEY
valueFrom:
secretKeyRef:
name: transfersh-secrets
key: AWS_ACCESS_KEY
- name: AWS_SECRET_KEY
valueFrom:
secretKeyRef:
name: transfersh-secrets
key: AWS_SECRET_KEY
- name: AWS_BUCKET_NAME
valueFrom:
secretKeyRef:
name: transfersh-secrets
key: AWS_BUCKET_NAME
- name: AWS_BUCKET_REGION
valueFrom:
secretKeyRef:
name: transfersh-secrets
key: AWS_BUCKET_REGION
args: ["--http-auth-user","$(HTTP_AUTH_USER)","--http-auth-pass","$(HTTP_AUTH_PASS)","--provider","s3","--aws-access-key","$(AWS_ACCESS_KEY)","--aws-secret-key","$(AWS_SECRET_KEY)","--bucket","$(AWS_BUCKET_NAME)","--s3-region","$(AWS_BUCKET_REGION)","--proxy-path",""]
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /

View file

@ -1,9 +1,5 @@
# Default values for transfersh. ---
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
image: image:
repository: dutchcoders/transfer.sh repository: dutchcoders/transfer.sh
tag: latest tag: latest
@ -18,11 +14,31 @@ service:
externalPort: 80 externalPort: 80
internalPort: 8080 internalPort: 8080
errorValues:
varValue : UltraBadValue
argIdentifier: "--"
argValues : {
"source" :{
"type" : "secretKeyRef",
"name" : "transfersh-secrets"
},
"paramNames" :[
"http-auth-user",
"http-auth-pass",
"provider",
"aws-access-key",
"aws-secret-key",
"bucket",
"s3-region",
"proxy-path"
]
}
ingress: ingress:
enabled: false enabled: false
annotations: {} annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: / path: /
hosts: hosts:
- transfersh.local - transfersh.local