Przeglądaj źródła

render clusterip service when hostnetwork, so other apps can still connect to it internally

Stavros kois 2 lat temu
rodzic
commit
f8b67647a8
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9 2
      test/wg-easy/1.0.0/templates/service.yaml

+ 9 - 2
test/wg-easy/1.0.0/templates/service.yaml

@@ -2,11 +2,18 @@
 {{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }}
 {{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }}
 {{ $ports := list }}
+{{- if not .Values.hostNetwork }}
 {{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.webUIPort "nodePort" .Values.webUIPort "targetPort" .Values.webUIPort) }}
 {{ $ports = mustAppend $ports (dict "name" "udp" "port" .Values.wgUDPPort "nodePort" .Values.wgUDPPort "targetPort" .Values.wgUDPPort  "protocol" "UDP") }}
+{{- else }}
+{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.webUIPort "targetPort" .Values.webUIPort) }}
+{{ $ports = mustAppend $ports (dict "name" "udp" "port" .Values.wgUDPPort "targetPort" .Values.wgUDPPort  "protocol" "UDP") }}
+{{- end }}
 {{ $params := . }}
+{{- if not .Values.hostNetwork }}
 {{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
+{{- else }}
+{{ $_ := set $params "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
+{{- end }}
 {{ $_1 := set .Values "extraSelectorLabels" $selectors }}
-{{- if not .Values.hostNetwork }}
 {{ include "common.classes.service" $params }}
-{{- end }}