Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
chore: clean up resource generation and template files
Browse files Browse the repository at this point in the history
  • Loading branch information
morremeyer committed May 27, 2021
1 parent 5e11f7a commit 233c06c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 67 deletions.
2 changes: 1 addition & 1 deletion charts/generic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: generic
description: A chart for generic applications. Use this if you need to deploy something without wanting to build a fully fledged new helm chart.
type: application
version: 2.0.0
version: 2.0.1
61 changes: 29 additions & 32 deletions charts/generic/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,33 @@ spec:
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 12 }}
annotations: {{- toYaml . | nindent 12 }}
{{- end }}
labels:
{{- include "generic.selectorLabels" . | nindent 12 }}
labels: {{- include "generic.selectorLabels" . | nindent 12 }}
spec:
restartPolicy: {{ .Values.restartPolicy }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
imagePullSecrets: {{- toYaml . | nindent 12 }}
{{- end }}
serviceAccountName: {{ include "generic.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
{{- with .Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{ toYaml . | nindent 12 }}
initContainers: {{ toYaml . | nindent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 16 }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 16 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.command }}
command:
{{ toYaml . | nindent 16 }}
command: {{ toYaml . | nindent 16 }}
{{- end }}
{{- with .Values.args }}
args:
{{ toYaml . | nindent 16 }}
args: {{ toYaml . | nindent 16 }}
{{- end }}
{{- if or .Values.env .Values.envValueFrom }}
env:
Expand All @@ -59,42 +55,42 @@ spec:
{{- end }}
{{- range $key, $value := .Values.envValueFrom }}
- name: {{ $key }}
valueFrom:
{{- $value | toYaml | nindent 20 }}
valueFrom: {{- $value | toYaml | nindent 20 }}
{{- end }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.additionalVolumeMounts }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- with .Values.additionalVolumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.ports }}
ports:
{{- toYaml .Values.ports | nindent 16 }}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 16 }}
{{- end }}
{{- with .Values.livenessProbe }}
livenessProbe: {{- toYaml . | nindent 16 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 16 }}
readinessProbe: {{- toYaml . | nindent 16 }}
{{- end }}
{{- with .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 16 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 16 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
nodeSelector: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
affinity: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
tolerations: {{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.additionalVolumes }}
volumes:
{{- if .Values.persistence.enabled }}
- name: data
Expand All @@ -104,4 +100,5 @@ spec:
{{- with .Values.additionalVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end -}}
63 changes: 29 additions & 34 deletions charts/generic/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,37 @@ spec:
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "generic.selectorLabels" . | nindent 6 }}
matchLabels: {{- include "generic.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
annotations: {{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "generic.selectorLabels" . | nindent 8 }}
labels: {{- include "generic.selectorLabels" . | nindent 8 }}
spec:
restartPolicy: {{ .Values.restartPolicy }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "generic.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{ toYaml . | nindent 8 }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.command }}
command:
{{ toYaml . | nindent 12 }}
command: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.args }}
args:
{{ toYaml . | nindent 12 }}
args: {{ toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.env .Values.envValueFrom }}
env:
Expand All @@ -62,10 +57,10 @@ spec:
{{- end }}
{{- range $key, $value := .Values.envValueFrom }}
- name: {{ $key }}
valueFrom:
{{- $value | toYaml | nindent 16 }}
valueFrom: {{- $value | toYaml | nindent 16 }}
{{- end }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.additionalVolumeMounts }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
Expand All @@ -74,30 +69,29 @@ spec:
{{- with .Values.additionalVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
{{- toYaml .Values.ports | nindent 12 }}
{{- end }}
{{- with .Values.ports }}
ports: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
livenessProbe: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
readinessProbe: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.additionalVolumes }}
volumes:
{{- if .Values.persistence.enabled }}
- name: data
Expand All @@ -107,4 +101,5 @@ spec:
{{- with .Values.additionalVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end -}}

0 comments on commit 233c06c

Please sign in to comment.