Code Review
/
oom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
[STRIMZI] External Kafka Access via Ingress
[oom.git]
/
kubernetes
/
common
/
common
/
templates
/
_service.tpl
diff --git
a/kubernetes/common/common/templates/_service.tpl
b/kubernetes/common/common/templates/_service.tpl
index
8489cc5
..
3db0139
100644
(file)
--- a/
kubernetes/common/common/templates/_service.tpl
+++ b/
kubernetes/common/common/templates/_service.tpl
@@
-13,7
+13,6
@@
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
-
{{/*
Resolve the name of a chart's service.
{{/*
Resolve the name of a chart's service.
@@
-122,27
+121,51
@@
labels: {{- include "common.labels" (dict "labels" $labels "dot" $dot) | nindent
{{- if (include "common.needTLS" $dot) }}
- port: {{ $port.port }}
targetPort: {{ $port.name }}
{{- if (include "common.needTLS" $dot) }}
- port: {{ $port.port }}
targetPort: {{ $port.name }}
+{{- if $port.l4_protocol }}
+ protocol: {{ $port.l4_protocol }}
+{{- else }}
+ protocol: TCP
+{{- end }}
+{{- if $port.app_protocol }}
+ appProtocol: {{ $port.app_protocol }}
+{{- end }}
{{- if $port.port_protocol }}
name: {{ printf "%ss-%s" $port.port_protocol $port.name }}
{{- else }}
name: {{ $port.name }}
{{- end }}
{{- if $port.port_protocol }}
name: {{ printf "%ss-%s" $port.port_protocol $port.name }}
{{- else }}
name: {{ $port.name }}
{{- end }}
-{{- if (eq $serviceType "NodePort") }}
- nodePort: {{ include "common.nodePortPrefix" (dict "dot" $dot "useNodePortExt" $port.useNodePortExt) }}{{ $port.nodePort }}
-{{- end }}
{{- else }}
- port: {{ default $port.port $port.plain_port }}
targetPort: {{ $port.name }}
{{- else }}
- port: {{ default $port.port $port.plain_port }}
targetPort: {{ $port.name }}
+{{- if $port.plain_port_l4_protocol }}
+ protocol: {{ $port.plain_port_l4_protocol }}
+{{- else }}
+ protocol: {{ default "TCP" $port.l4_protocol }}
+{{- end }}
+{{- if $port.app_protocol }}
+ appProtocol: {{ $port.app_protocol }}
+{{- end }}
{{- if $port.port_protocol }}
name: {{ printf "%s-%s" $port.port_protocol $port.name }}
{{- else }}
name: {{ $port.name }}
{{- end }}
{{- end }}
{{- if $port.port_protocol }}
name: {{ printf "%s-%s" $port.port_protocol $port.name }}
{{- else }}
name: {{ $port.name }}
{{- end }}
{{- end }}
+{{- if (eq $serviceType "NodePort") }}
+ nodePort: {{ include "common.nodePortPrefix" (dict "dot" $dot "useNodePortExt" $port.useNodePortExt) }}{{ $port.nodePort }}
+{{- end }}
{{- if (and (and (include "common.needTLS" $dot) $add_plain_port) $port.plain_port) }}
{{- if (eq $serviceType "ClusterIP") }}
- port: {{ $port.plain_port }}
targetPort: {{ $port.name }}-plain
{{- if (and (and (include "common.needTLS" $dot) $add_plain_port) $port.plain_port) }}
{{- if (eq $serviceType "ClusterIP") }}
- port: {{ $port.plain_port }}
targetPort: {{ $port.name }}-plain
+{{- if $port.plain_l4_port_protocol }}
+ protocol: {{ $port.plain_port_l4_protocol }}
+{{- else }}
+ protocol: {{ default "TCP" $port.l4_protocol }}
+{{- end }}
+{{- if $port.app_protocol }}
+ appProtocol: {{ $port.app_protocol }}
+{{- end }}
{{- if $port.port_protocol }}
name: {{ printf "%s-%s" $port.port_protocol $port.name }}
{{- else }}
{{- if $port.port_protocol }}
name: {{ printf "%s-%s" $port.port_protocol $port.name }}
{{- else }}
@@
-227,6
+250,9
@@
spec:
{{- $both_tls_and_plain:= default false $dot.Values.service.both_tls_and_plain }}
{{- $labels := default (dict) .labels -}}
{{- $matchLabels := default (dict) .matchLabels -}}
{{- $both_tls_and_plain:= default false $dot.Values.service.both_tls_and_plain }}
{{- $labels := default (dict) .labels -}}
{{- $matchLabels := default (dict) .matchLabels -}}
+{{- if and (include "common.ingressEnabled" $dot) (eq $serviceType "NodePort") -}}
+{{- $serviceType = "ClusterIP" }}
+{{- end }}
{{- if (and (include "common.needTLS" $dot) $both_tls_and_plain) }}
{{ include "common.genericService" (dict "suffix" $suffix "annotations" $annotations "msb_informations" $msb_informations "dot" $dot "publishNotReadyAddresses" $publishNotReadyAddresses "ports" $ports "serviceType" "ClusterIP" "add_plain_port" true $labels "matchLabels" $matchLabels) }}
{{- if (and (include "common.needTLS" $dot) $both_tls_and_plain) }}
{{ include "common.genericService" (dict "suffix" $suffix "annotations" $annotations "msb_informations" $msb_informations "dot" $dot "publishNotReadyAddresses" $publishNotReadyAddresses "ports" $ports "serviceType" "ClusterIP" "add_plain_port" true $labels "matchLabels" $matchLabels) }}
@@
-253,6
+279,11
@@
spec:
{{- $ports := $dot.Values.service.headlessPorts -}}
{{- $labels := default (dict) .labels -}}
{{- $matchLabels := default (dict) .matchLabels -}}
{{- $ports := $dot.Values.service.headlessPorts -}}
{{- $labels := default (dict) .labels -}}
{{- $matchLabels := default (dict) .matchLabels -}}
+{{- if ($dot.Values.metrics) }}
+{{- range $index, $metricPort := $dot.Values.metrics.ports }}
+{{- $ports = append $ports $metricPort }}
+{{- end }}
+{{- end }}
{{ include "common.genericService" (dict "suffix" $suffix "annotations" $annotations "dot" $dot "publishNotReadyAddresses" $publishNotReadyAddresses "ports" $ports "serviceType" "ClusterIP" "headless" true "labels" $labels "matchLabels" $matchLabels) }}
{{- end -}}
{{ include "common.genericService" (dict "suffix" $suffix "annotations" $annotations "dot" $dot "publishNotReadyAddresses" $publishNotReadyAddresses "ports" $ports "serviceType" "ClusterIP" "headless" true "labels" $labels "matchLabels" $matchLabels) }}
{{- end -}}
@@
-309,6
+340,16
@@
true
{{- end }}
{{- end -}}
{{- end }}
{{- end -}}
+{{/*
+ generate needed scheme:
+ - https if needTLS
+ - http if not
+*/}}
+
+{{- define "common.scheme" -}}
+ {{- ternary "https" "http" (eq "true" (include "common.needTLS" .)) }}
+{{- end -}}
+
{{- define "common.port.buildCache" -}}
{{- $global := . }}
{{- if not $global.Values._DmaapDrNodePortsCache }}
{{- define "common.port.buildCache" -}}
{{- $global := . }}
{{- if not $global.Values._DmaapDrNodePortsCache }}