mirror of
https://github.com/truenas/charts.git
synced 2026-06-17 07:27:44 +08:00
extract ipfamilies
This commit is contained in:
@@ -70,31 +70,10 @@ spec:
|
||||
externalTrafficPolicy: {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $svcValues.sessionAffinity -}}
|
||||
{{- include "ix.v1.common.class.serivce.sessionAffinity" (dict "svc" $svcValues "root" $root) | nindent 2 -}}
|
||||
{{- end -}}
|
||||
{{- if $svcValues.externalIPs -}}
|
||||
{{- include "ix.v1.common.class.serivce.externalIPs" (dict "externalIPs" $svcValues.externalIPs "root" $root) | nindent 2 -}}
|
||||
{{- end -}}
|
||||
{{- include "ix.v1.common.class.serivce.sessionAffinity" (dict "svc" $svcValues "root" $root) | trim | nindent 2 -}}
|
||||
{{- include "ix.v1.common.class.serivce.externalIPs" (dict "svc" $svcValues "root" $root) | trim | nindent 2 -}}
|
||||
{{- include "ix.v1.common.class.serivce.publishNotReadyAddresses" (dict "publishNotReadyAddresses" $svcValues.publishNotReadyAddresses) | trim | nindent 2 -}}
|
||||
{{- if has $svcType (list "ClusterIP" "NodePort" "LoadBalancer") -}}
|
||||
{{- with $svcValues.ipFamilyPolicy }}
|
||||
{{- if not (has . (list "SingleStack" "PreferDualStack" "RequireDualStack")) -}}
|
||||
{{ fail (printf "Invalid option (%s) for <ipFamilyPolicy>. Valid options are SingleStack, PreferDualStack, RequireDualStack" .) -}}
|
||||
{{- end }}
|
||||
ipFamilyPolicy: {{ . }}
|
||||
{{- end -}}
|
||||
{{- with $svcValues.ipFamilies }}
|
||||
ipFamilies:
|
||||
{{- range . }}
|
||||
{{- $ipFam := tpl . $root -}}
|
||||
{{- if not (has $ipFam (list "IPv4" "IPv6")) -}}
|
||||
{{- fail (printf "Invalid option (%s) for <ipFamilies[]>. Valid options are IPv4 and IPv6" $ipFam) -}}
|
||||
{{- end }}
|
||||
- {{ $ipFam }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- include "ix.v1.common.class.serivce.ipFamily" (dict "svcType" $svcType "svc" $svcValues "root" $root) | trim | nindent 2 }}
|
||||
ports:
|
||||
{{- range $name, $port := $svcValues.ports }}
|
||||
{{- if $port.enabled }}
|
||||
@@ -127,6 +106,6 @@ spec:
|
||||
{{- end -}}
|
||||
{{- if eq $svcType "ExternalIP" -}}
|
||||
{{- $_ := set $tmpSVC "values" $svcValues -}}
|
||||
{{- include "ix.v1.common.class.serivce.endpoints" (dict "svc" $tmpSVC "root" $root) }}
|
||||
{{- include "ix.v1.common.class.serivce.endpoints" (dict "svc" $svcValues "svcName" $svcName "root" $root) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{- define "ix.v1.common.class.serivce.endpoints" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $svcName := .svc.name -}}
|
||||
{{- $svcValues := .svc.values }}
|
||||
{{- $svcName := .svcName -}}
|
||||
{{- $svcValues := .svc }}
|
||||
|
||||
---
|
||||
apiVersion: {{ include "ix.v1.common.capabilities.endpoints.apiVersion" $root }}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{{- define "ix.v1.common.class.serivce.externalIPs" -}}
|
||||
{{- $externalIPs := .externalIPs -}}
|
||||
{{- $svcValues := .svc -}}
|
||||
{{- $root := .root -}}
|
||||
{{- with $svcValues.externalIPs -}}
|
||||
externalIPs:
|
||||
{{- range $externalIPs }}
|
||||
{{- range . }}
|
||||
- {{ tpl . $root }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
24
library/common/1.0.0/templates/lib/service/_ipFamily.tpl
Normal file
24
library/common/1.0.0/templates/lib/service/_ipFamily.tpl
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- define "ix.v1.common.class.serivce.ipFamily" -}}
|
||||
{{- $svcType := .svcType -}}
|
||||
{{- $svcValues := .svc -}}
|
||||
{{- $root := .root -}}
|
||||
|
||||
{{- if has $svcType (list "ClusterIP" "NodePort" "LoadBalancer") -}}
|
||||
{{- with $svcValues.ipFamilyPolicy -}}
|
||||
{{- if not (has . (list "SingleStack" "PreferDualStack" "RequireDualStack")) -}}
|
||||
{{- fail (printf "Invalid option (%s) for <ipFamilyPolicy>. Valid options are SingleStack, PreferDualStack, RequireDualStack" .) -}}
|
||||
{{- end }}
|
||||
ipFamilyPolicy: {{ . }}
|
||||
{{- end -}}
|
||||
{{- with $svcValues.ipFamilies }}
|
||||
ipFamilies:
|
||||
{{- range . }}
|
||||
{{- $ipFam := tpl . $root -}}
|
||||
{{- if not (has $ipFam (list "IPv4" "IPv6")) -}}
|
||||
{{- fail (printf "Invalid option (%s) for <ipFamilies[]>. Valid options are IPv4 and IPv6" $ipFam) -}}
|
||||
{{- end }}
|
||||
- {{ $ipFam }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,13 +1,14 @@
|
||||
{{- define "ix.v1.common.class.serivce.sessionAffinity" -}}
|
||||
{{- $svc := .svc -}}
|
||||
{{- $svcValues := .svc -}}
|
||||
{{- $root := .root -}}
|
||||
|
||||
{{- if not (has $svc.sessionAffinity (list "ClientIP" "None")) -}}
|
||||
{{- fail (printf "Invalid option (%s) for <sessionAffinity>. Valid options are ClientIP and None" $svc.sessionAffinity) -}}
|
||||
{{- end }}
|
||||
sessionAffinity: {{ $svc.sessionAffinity }}
|
||||
{{- if eq $svc.sessionAffinity "ClientIP" -}}
|
||||
{{- with $svc.sessionAffinityConfig -}}
|
||||
{{- with $svcValues.sessionAffinity -}}
|
||||
{{- if not (has . (list "ClientIP" "None")) -}}
|
||||
{{- fail (printf "Invalid option (%s) for <sessionAffinity>. Valid options are ClientIP and None" .) -}}
|
||||
{{- end }}
|
||||
sessionAffinity: {{ . }}
|
||||
{{- end -}}
|
||||
{{- if eq $svcValues.sessionAffinity "ClientIP" -}}
|
||||
{{- with $svcValues.sessionAffinityConfig -}}
|
||||
{{- with .clientIP -}}
|
||||
{{- if hasKey . "timeoutSeconds" -}}
|
||||
{{- $timeout := tpl (toString .timeoutSeconds) $root -}}
|
||||
|
||||
Reference in New Issue
Block a user