Skip to content

Commit

Permalink
remove dig function usages
Browse files Browse the repository at this point in the history
  • Loading branch information
aboguszewski-sumo committed Feb 20, 2023
1 parent 63490d1 commit 68cf12b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
76 changes: 38 additions & 38 deletions deploy/helm/sumologic/templates/pvc-cleaner/cron-job.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq (dig "pvcCleaner" "logs" "enabled" false (.Values | merge (dict))) true }}
{{- if eq .Values.pvcCleaner.logs.enabled true }}
apiVersion: batch/v1
kind: CronJob
metadata:
Expand All @@ -8,7 +8,7 @@ metadata:
app: {{ template "sumologic.labels.app.pvcCleaner.logs" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
schedule: {{ (dig "pvcCleaner" "job" "schedule" false (.Values | merge (dict))) | quote }}
schedule: {{ .Values.pvcCleaner.job.schedule | quote }}
jobTemplate:
spec:
template:
Expand All @@ -17,50 +17,50 @@ spec:
labels:
app: {{ template "sumologic.labels.app.pvcCleaner.logs" . }}
{{- include "sumologic.labels.common" . | nindent 12 }}
{{- if .Values.sumologic.podLabels }}
{{ toYaml .Values.sumologic.podLabels | indent 12 }}
{{- with .Values.sumologic.podLabels }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "podLabels" false (.Values | merge (dict))) }}
{{ toYaml (dig "pvcCleaner" "job" "podLabels" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.podLabels }}
{{ toYaml . | indent 12 }}
{{- end }}
annotations:
{{- if .Values.sumologic.podAnnotations }}
{{ toYaml .Values.sumologic.podAnnotations | indent 12 }}
{{- with .Values.sumologic.podAnnotations }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "podAnnotations" false (.Values | merge (dict))) }}
{{ toYaml (dig "pvcCleaner" "job" "podAnnotations" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.podAnnotations }}
{{ toYaml . | indent 12 }}
{{- end }}
spec:
nodeSelector:
{{- if (dig "pvcCleaner" "job" "nodeSelector" false (.Values | merge (dict))) }}
{{ toYaml (dig "pvcCleaner" "job" "nodeSelector" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.nodeSelector }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "tolerations" false (.Values | merge (dict))) }}
{{- with .Values.pvcCleaner.job.tolerations }}
tolerations:
{{ toYaml (dig "pvcCleaner" "job" "tolerations" false (.Values | merge (dict))) | indent 12 }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "affinity" false (.Values | merge (dict))) }}
{{- with .Values.pvcCleaner.job.affinity }}
affinity:
{{ toYaml (dig "pvcCleaner" "job" "affinity" false (.Values | merge (dict))) | indent 12 }}
{{ toYaml . | indent 12 }}
{{- end }}
containers:
- name: pvc-cleaner
image: {{ (dig "pvcCleaner" "job" "image" "repository" false (.Values | merge (dict))) }}:{{ (dig "pvcCleaner" "job" "image" "tag" false (.Values | merge (dict))) }}
image: {{ .Values.pvcCleaner.job.image.repository }}:{{ .Values.pvcCleaner.job.image.tag }}
command:
- "pvc-cleaner"
- "{{ .Release.Namespace }}"
- "app={{ template "sumologic.labels.app.logs.statefulset" . }}"
- "{{ template "sumologic.metadata.name.logs.hpa" . }}"
imagePullPolicy: {{ (dig "pvcCleaner" "job" "image" "pullPolicy" false (.Values | merge (dict))) }}
imagePullPolicy: {{ .Values.pvcCleaner.job.image.pullPolicy }}
resources:
{{- toYaml (dig "pvcCleaner" "job" "resources" false (.Values | merge (dict))) | nindent 14 }}
{{- toYaml .Values.pvcCleaner.job.resources | nindent 14 }}
restartPolicy: Never
serviceAccountName: {{ template "sumologic.metadata.name.pvcCleaner.roles.serviceaccount" . }}
{{- end }}

---

{{- if eq (dig "pvcCleaner" "metrics" "enabled" false (.Values | merge (dict))) true }}
{{- if eq .Values.pvcCleaner.metrics.enabled true }}
apiVersion: batch/v1
kind: CronJob
metadata:
Expand All @@ -70,7 +70,7 @@ metadata:
app: {{ template "sumologic.labels.app.pvcCleaner.metrics" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
schedule: {{ (dig "pvcCleaner" "job" "schedule" false (.Values | merge (dict))) | quote }}
schedule: {{ .Values.pvcCleaner.job.schedule | quote }}
jobTemplate:
spec:
template:
Expand All @@ -79,43 +79,43 @@ spec:
labels:
app: {{ template "sumologic.labels.app.pvcCleaner.metrics" . }}
{{- include "sumologic.labels.common" . | nindent 12 }}
{{- if .Values.sumologic.podLabels }}
{{ toYaml .Values.sumologic.podLabels | indent 12 }}
{{- with .Values.sumologic.podLabels }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "podLabels" false (.Values | merge (dict))) }}
{{ toYaml (dig "pvcCleaner" "job" "podLabels" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.podLabels }}
{{ toYaml . | indent 12 }}
{{- end }}
annotations:
{{- if .Values.sumologic.podAnnotations }}
{{ toYaml .Values.sumologic.podAnnotations | indent 12 }}
{{- with .Values.sumologic.podAnnotations }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "podAnnotations" false (.Values | merge (dict))) }}
{{ toYaml (dig "pvcCleaner" "job" "podAnnotations" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.podAnnotations }}
{{ toYaml . | indent 12 }}
{{- end }}
spec:
{{- if (dig "pvcCleaner" "job" "nodeSelector" false (.Values | merge (dict))) }}
nodeSelector:
{{ toYaml (dig "pvcCleaner" "job" "nodeSelector" false (.Values | merge (dict))) | indent 12 }}
{{- with .Values.pvcCleaner.job.nodeSelector }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "tolerations" false (.Values | merge (dict))) }}
{{- with .Values.pvcCleaner.job.tolerations }}
tolerations:
{{ toYaml (dig "pvcCleaner" "job" "tolerations" false (.Values | merge (dict))) | indent 12 }}
{{ toYaml . | indent 12 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "affinity" false (.Values | merge (dict))) }}
{{- with .Values.pvcCleaner.job.affinity }}
affinity:
{{ toYaml (dig "pvcCleaner" "job" "affinity" false (.Values | merge (dict))) | indent 12 }}
{{ toYaml . | indent 12 }}
{{- end }}
containers:
- name: pvc-cleaner
image: {{ (dig "pvcCleaner" "job" "image" "repository" false (.Values | merge (dict))) }}:{{ (dig "pvcCleaner" "job" "image" "tag" false (.Values | merge (dict))) }}
image: {{ .Values.pvcCleaner.job.image.repository }}:{{ .Values.pvcCleaner.job.image.tag }}
command:
- "pvc-cleaner"
- "{{ .Release.Namespace }}"
- "app={{ template "sumologic.labels.app.metrics.statefulset" . }}"
- "{{ template "sumologic.metadata.name.metrics.hpa" . }}"
imagePullPolicy: {{ (dig "pvcCleaner" "job" "image" "pullPolicy" false (.Values | merge (dict))) }}
imagePullPolicy: {{ .Values.pvcCleaner.job.image.pullPolicy }}
resources:
{{- toYaml (dig "pvcCleaner" "job" "resources" false (.Values | merge (dict))) | nindent 14 }}
{{- toYaml .Values.pvcCleaner.job.resources | nindent 14 }}
restartPolicy: Never
serviceAccountName: {{ template "sumologic.metadata.name.pvcCleaner.roles.serviceaccount" . }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ metadata:
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if (dig "pvcCleaner" "job" "pullSecrets" false (.Values | merge (dict))) }}
{{- with (dig "pvcCleaner" "job" "pullSecrets" false (.Values | merge (dict))) }}
imagePullSecrets:
{{ toYaml (dig "pvcCleaner" "job" "pullSecrets" false (.Values | merge (dict))) | indent 2 }}
{{ toYaml . | indent 2 }}
{{- end }}

---
Expand Down

0 comments on commit 68cf12b

Please sign in to comment.