feat!(helm): refactor helm chart

- Group app settings below `config` key
- Group deployment settings below `deployment` key
- Fix hardcoded replicaCount

Signed-off-by: nathanael.liechti@post.ch
This commit is contained in:
liechtinat
2022-09-08 15:54:23 +02:00
parent 670e503c97
commit 3dbe34541e
3 changed files with 62 additions and 60 deletions
@@ -8,7 +8,7 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
replicas: {{ .Values.deployment.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: kubeinvaders
@@ -20,48 +20,58 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: kubeinvaders
{{- if .Values.securityContext }}
securityContext: {{- toYaml .Values.securityContext | nindent 8 }}
{{- with .Values.deployment.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- env:
{{- if .Values.ingress.enabled }}
- name: ENDPOINT
value: {{ required ".Values.ingress.hostName is required if Ingress are enabled" .Values.ingress.hostName }}
value: {{ required ".Values.ingress.hostName is required if Ingress is enabled" .Values.ingress.hostName }}
{{- else }}
- name: ENDPOINT
value: {{ required ".Values.route_host is required if Ingress are disabled" .Values.route_host }}
value: {{ required ".Values.route_host is required if Ingress is disabled" .Values.route_host }}
{{- end }}
- name: NAMESPACE
value: {{ .Values.target_namespace }}
{{- if .Values.extraEnv }}
{{ toYaml .Values.extraEnv | indent 10 }}
value: {{ .Values.config.target_namespace }}
- name: ALIENPROXIMITY
value: {{ .Values.config.alienProximity }}
- name: HITSLIMIT
value: {{ .Values.config.hitsLimit }}
- name: UPDATETIME
value: {{ .Values.config.updateTime }}
{{- if .Values.deployment.extraEnv }}
{{ toYaml .Values.deployment.extraEnv | indent 10 }}
{{- end }}
name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
{{- with .Values.resources }}
{{- with .Values.deployment.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- with .Values.deployment.extraVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- with .Values.deployment.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with.Values.extraVolumes }}
{{- with.Values.deployment.extraVolumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.deployment.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- end }}
{{- with .Values.deployment.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
@@ -16,4 +16,4 @@ spec:
matchLabels:
app.kubernetes.io/name: kubeinvaders
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
+32 -40
View File
@@ -1,9 +1,17 @@
# Default namespace target
target_namespace: "default"
# Default values for kubeinvaders.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
nameOverride: ""
fullnameOverride: ""
config:
# target_namespace where kubeinvaders should be allowed to kill pods
target_namespace: "default"
alienProximity: 10
hitsLimit: 1
updateTime: 0.5
rbac:
# Specifies whether RBAC resources should be created
create: true
@@ -21,22 +29,33 @@ clusterRole:
# true, a name based on fullname is generated
name: kubeinvaders
replicaCount: 1
image:
repository: luckysideburn/kubeinvaders
tag: v1.9
pullPolicy: Always
nameOverride: ""
fullnameOverride: ""
deployment:
replicaCount: 1
image:
repository: luckysideburn/kubeinvaders
tag: v1.9
pullPolicy: Always
extraEnv: []
# - name: FOO
# value: "BAR"
extraVolumes: []
# - name: tmp
# emptyDir: {}
extraVolumeMounts: []
# - name: tmp
# mountPath: /usr/local/openresty
resources: {}
nodeSelector: {}
tolerations: []
securityContext: {}
service:
type: ClusterIP
port: 8080
ingress:
enabled: true
enabled: false
legacyIngress: false
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
hostName: ""
@@ -45,32 +64,5 @@ ingress:
# Use route_host only if ingress is disabled
route_host: ""
legacyIngress: false
extraEnv: []
# extraEnv:
# - name: ALIENPROXIMITY
# value: "10"
# - name: HITSLIMIT
# value: "1"
# - name: UPDATETIME
# value: "0.5"
extraVolumes: []
# - name: tmp
# emptyDir: {}
extraVolumeMounts: []
# - name: tmp
# mountPath: /usr/local/openresty
resources: {}
nodeSelector: {}
tolerations: []
securityContext: {}
# runAsUser: 999
# runAsGroup: 999
# fsGroup: 999
serviceMonitor:
enabled: false