diff --git a/charts/identity-gatekeeper/Chart.yaml b/charts/identity-gatekeeper/Chart.yaml index 643b446..bef0024 100644 --- a/charts/identity-gatekeeper/Chart.yaml +++ b/charts/identity-gatekeeper/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.1 +version: 1.0.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/identity-gatekeeper/templates/configmap.yaml b/charts/identity-gatekeeper/templates/configmap.yaml index 071a57c..7e7db8a 100644 --- a/charts/identity-gatekeeper/templates/configmap.yaml +++ b/charts/identity-gatekeeper/templates/configmap.yaml @@ -7,4 +7,4 @@ metadata: namespace: {{ .Release.Namespace }} data: config.yaml: | - {{- tpl (.Values.config | toYaml) $ | nindent 4 }} \ No newline at end of file + {{- tpl (.Values.config | toYaml) . | nindent 4 }} \ No newline at end of file diff --git a/charts/identity-gatekeeper/templates/deployment.yaml b/charts/identity-gatekeeper/templates/deployment.yaml index 49bc3f2..cf05deb 100644 --- a/charts/identity-gatekeeper/templates/deployment.yaml +++ b/charts/identity-gatekeeper/templates/deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "identity-gatekeeper.name" . }} + name: {{ include "identity-gatekeeper.fullname" . }} labels: {{- include "identity-gatekeeper.labels" . | nindent 4 }} namespace: {{ .Release.Namespace }} @@ -66,7 +66,7 @@ spec: {{- tpl . $ | nindent 12 }} {{- end }} - secretRef: - name: {{ include "identity-gatekeeper.name" . }} + name: {{ include "identity-gatekeeper.fullname" . }} ports: - name: proxy containerPort: {{ regexFind ":[0-9]+" .Values.config.listen | trimPrefix ":" }} diff --git a/charts/identity-gatekeeper/templates/ingress.yaml b/charts/identity-gatekeeper/templates/ingress.yaml index 6ddb293..6627e05 100644 --- a/charts/identity-gatekeeper/templates/ingress.yaml +++ b/charts/identity-gatekeeper/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $name := include "identity-gatekeeper.name" . -}} +{{- $name := include "identity-gatekeeper.fullname" . -}} {{- $svcPort := .Values.service.proxy.port -}} apiVersion: {{ include "identity-gatekeeper.ingress.apiVersion" . }} kind: Ingress @@ -9,7 +9,7 @@ metadata: {{- include "identity-gatekeeper.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: - {{- toYaml . | nindent 4 }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} namespace: {{ .Release.Namespace }} spec: @@ -21,14 +21,14 @@ spec: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - - {{ . | quote }} + - {{ tpl . $ | quote }} {{- end }} - secretName: {{ .secretName }} + secretName: {{ tpl .secretName $ }} {{- end }} {{- end }} rules: {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} + - host: {{ tpl .host $ | quote }} http: paths: {{- range .paths }} @@ -39,12 +39,12 @@ spec: backend: {{- if semverCompare ">=1.19-0" (include "identity-gatekeeper.kubeVersion" $) }} service: - name: {{ $name }} + name: {{ tpl .backend.service.name $ }} port: - number: {{ $svcPort }} + number: {{ tpl .backend.service.port.number $ }} {{- else }} - serviceName: {{ $name }} - servicePort: {{ $svcPort }} + serviceName: {{ tpl .backend.service.name $ }} + servicePort: {{ tpl .backend.service.port.number $ }} {{- end }} {{- end }} {{- end }} diff --git a/charts/identity-gatekeeper/templates/secret.yaml b/charts/identity-gatekeeper/templates/secret.yaml index b65ec9b..e73a099 100644 --- a/charts/identity-gatekeeper/templates/secret.yaml +++ b/charts/identity-gatekeeper/templates/secret.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: Secret type: Opaque metadata: - name: {{ include "identity-gatekeeper.name" . }} + name: {{ include "identity-gatekeeper.fullname" . }} labels: {{- include "identity-gatekeeper.labels" . | nindent 4 }} namespace: {{ .Release.Namespace }} diff --git a/charts/identity-gatekeeper/templates/service.yaml b/charts/identity-gatekeeper/templates/service.yaml index c12b360..b3e32d5 100644 --- a/charts/identity-gatekeeper/templates/service.yaml +++ b/charts/identity-gatekeeper/templates/service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "identity-gatekeeper.name" . }} + name: {{ include "identity-gatekeeper.fullname" . }} labels: {{- include "identity-gatekeeper.labels" . | nindent 4 }} {{- with .Values.service.annotations }} diff --git a/charts/identity-gatekeeper/values.yaml b/charts/identity-gatekeeper/values.yaml index 5098358..97f11e0 100644 --- a/charts/identity-gatekeeper/values.yaml +++ b/charts/identity-gatekeeper/values.yaml @@ -79,20 +79,52 @@ serviceAccount: create: true annotations: {} name: "" +targetService: + host: myservice.myplatform.eoepca.org + name: target-service + port: + number: 80 ingress: enabled: true className: "" annotations: cert-manager.io/cluster-issuer: letsencrypt + nginx.ingress.kubernetes.io/configuration-snippet: | + auth_request /auth; + if ($request_method = OPTIONS) { + return 200; + } + add_header Access-Control-Allow-Origin $http_origin always; + add_header Access-Control-Allow-Methods "*"; + add_header Access-Control-Allow-Headers "Authorization, Origin, Content-Type"; + nginx.ingress.kubernetes.io/server-snippet: | + location ^~ /auth { + internal; + proxy_pass http://{{ include "identity-gatekeeper.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.proxy.port }}/$request_uri; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Method $request_method; + proxy_set_header X-Forwarded-URI $request_uri; + proxy_busy_buffers_size 64k; + proxy_buffers 8 32k; + proxy_buffer_size 32k; + } hosts: - - host: identity.gatekeeper.myplatform.eoepca.org + - host: "{{ .Values.targetService.host }}" paths: - path: / pathType: Prefix + backend: + service: + name: "{{ .Values.targetService.name }}" + port: + number: "{{ .Values.targetService.port.number }}" tls: - - secretName: identity-gatekeeper-tls-certificate + - secretName: "{{ include \"identity-gatekeeper.fullname\" . }}-tls" hosts: - - identity.gatekeeper.myplatform.eoepca.org + - "{{ .Values.targetService.host }}" autoscaling: enabled: false minReplicas: 1 @@ -111,7 +143,7 @@ metrics: annotations: {} interval: config: - client-id: dummy-service + client-id: myclient discovery-url: https://identity.keycloak.myplatform.eoepca.org/realms/master no-redirects: true no-proxy: true @@ -131,4 +163,4 @@ config: listen-admin: :4000 secrets: clientSecret: "" - encryptionKey: "" \ No newline at end of file + encryptionKey: ""