Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit 6686559

Browse files
authored
Use port number instead of name for k8s service port (#3256)
I've found an issue when deploying Dendrite's Helm chart on my local cluster. The template for generating an Ingress resource tries to find the service port using a name (`http`), but the template that generates the Service resource, instead, identifies the resource with a port number. According to the [Kubernetes ServiceSpec](https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/), `ports.targetPort` can be either a number or a string; if it's the latter, it will be looked up as a named port in the pod's container ports. ### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately [skip ci]
1 parent 4452833 commit 6686559

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

helm/dendrite/templates/ingress.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{{- $wellKnownServerHost := default $serverNameHost (regexFind "^(\\[.+\\])?[^:]*" .Values.dendrite_config.global.well_known_server_name) -}}
55
{{- $wellKnownClientHost := default $serverNameHost (regexFind "//(\\[.+\\])?[^:/]*" .Values.dendrite_config.global.well_known_client_name | trimAll "/") -}}
66
{{- $allHosts := list $serverNameHost $wellKnownServerHost $wellKnownClientHost | uniq -}}
7+
78
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
89
apiVersion: networking.k8s.io/v1
910
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -56,7 +57,7 @@ spec:
5657
service:
5758
name: {{ $fullName }}
5859
port:
59-
name: http
60+
number: {{ $.Values.service.port }}
6061
{{- else }}
6162
serviceName: {{ $fullName }}
6263
servicePort: http
@@ -72,7 +73,7 @@ spec:
7273
service:
7374
name: {{ $fullName }}
7475
port:
75-
name: http
76+
number: {{ $.Values.service.port }}
7677
{{- else }}
7778
serviceName: {{ $fullName }}
7879
servicePort: http
@@ -88,7 +89,7 @@ spec:
8889
service:
8990
name: {{ $fullName }}
9091
port:
91-
name: http
92+
number: {{ $.Values.service.port }}
9293
{{- else }}
9394
serviceName: {{ $fullName }}
9495
servicePort: http
@@ -105,7 +106,7 @@ spec:
105106
service:
106107
name: {{ $fullName }}
107108
port:
108-
name: http
109+
number: {{ $.Values.service.port }}
109110
{{- else }}
110111
serviceName: {{ $fullName }}
111112
servicePort: http

helm/dendrite/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ spec:
1414
- name: http
1515
protocol: TCP
1616
port: {{ .Values.service.port }}
17-
targetPort: 8008
17+
targetPort: http

0 commit comments

Comments
 (0)