Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Charts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
魏国强
Charts
Commits
9f527e21
Commit
9f527e21
authored
Jan 29, 2021
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to render environment variables
parent
2865d86d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
13 deletions
+25
-13
library/common/templates/lib/containers/_environment.tpl
library/common/templates/lib/containers/_environment.tpl
+12
-0
library/common/templates/lib/networking/_dns.tpl
library/common/templates/lib/networking/_dns.tpl
+1
-1
library/common/templates/lib/schema/_utils.tpl
library/common/templates/lib/schema/_utils.tpl
+1
-1
library/common/templates/lib/storage/_ixvolumes.tpl
library/common/templates/lib/storage/_ixvolumes.tpl
+5
-5
library/common/templates/lib/storage/_volume.tpl
library/common/templates/lib/storage/_volume.tpl
+6
-6
No files found.
library/common/templates/lib/containers/_environment.tpl
0 → 100644
View file @
9f527e21
{{
/*
Render
environment
variables
*/
}}
{{- define "common.containers.environmentVariables" -}}
{{- $values := . -}}
{{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "environmentVariables")) -}}
{{- range $envVariable := $values.environmentVariables -}}
{{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "name" "value")) -}}
- name: {{ $envVariable.name }}
value: {{ $envVariable.value }}
{{- end -}}
{{- end -}}
library/common/templates/lib/networking/_dns.tpl
View file @
9f527e21
{{
/*
{{
/*
DNS
Configuration
DNS
Configuration
*/
}}
*/
}}
{{- define "dnsConfiguration" }}
{{- define "
common.networking.
dnsConfiguration" }}
dnsPolicy: {{ .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- if .Values.dnsConfig }}
{{- if .Values.dnsConfig }}
dnsConfig:
dnsConfig:
...
...
library/common/templates/lib/schema/_utils.tpl
View file @
9f527e21
{{
/*
{{
/*
Checks
if
a
list
of
keys
are
present
in
a
dictionary
Checks
if
a
list
of
keys
are
present
in
a
dictionary
*/
}}
*/
}}
{{- define "common.validateKeys" -}}
{{- define "common.
schema.
validateKeys" -}}
{{- $values := . -}}
{{- $values := . -}}
{{- if and (hasKey $values "values") (hasKey $values "checkKeys") -}}
{{- if and (hasKey $values "values") (hasKey $values "checkKeys") -}}
{{- $missingKeys := list -}}
{{- $missingKeys := list -}}
...
...
library/common/templates/lib/storage/_ixvolumes.tpl
View file @
9f527e21
{{
/*
{{
/*
Retrieve
host
path
from
ix
volumes
based
on
dataset
name
Retrieve
host
path
from
ix
volumes
based
on
dataset
name
*/
}}
*/
}}
{{- define "common.retrieveHostPathFromiXVolume" -}}
{{- define "common.
storage.
retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- if eq $.datasetName $dsName -}}
...
@@ -13,13 +13,13 @@ Retrieve host path from ix volumes based on dataset name
...
@@ -13,13 +13,13 @@ Retrieve host path from ix volumes based on dataset name
{
{
/*
{
{
/*
Retrieve
host
path
from
ix
volumes
based
on
a
key
Retrieve
host
path
from
ix
volumes
based
on
a
key
*/
}
}
*/
}
}
{{- define "common.configuredHostPath" -}}
{{- define "common.
storage.
configuredHostPath" -}}
{{- $values := . -}}
{{- $values := . -}}
{{- if $values.hostPathEnabled -}}
{{- if $values.hostPathEnabled -}}
{{- include "common.validateKeys" (dict "values" $values "checkKeys" (list "pathField")) -}}
{{- include "common.
schema.
validateKeys" (dict "values" $values "checkKeys" (list "pathField")) -}}
{{- $values.pathField -}}
{{- $values.pathField -}}
{{- else -}}
{{- else -}}
{{- include "common.validateKeys" (dict "values" $values "checkKeys" (list "datasetName" "ixVolumes")) -}}
{{- include "common.
schema.
validateKeys" (dict "values" $values "checkKeys" (list "datasetName" "ixVolumes")) -}}
{{- include "common.retrieveHostPathFromiXVolume" (dict "datasetName" $values.datasetName "ixVolumes" $values.ixVolumes) -}}
{{- include "common.
storage.
retrieveHostPathFromiXVolume" (dict "datasetName" $values.datasetName "ixVolumes" $values.ixVolumes) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
library/common/templates/lib/storage/_volume.tpl
View file @
9f527e21
...
@@ -11,15 +11,15 @@ This expects a dictionary in the following format:
...
@@ -11,15 +11,15 @@ This expects a dictionary in the following format:
"datasetName"
:
string
,
"datasetName"
:
string
,
}
}
*/
}
}
*/
}
}
{{- define "common.volumeConfig" -}}
{{- define "common.
storage.
volumeConfig" -}}
{{- $values := . -}}
{{- $values := . -}}
{{- include "common.validateKeys" (dict "values" $values "checkKeys" (list "name")) -}}
{{- include "common.
schema.
validateKeys" (dict "values" $values "checkKeys" (list "name")) -}}
- name: {{ $values.name }}
- name: {{ $values.name }}
{{- if $values.emptyDirVolumes -}}
{{- if $values.emptyDirVolumes -}}
emptyDir: {}
emptyDir: {}
{{- else -}}
{{- else -}}
hostPath:
hostPath:
path: {{ template "common.configuredHostPath" $values }}
path: {{ template "common.
storage.
configuredHostPath" $values }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
...
@@ -41,11 +41,11 @@ This expects a dictionary to be provided in the following format:
...
@@ -41,11 +41,11 @@ This expects a dictionary to be provided in the following format:
] ( list of dicts )
] ( list of dicts )
}
}
*/}}
*/}}
{{- define "common.volumesConfiguration" -}}
{{- define "common.
storage.
volumesConfiguration" -}}
{{- $values := . -}}
{{- $values := . -}}
{{- include "common.validateKeys" (dict "values" $values "checkKeys" (list "ixVolumes" "volumes")) -}}
{{- include "common.
schema.
validateKeys" (dict "values" $values "checkKeys" (list "ixVolumes" "volumes")) -}}
{{- range $vol := $values.volumes -}}
{{- range $vol := $values.volumes -}}
{{- $_ := set $vol "ixVolumes" $values.ixVolumes -}}
{{- $_ := set $vol "ixVolumes" $values.ixVolumes -}}
{{- include "common.volumeConfig" $vol -}}
{{- include "common.
storage.
volumeConfig" $vol -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment