mirror of
https://github.com/truenas/charts.git
synced 2026-06-14 22:25:57 +08:00
move file to helpers
This commit is contained in:
@@ -23,7 +23,7 @@ objectData: The service data, that will be used to render the Service object.
|
||||
{{/* External Name / External IP does not rely on any pod values */}}
|
||||
{{- if not (mustHas $svcType $specialTypes) -}}
|
||||
{{/* Get Pod Values based on the selector (or the absence of it) */}}
|
||||
{{- $podValues = fromJson (include "ix.v1.common.lib.service.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData)) -}}
|
||||
{{- $podValues = fromJson (include "ix.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Service")) -}}
|
||||
|
||||
{{- if $podValues -}}
|
||||
{{/* Get Pod hostNetwork configuration */}}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
{{/* Service - Get Selected Pod */}}
|
||||
{{/* Call this template:
|
||||
{{ include "ix.v1.common.lib.service.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
|
||||
{{ include "ix.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
|
||||
objectData: The object data of the service
|
||||
rootCtx: The root context of the chart.
|
||||
*/}}
|
||||
|
||||
{{- define "ix.v1.common.lib.service.getSelectedPodValues" -}}
|
||||
{{- define "ix.v1.common.lib.helpers.getSelectedPodValues" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- $podValues := dict -}}
|
||||
{{- with $objectData.targetSelector -}}
|
||||
{{- $podValues = mustDeepCopy (get $rootCtx.Values.workload .) -}}
|
||||
|
||||
{{- if not $podValues -}}
|
||||
{{- fail (printf "Service - Selected pod [%s] is not defined" .) -}}
|
||||
{{- fail (printf "%s - Selected pod [%s] is not defined" $caller .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $podValues.enabled -}}
|
||||
{{- fail (printf "Service - Selected pod [%s] is not enabled" .) -}}
|
||||
{{- fail (printf "%s - Selected pod [%s] is not enabled" $caller .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* While we know the shortName from targetSelector, let's set it explicitly
|
||||
Reference in New Issue
Block a user