Skip to content

Commit 285a4c4

Browse files
committed
improvement(helm): follow ingress best practices
- Remove orphan comments that appeared when services were disabled - Add documentation about path ordering requirements - Paths rendered in order: realtime, copilot, app (specific before catch-all) - Clean template output matching industry Helm chart standards
1 parent 317738b commit 285a4c4

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

helm/sim/templates/ingress-internal.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ spec:
2929
secretName: {{ .Values.ingressInternal.tls.secretName }}
3030
{{- end }}
3131
rules:
32-
# Main application
3332
- host: {{ .Values.ingressInternal.app.host | quote }}
3433
http:
3534
paths:
@@ -64,8 +63,6 @@ spec:
6463
port:
6564
number: {{ $.Values.app.service.port }}
6665
{{- end }}
67-
68-
# Realtime service
6966
{{- if and .Values.realtime.enabled (ne .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host) }}
7067
- host: {{ .Values.ingressInternal.realtime.host | quote }}
7168
http:
@@ -79,7 +76,7 @@ spec:
7976
port:
8077
number: {{ $.Values.realtime.service.port }}
8178
{{- end }}
82-
{{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) }}
79+
{{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
8380
{{- range .Values.ingressInternal.copilot.paths }}
8481
- path: {{ .path }}
8582
pathType: {{ .pathType }}
@@ -91,8 +88,6 @@ spec:
9188
{{- end }}
9289
{{- end }}
9390
{{- end }}
94-
95-
# Copilot service
9691
{{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (and (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host)) }}
9792
- host: {{ .Values.ingressInternal.copilot.host | quote }}
9893
http:

helm/sim/templates/ingress.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ spec:
2929
secretName: {{ .Values.ingress.tls.secretName }}
3030
{{- end }}
3131
rules:
32-
# Main application
3332
- host: {{ .Values.ingress.app.host | quote }}
3433
http:
3534
paths:
@@ -64,8 +63,6 @@ spec:
6463
port:
6564
number: {{ $.Values.app.service.port }}
6665
{{- end }}
67-
68-
# Realtime service
6966
{{- if and .Values.realtime.enabled (ne .Values.ingress.realtime.host .Values.ingress.app.host) }}
7067
- host: {{ .Values.ingress.realtime.host | quote }}
7168
http:
@@ -79,7 +76,7 @@ spec:
7976
port:
8077
number: {{ $.Values.realtime.service.port }}
8178
{{- end }}
82-
{{- if and .Values.copilot.enabled .Values.ingress.copilot (eq .Values.ingress.copilot.host .Values.ingress.realtime.host) (ne .Values.ingress.copilot.host .Values.ingress.app.host) }}
79+
{{- if and .Values.copilot.enabled .Values.ingress.copilot (eq .Values.ingress.copilot.host .Values.ingress.realtime.host) }}
8380
{{- range .Values.ingress.copilot.paths }}
8481
- path: {{ .path }}
8582
pathType: {{ .pathType }}
@@ -91,8 +88,6 @@ spec:
9188
{{- end }}
9289
{{- end }}
9390
{{- end }}
94-
95-
# Copilot service
9691
{{- if and .Values.copilot.enabled .Values.ingress.copilot (and (ne .Values.ingress.copilot.host .Values.ingress.app.host) (ne .Values.ingress.copilot.host .Values.ingress.realtime.host)) }}
9792
- host: {{ .Values.ingress.copilot.host | quote }}
9893
http:

helm/sim/values.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -552,64 +552,66 @@ ollama:
552552
extraVolumeMounts: []
553553

554554
# Ingress configuration
555+
# When services share the same host, paths are consolidated into a single rule.
556+
# Path order: realtime paths, copilot paths, then app paths (most specific first).
557+
# Ensure specific paths (e.g., /socket.io, /copilot) come before catch-all paths (/).
555558
ingress:
556-
# Enable/disable ingress
557559
enabled: false
558-
559-
# Ingress class name
560560
className: nginx
561-
562-
# Annotations
561+
563562
annotations:
564563
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
565-
566-
# Main application host configuration
564+
565+
# Main application (use / as catch-all)
567566
app:
568567
host: sim.local
569568
paths:
570569
- path: /
571570
pathType: Prefix
572-
573-
# Realtime service host configuration
571+
572+
# Realtime service (use /socket.io when sharing host with app)
574573
realtime:
575574
host: sim-ws.local
576575
paths:
577576
- path: /
578577
pathType: Prefix
579-
580-
# TLS configuration
578+
579+
# Copilot service (optional, use /copilot when sharing host)
580+
# copilot:
581+
# host: sim.local
582+
# paths:
583+
# - path: /copilot
584+
# pathType: Prefix
585+
581586
tls:
582587
enabled: false
583588
secretName: sim-tls-secret
584589

585590
# Internal Ingress configuration
591+
# Same path ordering rules apply as above.
586592
ingressInternal:
587593
enabled: false
588594
className: nginx
589595
annotations: {}
590596

591-
# Main application
592597
app:
593598
host: sim-internal.local
594599
paths:
595600
- path: /
596601
pathType: Prefix
597602

598-
# Realtime service
599603
realtime:
600604
host: sim-internal.local
601605
paths:
602606
- path: /socket.io
603607
pathType: Prefix
604608

605-
# Copilot service (optional)
606609
# copilot:
607610
# host: sim-internal.local
608611
# paths:
609612
# - path: /copilot
610613
# pathType: Prefix
611614

612-
# TLS configuration
613615
tls:
614616
enabled: false
615617
secretName: sim-internal-tls-secret

0 commit comments

Comments
 (0)