Skip to content

Commit 2e5bee9

Browse files
authored
feat: further extend services configuration (#9904)
1 parent 7417670 commit 2e5bee9

File tree

6 files changed

+56
-28
lines changed

6 files changed

+56
-28
lines changed

charts/kubernetes-dashboard/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
apiVersion: v2
1616
name: kubernetes-dashboard
17-
version: 7.10.2
17+
version: 7.10.3
1818
description: General-purpose web UI for Kubernetes clusters
1919
keywords:
2020
- kubernetes

charts/kubernetes-dashboard/templates/services/api.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ metadata:
3030
{{- end }}
3131
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
3232
spec:
33+
type: {{ .Values.api.service.type }}
3334
ports:
34-
{{- with (index .Values.api.containers.ports 0) }}
35-
- name: {{ .name }}
36-
port: {{ .containerPort }}
37-
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
38-
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
39-
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
40-
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
35+
{{- range $port := .Values.api.containers.ports }}
36+
- name: {{ $port.name }}
37+
port: {{ $port.containerPort }}
38+
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
39+
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
40+
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
41+
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
4142
{{- end }}
43+
{{ with .Values.api.service.extraSpec }}
44+
{{ . | toYaml | nindent 2 }}
45+
{{- end }}
4246
selector:
4347
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
4448
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}

charts/kubernetes-dashboard/templates/services/auth.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ metadata:
3232
{{- end }}
3333
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.auth.role }}
3434
spec:
35+
type: {{ .Values.auth.service.type }}
3536
ports:
36-
{{- with (index .Values.auth.containers.ports 0) }}
37-
- name: {{ .name }}
38-
port: {{ .containerPort }}
39-
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
40-
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
41-
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
42-
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
37+
{{- range $port := .Values.auth.containers.ports }}
38+
- name: {{ $port.name }}
39+
port: {{ $port.containerPort }}
40+
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
41+
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
42+
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
43+
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
4344
{{- end }}
45+
{{ with .Values.auth.service.extraSpec }}
46+
{{ . | toYaml | nindent 2 }}
47+
{{- end }}
4448
selector:
4549
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
4650
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}

charts/kubernetes-dashboard/templates/services/metrics-scraper.yaml

+10-6
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@ metadata:
3232
{{- end }}
3333
name: {{ template "kubernetes-dashboard.metrics-scraper.name" . }}
3434
spec:
35+
type: {{ .Values.metricsScraper.service.type }}
3536
ports:
36-
{{- with (index .Values.metricsScraper.containers.ports 0) }}
37+
{{- range $port := .Values.metricsScraper.containers.ports }}
3738
# Name is intentionally not used here as it breaks the connection between API <-> Scraper
3839
# Named ports have an issue when trying to connect through in-cluster service proxy.
39-
- port: {{ .containerPort }}
40-
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
41-
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
42-
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
43-
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
40+
- port: {{ $port.containerPort }}
41+
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
42+
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
43+
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
44+
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
4445
{{- end }}
46+
{{ with .Values.metricsScraper.service.extraSpec }}
47+
{{ . | toYaml | nindent 2 }}
48+
{{- end }}
4549
selector:
4650
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
4751
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.metricsScraper.role }}

charts/kubernetes-dashboard/templates/services/web.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ metadata:
3232
{{- end }}
3333
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}
3434
spec:
35+
type: {{ .Values.web.service.type }}
3536
ports:
36-
{{- with (index .Values.web.containers.ports 0) }}
37-
- name: {{ .name }}
38-
port: {{ .containerPort }}
39-
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
40-
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
41-
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
42-
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
37+
{{- range $port := .Values.web.containers.ports }}
38+
- name: {{ $port.name }}
39+
port: {{ $port.containerPort }}
40+
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
41+
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
42+
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
43+
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
4344
{{- end }}
45+
{{ with .Values.web.service.extraSpec }}
46+
{{ . | toYaml | nindent 2 }}
47+
{{- end }}
4448
selector:
4549
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
4650
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.web.role }}

charts/kubernetes-dashboard/values.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ auth:
149149
scaling:
150150
replicas: 1
151151
revisionHistoryLimit: 10
152+
service:
153+
type: ClusterIP
154+
extraSpec: ~
152155
containers:
153156
ports:
154157
- name: auth
@@ -188,6 +191,9 @@ api:
188191
scaling:
189192
replicas: 1
190193
revisionHistoryLimit: 10
194+
service:
195+
type: ClusterIP
196+
extraSpec: ~
191197
containers:
192198
ports:
193199
- name: api
@@ -245,6 +251,9 @@ web:
245251
scaling:
246252
replicas: 1
247253
revisionHistoryLimit: 10
254+
service:
255+
type: ClusterIP
256+
extraSpec: ~
248257
containers:
249258
ports:
250259
- name: web
@@ -305,6 +314,9 @@ metricsScraper:
305314
scaling:
306315
replicas: 1
307316
revisionHistoryLimit: 10
317+
service:
318+
type: ClusterIP
319+
extraSpec: ~
308320
containers:
309321
ports:
310322
- containerPort: 8000

0 commit comments

Comments
 (0)