From 9724ec918d06466437dacb71ca96ec3c165dd1b7 Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Sun, 11 Jan 2026 19:33:58 -0800 Subject: [PATCH 1/2] fix: api layer ingress --- .../templates/api/templates/ingress.yaml | 42 ++++++++++++++++--- charts/pubcode/values.yaml | 17 ++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/charts/pubcode/templates/api/templates/ingress.yaml b/charts/pubcode/templates/api/templates/ingress.yaml index 339eea1..8fcd562 100644 --- a/charts/pubcode/templates/api/templates/ingress.yaml +++ b/charts/pubcode/templates/api/templates/ingress.yaml @@ -1,4 +1,9 @@ -{{- if and .Values.api.enabled .Values.api.route .Values.api.route.enabled }} +{{- $ing := .Values.api.ingress | default dict -}} +{{- if and (eq (len $ing) 0) .Values.api.route -}} +{{- $ing = .Values.api.route -}} +{{- end -}} + +{{- if and .Values.api.enabled $ing $ing.enabled }} {{- $svcName := include "api.fullname" . -}} {{- $defaultSvcPort := 80 -}} {{- if and .Values.api.service .Values.api.service.ports (gt (len .Values.api.service.ports) 0) -}} @@ -10,14 +15,40 @@ metadata: name: {{ $svcName }} labels: {{- include "api.labels" . | nindent 4 }} - {{- if .Values.api.route.annotations }} + {{- if $ing.annotations }} annotations: - {{- tpl (toYaml .Values.api.route.annotations) $ | nindent 4 }} + {{- tpl (toYaml $ing.annotations) $ | nindent 4 }} {{- end }} spec: - ingressClassName: {{ default "openshift-default" .Values.api.route.className }} + ingressClassName: {{ default "openshift-default" $ing.className }} rules: - - host: {{ tpl (default (printf "%s.%s" $svcName .Values.global.domain) (printf "%v" .Values.api.route.host)) $ | quote }} + {{- if and $ing.hosts (gt (len $ing.hosts) 0) }} + {{- range $h := $ing.hosts }} + - host: {{ tpl $h.host $ | quote }} + http: + paths: + {{- if and $h.paths (gt (len $h.paths) 0) }} + {{- range $p := $h.paths }} + - path: {{ default "/" $p.path | quote }} + pathType: {{ default "ImplementationSpecific" $p.pathType }} + backend: + service: + name: {{ $svcName }} + port: + number: {{ $defaultSvcPort }} + {{- end }} + {{- else }} + - path: "/" + pathType: ImplementationSpecific + backend: + service: + name: {{ $svcName }} + port: + number: {{ $defaultSvcPort }} + {{- end }} + {{- end }} + {{- else }} + - host: {{ tpl (default (printf "%s.%s" $svcName .Values.global.domain) (printf "%v" $ing.host)) $ | quote }} http: paths: - path: "/" @@ -27,4 +58,5 @@ spec: name: {{ $svcName }} port: number: {{ $defaultSvcPort }} + {{- end }} {{- end }} diff --git a/charts/pubcode/values.yaml b/charts/pubcode/values.yaml index 0722ad7..47807b1 100644 --- a/charts/pubcode/values.yaml +++ b/charts/pubcode/values.yaml @@ -89,6 +89,23 @@ api: enabled: true host: "{{ .Release.Name }}-api.{{ .Values.global.domain }}" targetPort: http # look at line#164 refer to the name. + + ingress: + enabled: true + className: openshift-default + annotations: + haproxy.router.openshift.io/balance: "roundrobin" + route.openshift.io/termination: "edge" + haproxy.router.openshift.io/rate-limit-connections: "true" + haproxy.router.openshift.io/rate-limit-connections.concurrent-tcp: "20" + haproxy.router.openshift.io/rate-limit-connections.rate-http: "50" + haproxy.router.openshift.io/rate-limit-connections.rate-tcp: "100" + haproxy.router.openshift.io/disable_cookies: "true" + hosts: + - host: "{{ .Release.Name }}-api.{{ .Values.global.domain }}" + paths: + - path: / + pathType: ImplementationSpecific podAnnotations: |- prometheus.io/scrape: "true" prometheus.io/port: "3000" From e0e7d11408b66ecc0bbe1780fd63f06a7a30d43b Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Sun, 11 Jan 2026 19:41:33 -0800 Subject: [PATCH 2/2] fix: remove unnecessary route object --- charts/pubcode/values.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/charts/pubcode/values.yaml b/charts/pubcode/values.yaml index 47807b1..976e5fe 100644 --- a/charts/pubcode/values.yaml +++ b/charts/pubcode/values.yaml @@ -85,10 +85,6 @@ api: nodeSelector: { } tolerations: [ ] affinity: { } - route: - enabled: true - host: "{{ .Release.Name }}-api.{{ .Values.global.domain }}" - targetPort: http # look at line#164 refer to the name. ingress: enabled: true