mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
fix(tcp-balancer): render the kubernetes and talos Service ports only with kubernetesAndTalos
The Service rendered ports 6443 and 50000 under httpAndHttps, while the
Deployment declares the kubernetes and talos container ports and HAProxy
binds those frontends only under kubernetesAndTalos. So with the default
values every Service carried two ports whose targetPort names no
container declares, with no endpoints behind them, and with
external: true the LoadBalancer Service carried them as well. A release
with kubernetesAndTalos and without httpAndHttps got no Service port for
those frontends at all.
kubernetesAndTalos is not documented in values.yaml, but the apps API
keeps the top level of spec open and hands it to the chart as values,
so the key reaches the chart and the Deployment and the ConfigMap
already follow it. Gating the Service on the same key keeps the three
templates in step, while dropping the block would leave HAProxy
listening on ports that no Service exposes.
Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
(cherry picked from commit 78cadf53f9)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
cce6748ecd
commit
51fe9904d3
2 files changed
+98
-1
No files matched your search
@@ -27,7 +27,7 @@ spec:
|
||||
port: 443
|
||||
targetPort: https
|
||||
{{- end }}
|
||||
{{- with .Values.httpAndHttps }}
|
||||
{{- with .Values.kubernetesAndTalos }}
|
||||
- name: kubernetes
|
||||
protocol: TCP
|
||||
port: 6443
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
suite: haproxy service
|
||||
|
||||
templates:
|
||||
- templates/service.yaml
|
||||
- templates/deployment.yaml
|
||||
- templates/configmap.yaml
|
||||
|
||||
tests:
|
||||
- it: publishes only http and https by default, both on container ports the Deployment declares
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.ports
|
||||
value:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: http
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: https
|
||||
template: templates/service.yaml
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
value:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
- containerPort: 8443
|
||||
name: https
|
||||
template: templates/deployment.yaml
|
||||
|
||||
- it: publishes kubernetes and talos for kubernetesAndTalos alone, both on container ports the Deployment declares
|
||||
set:
|
||||
httpAndHttps: null
|
||||
kubernetesAndTalos:
|
||||
endpoints:
|
||||
- 10.1.1.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.ports
|
||||
value:
|
||||
- name: kubernetes
|
||||
protocol: TCP
|
||||
port: 6443
|
||||
targetPort: kubernetes
|
||||
- name: talos
|
||||
protocol: TCP
|
||||
port: 50000
|
||||
targetPort: talos
|
||||
template: templates/service.yaml
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
value:
|
||||
- containerPort: 6443
|
||||
name: kubernetes
|
||||
- containerPort: 50000
|
||||
name: talos
|
||||
template: templates/deployment.yaml
|
||||
|
||||
- it: publishes all four ports when both are set, each on a container port the Deployment declares
|
||||
set:
|
||||
kubernetesAndTalos:
|
||||
endpoints:
|
||||
- 10.1.1.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.ports
|
||||
value:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: http
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: https
|
||||
- name: kubernetes
|
||||
protocol: TCP
|
||||
port: 6443
|
||||
targetPort: kubernetes
|
||||
- name: talos
|
||||
protocol: TCP
|
||||
port: 50000
|
||||
targetPort: talos
|
||||
template: templates/service.yaml
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
value:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
- containerPort: 8443
|
||||
name: https
|
||||
- containerPort: 6443
|
||||
name: kubernetes
|
||||
- containerPort: 50000
|
||||
name: talos
|
||||
template: templates/deployment.yaml
|
||||
Reference in new issue
Block a user