Commit 502e7001 authored by Waqar Ahmed's avatar Waqar Ahmed

Add method to render all volumes/env variables

parent 88bda7e5
......@@ -28,3 +28,14 @@ Render environment variables
{{- include "common.containers.environmentVariable" $envVariable | nindent 0 -}}
{{- end -}}
{{- end -}}
{{/*
Render environment variables if present
*/}}
{{- define "common.containers.allEnvironmentVariables" -}}
{{- $values := . -}}
{{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "environmentVariables")) -}}
{{- if $values.environmentVariables -}}
env: {{- include "common.containers.environmentVariables" $values | nindent 2 -}}
{{- end -}}
{{- end -}}
......@@ -2,8 +2,10 @@
Define appVolumeMounts for container
*/}}
{{- define "common.storage.configureAppVolumeMountsInContainer" -}}
{{- if and .Values.appVolumesEnabled .Values.appVolumeMounts }}
{{- range $name, $avm := .Values.appVolumeMounts -}}
{{- include "common.schema.validateKeys" (dict "values" . "checkKeys" (list "appVolumeMounts")) -}}
{{- $appVolumeMounts := .appVolumeMounts -}}
{{- if $appVolumeMounts }}
{{- range $name, $avm := $appVolumeMounts -}}
{{- if (default true $avm.enabled) }}
{{- if $avm.containerNameOverride -}}
{{- $name = $avm.containerNameOverride -}}
......@@ -23,19 +25,22 @@ Define appVolumeMounts for container
Define hostPath for appVolumes
*/}}
{{- define "common.storage.configureAppVolumes" -}}
{{- if .Values.appVolumeMounts }}
{{- range $name, $av := .Values.appVolumeMounts -}}
{{- include "common.schema.validateKeys" (dict "values" . "checkKeys" (list "appVolumeMounts")) -}}
{{- $appVolumeMounts := .appVolumeMounts -}}
{{- if $appVolumeMounts }}
{{- range $name, $av := $appVolumeMounts -}}
{{- if (default true $av.enabled) }}
- name: {{ $name }}
{{- if or $av.emptyDir $.Values.emptyDirVolumes }}
{{- if or $av.emptyDir $.emptyDirVolumes }}
emptyDir: {}
{{- else }}
hostPath:
{{ if $av.hostPathEnabled }}
path: {{ required "hostPath not set" $av.hostPath }}
{{- else }}
{{- include "common.schema.validateKeys" (dict "values" . "checkKeys" (list "ixVolumes")) -}}
{{- include "common.schema.validateKeys" (dict "values" $av "checkKeys" (list "datasetName")) -}}
{{- $volDict := dict "datasetName" $av.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- $volDict := dict "datasetName" $av.datasetName "ixVolumes" $.ixVolumes -}}
path: {{ include "common.storage.retrieveHostPathFromiXVolume" $volDict }}
{{- end }}
{{- end }}
......@@ -43,3 +48,25 @@ Define hostPath for appVolumes
{{- end }}
{{- end }}
{{- end -}}
{{/*
Get all volumes configuration
*/}}
{{- define "common.storage.allAppVolumes" -}}
{{- $appVolumeMounts := .appVolumeMounts -}}
{{- if $appVolumeMounts -}}
volumes: {{- include "common.storage.configureAppVolumes" . | nindent 2 -}}
{{- end -}}
{{- end -}}
{{/*
Get all container volume moutns configuration
*/}}
{{- define "common.storage.allContainerVolumeMounts" -}}
{{- $appVolumeMounts := .appVolumeMounts -}}
{{- if $appVolumeMounts -}}
volumeMounts: {{- include "common.storage.configureAppVolumeMountsInContainer" . | nindent 2 -}}
{{- end -}}
{{- end -}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment