This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
{{- define "tc.v1.common.values.deviceList" -}}
|
||||
{{- $rootCtx := . -}}
|
||||
|
||||
{{- range $idx, $deviceValues := $rootCtx.Values.deviceList -}}
|
||||
{{- if eq $deviceValues.type "device" -}}
|
||||
{{- $name := (printf "device-%s" (toString $idx)) -}}
|
||||
|
||||
{{- with $deviceValues.name -}}
|
||||
{{- $name = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey $rootCtx.Values "persistence") -}}
|
||||
{{- $_ := set $rootCtx.Values "persistence" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $rootCtx.Values.persistence $name $deviceValues -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Device List - Only [device] type can be defined in deviceList, but got [%s]" $deviceValues.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- define "tc.v1.common.values.ingressList" -}}
|
||||
{{- $rootCtx := . -}}
|
||||
|
||||
{{- range $idx, $ingressValues := $rootCtx.Values.ingressList -}}
|
||||
{{- $name := (printf "ingress-list-%s" (toString $idx)) -}}
|
||||
|
||||
{{- with $ingressValues.name -}}
|
||||
{{- $name = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey $rootCtx.Values "ingress") -}}
|
||||
{{- $_ := set $rootCtx.Values "ingress" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $rootCtx.Values.ingress $name $ingressValues -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- define "tc.v1.common.values.persistenceList" -}}
|
||||
{{- $rootCtx := . -}}
|
||||
|
||||
{{- range $idx, $persistenceValues := $rootCtx.Values.persistenceList -}}
|
||||
{{- if ne $persistenceValues.type "device" -}}
|
||||
{{- $name := (printf "persist-list-%s" (toString $idx)) -}}
|
||||
|
||||
{{- with $persistenceValues.name -}}
|
||||
{{- $name = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey $rootCtx.Values "persistence") -}}
|
||||
{{- $_ := set $rootCtx.Values "persistence" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $rootCtx.Values.persistence $name $persistenceValues -}}
|
||||
{{- else -}}
|
||||
{{- fail "Persistence List - type [device] should be defined in deviceList only" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- define "tc.v1.common.values.portList" -}}
|
||||
{{- $rootCtx := . -}}
|
||||
{{- $svcValues := .svcValues -}}
|
||||
|
||||
{{- $hasPrimaryPort := false -}}
|
||||
{{- range $portName, $portValues := $svcValues.ports -}}
|
||||
{{- if $portValues.enabled -}}
|
||||
{{- if $portValues.primary -}}
|
||||
{{- $hasPrimaryPort = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $portIdx, $portValues := $svcValues.portsList -}}
|
||||
{{- $portName := (printf "port-list-%s" (toString $portIdx)) -}}
|
||||
|
||||
{{- if eq $portIdx 0 -}}
|
||||
{{- if not $hasPrimaryPort -}}
|
||||
{{- $_ := set $portValues "primary" true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $portValues.name -}}
|
||||
{{- $portName = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey $svcValues "ports") -}}
|
||||
{{- $_ := set $svcValues "ports" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $svcValues.ports $portName $portValues -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- define "tc.v1.common.values.serviceList" -}}
|
||||
{{- $rootCtx := . -}}
|
||||
|
||||
{{- $hasPrimary := false -}}
|
||||
{{- range $svcName, $svcValues := $rootCtx.Values.service -}}
|
||||
{{- if $svcValues.enabled -}}
|
||||
{{- if $svcValues.primary -}}
|
||||
{{- $hasPrimary = true -}}
|
||||
{{- end -}} {{/* Check if "service" has a portList. */}}
|
||||
{{- include "tc.v1.common.values.portList" (dict "rootCtx" $rootCtx "svcValues" $svcValues) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $svcIdx, $svcValues := $rootCtx.Values.serviceList -}}
|
||||
{{- $svcName := (printf "svc-list-%s" (toString $svcIdx)) -}}
|
||||
|
||||
{{- if eq $svcIdx 0 -}}
|
||||
{{- if not $hasPrimary -}}
|
||||
{{- $_ := set $svcValues "primary" true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $svcValues.name -}}
|
||||
{{- $svcName = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey $rootCtx.Values "service") -}}
|
||||
{{- $_ := set $rootCtx.Values "service" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "tc.v1.common.values.portList" (dict "rootCtx" $rootCtx "svcValues" $svcValues) -}}
|
||||
|
||||
{{- $_ := set $rootCtx.Values.service $svcName $svcValues -}}
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user