diff --git a/charts/prom-label-proxy/templates/_helpers.tpl b/charts/prom-label-proxy/templates/_helpers.tpl index e433f1d..a5da2cc 100644 --- a/charts/prom-label-proxy/templates/_helpers.tpl +++ b/charts/prom-label-proxy/templates/_helpers.tpl @@ -69,6 +69,23 @@ Create the name of the service account to use {{- end -}} {{- end -}} +{{/* +On the ACE hub, service-gateway runs in its own tenant namespace and its cert is synced into +this namespace by config-syncer, so fall back to the default GatewayClass when none matches the namespace. +*/}} +{{- define "prom-label-proxy.gatewayClass" -}} +{{- $ns := include "prom-label-proxy.namespace" . -}} +{{- $gc := $ns -}} +{{- if not (lookup "gateway.networking.k8s.io/v1" "GatewayClass" "" $ns) -}} + {{- range (dig "items" list (lookup "gateway.networking.k8s.io/v1" "GatewayClass" "" "")) -}} + {{- if eq (dig "metadata" "annotations" "catalog.appscode.com/is-default-gatewayclass" "" .) "true" -}} + {{- $gc = .metadata.name -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- $gc -}} +{{- end -}} + {{/* The image to use for kubeRBACProxy */}} diff --git a/charts/prom-label-proxy/templates/deployment.yaml b/charts/prom-label-proxy/templates/deployment.yaml index 4f5ac77..ddadc82 100644 --- a/charts/prom-label-proxy/templates/deployment.yaml +++ b/charts/prom-label-proxy/templates/deployment.yaml @@ -171,7 +171,7 @@ spec: - name: proxy-tls secret: defaultMode: 420 - secretName: {{ template "prom-label-proxy.namespace" . }}-gw-cert + secretName: {{ include "prom-label-proxy.gatewayClass" . }}-gw-cert {{- if and .Values.kubeRBACProxy.enabled .Values.kubeRBACProxy.config }} - name: kube-rbac-proxy-config configMap: diff --git a/charts/prom-label-proxy/templates/gw.yaml b/charts/prom-label-proxy/templates/gw.yaml index 0f64ca9..284e37c 100644 --- a/charts/prom-label-proxy/templates/gw.yaml +++ b/charts/prom-label-proxy/templates/gw.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "prom-label-proxy.name" . }}-gw namespace: {{ template "prom-label-proxy.namespace" . }} spec: - gatewayClassName: {{ template "prom-label-proxy.namespace" . }} + gatewayClassName: {{ include "prom-label-proxy.gatewayClass" . }} listeners: - name: https port: 443 @@ -13,7 +13,7 @@ spec: mode: Terminate certificateRefs: - kind: Secret - name: {{ template "prom-label-proxy.namespace" . }}-gw-cert + name: {{ include "prom-label-proxy.gatewayClass" . }}-gw-cert namespace: {{ template "prom-label-proxy.namespace" . }} - name: mtls port: 10001 @@ -61,7 +61,7 @@ spec: caCertificateRefs: - group: "" kind: Secret - name: {{ template "prom-label-proxy.namespace" . }}-gw-cert + name: {{ include "prom-label-proxy.gatewayClass" . }}-gw-cert hostname: {{ include "prom-label-proxy.name" . }}.{{ template "prom-label-proxy.namespace" . }}.svc.cluster.local ---