Skip to content

Commit

Permalink
feat: further extend services configuration (#9904)
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks authored Jan 30, 2025
1 parent 7417670 commit 2e5bee9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 28 deletions.
2 changes: 1 addition & 1 deletion charts/kubernetes-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

apiVersion: v2
name: kubernetes-dashboard
version: 7.10.2
version: 7.10.3
description: General-purpose web UI for Kubernetes clusters
keywords:
- kubernetes
Expand Down
18 changes: 11 additions & 7 deletions charts/kubernetes-dashboard/templates/services/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ metadata:
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
spec:
type: {{ .Values.api.service.type }}
ports:
{{- with (index .Values.api.containers.ports 0) }}
- name: {{ .name }}
port: {{ .containerPort }}
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
{{- range $port := .Values.api.containers.ports }}
- name: {{ $port.name }}
port: {{ $port.containerPort }}
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
{{- end }}
{{ with .Values.api.service.extraSpec }}
{{ . | toYaml | nindent 2 }}
{{- end }}
selector:
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}
18 changes: 11 additions & 7 deletions charts/kubernetes-dashboard/templates/services/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ metadata:
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.auth.role }}
spec:
type: {{ .Values.auth.service.type }}
ports:
{{- with (index .Values.auth.containers.ports 0) }}
- name: {{ .name }}
port: {{ .containerPort }}
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
{{- range $port := .Values.auth.containers.ports }}
- name: {{ $port.name }}
port: {{ $port.containerPort }}
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
{{- end }}
{{ with .Values.auth.service.extraSpec }}
{{ . | toYaml | nindent 2 }}
{{- end }}
selector:
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ metadata:
{{- end }}
name: {{ template "kubernetes-dashboard.metrics-scraper.name" . }}
spec:
type: {{ .Values.metricsScraper.service.type }}
ports:
{{- with (index .Values.metricsScraper.containers.ports 0) }}
{{- range $port := .Values.metricsScraper.containers.ports }}
# Name is intentionally not used here as it breaks the connection between API <-> Scraper
# Named ports have an issue when trying to connect through in-cluster service proxy.
- port: {{ .containerPort }}
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
- port: {{ $port.containerPort }}
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
{{- end }}
{{ with .Values.metricsScraper.service.extraSpec }}
{{ . | toYaml | nindent 2 }}
{{- end }}
selector:
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.metricsScraper.role }}
Expand Down
18 changes: 11 additions & 7 deletions charts/kubernetes-dashboard/templates/services/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ metadata:
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}
spec:
type: {{ .Values.web.service.type }}
ports:
{{- with (index .Values.web.containers.ports 0) }}
- name: {{ .name }}
port: {{ .containerPort }}
{{ if .protocol }}protocol: {{ .protocol }}{{- end }}
{{ if .appProtocol }}appProtocol: {{ .appProtocol }}{{- end }}
{{ if .nodePort }}nodePort: {{ .nodePort }}{{- end }}
{{ if .targetPort }}targetPort: {{ .targetPort }}{{- end }}
{{- range $port := .Values.web.containers.ports }}
- name: {{ $port.name }}
port: {{ $port.containerPort }}
{{ if $port.protocol }}protocol: {{ $port.protocol }}{{- end }}
{{ if $port.appProtocol }}appProtocol: {{ $port.appProtocol }}{{- end }}
{{ if $port.nodePort }}nodePort: {{ $port.nodePort }}{{- end }}
{{ if $port.targetPort }}targetPort: {{ $port.targetPort }}{{- end }}
{{- end }}
{{ with .Values.web.service.extraSpec }}
{{ . | toYaml | nindent 2 }}
{{- end }}
selector:
{{- include "kubernetes-dashboard.matchLabels" . | nindent 4 }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.web.role }}
Expand Down
12 changes: 12 additions & 0 deletions charts/kubernetes-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ auth:
scaling:
replicas: 1
revisionHistoryLimit: 10
service:
type: ClusterIP
extraSpec: ~
containers:
ports:
- name: auth
Expand Down Expand Up @@ -188,6 +191,9 @@ api:
scaling:
replicas: 1
revisionHistoryLimit: 10
service:
type: ClusterIP
extraSpec: ~
containers:
ports:
- name: api
Expand Down Expand Up @@ -245,6 +251,9 @@ web:
scaling:
replicas: 1
revisionHistoryLimit: 10
service:
type: ClusterIP
extraSpec: ~
containers:
ports:
- name: web
Expand Down Expand Up @@ -305,6 +314,9 @@ metricsScraper:
scaling:
replicas: 1
revisionHistoryLimit: 10
service:
type: ClusterIP
extraSpec: ~
containers:
ports:
- containerPort: 8000
Expand Down

0 comments on commit 2e5bee9

Please sign in to comment.