From b22e50b3dc9f2a673e96d2ea646d50eca310ac87 Mon Sep 17 00:00:00 2001 From: sk-portkey Date: Thu, 9 Jan 2025 17:14:53 +0530 Subject: [PATCH] fix: ingress --- charts/portkey-app/templates/_helpers.tpl | 23 ++++++++++++-- .../templates/backend/deployment.yaml | 8 +++++ .../templates/frontend/deployment.yaml | 3 +- .../templates/frontend/ingress.yaml | 30 +++++++++++++++++++ charts/portkey-app/templates/secrets.yaml | 14 +++++++++ charts/portkey-app/values.yaml | 3 ++ 6 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 charts/portkey-app/templates/frontend/ingress.yaml diff --git a/charts/portkey-app/templates/_helpers.tpl b/charts/portkey-app/templates/_helpers.tpl index 649644e..f7073e4 100644 --- a/charts/portkey-app/templates/_helpers.tpl +++ b/charts/portkey-app/templates/_helpers.tpl @@ -232,41 +232,58 @@ Template containing common environment variables that are used by several servic {{- if .Values.config.oauth.enabled }} - name: AUTH_MODE value: "SSO" +{{- if .Values.config.oauth.oauthType }} +- name: AUTH_SSO_TYPE + valueFrom: + secretKeyRef: + name: {{ include "portkey.secretsName" . }} + key: oauthType +{{- end }} +{{- if .Values.config.oauth.oauthIssuerUrl }} - name: OIDC_ISSUER valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} key: oauthIssuerUrl +{{- end }} +{{- if .Values.config.oauth.oauthClientId }} - name: OIDC_CLIENTID valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} key: oauthClientId +{{- end }} +{{- if .Values.config.oauth.oauthClientSecret }} - name: OIDC_CLIENT_SECRET valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} key: oauthClientSecret +{{- end }} +{{- if .Values.config.oauth.oauthRedirectURI }} - name: OIDC_REDIRECT_URI valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} key: oauthRedirectURI -- name: JWT_PRIVATE_KEY +{{- end }} +{{- if .Values.config.oauth.oauthMetadataXml }} +- name: SAML_METADATA_XML valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} - key: jwtPrivateKey + key: oauthMetadataXml +{{- end }} {{- end }} {{- if .Values.config.noAuth.enabled }} - name: AUTH_MODE value: "NO_AUTH" +{{- end }} - name: JWT_PRIVATE_KEY valueFrom: secretKeyRef: name: {{ include "portkey.secretsName" . }} key: jwtPrivateKey -{{- end }} {{- if .Values.config.smtp.enabled }} - name: SMTP_HOST diff --git a/charts/portkey-app/templates/backend/deployment.yaml b/charts/portkey-app/templates/backend/deployment.yaml index 99b254a..55d6430 100644 --- a/charts/portkey-app/templates/backend/deployment.yaml +++ b/charts/portkey-app/templates/backend/deployment.yaml @@ -72,6 +72,14 @@ spec: - name: PRIVATE_CLIENT_AUTH value: {{ .Values.config.defaultGatewayClientAuth | quote }} {{- end }} + {{- if .Values.config.controlPlaneURL }} + - name: CONTROL_PLANE_URL + value: {{ .Values.config.controlPlaneURL | quote }} + - name: CONTROL_PANEL_URL + value: {{ .Values.config.controlPlaneURL | quote }} + - name: ALBUS_BASE_URL + value: {{ .Values.config.controlPlaneURL }}/albus + {{- end }} {{- with .Values.backend.deployment.extraEnv }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/portkey-app/templates/frontend/deployment.yaml b/charts/portkey-app/templates/frontend/deployment.yaml index ce8edd3..14e0a00 100644 --- a/charts/portkey-app/templates/frontend/deployment.yaml +++ b/charts/portkey-app/templates/frontend/deployment.yaml @@ -59,8 +59,7 @@ spec: {{- if .Values.config.oauth.enabled }} - name: VITE_AUTH_MODE value: "SSO" - {{- end }} - {{- if .Values.config.noAuth.enabled }} + {{- else if .Values.config.noAuth.enabled }} - name: VITE_AUTH_MODE value: "NO_AUTH" {{- end }} diff --git a/charts/portkey-app/templates/frontend/ingress.yaml b/charts/portkey-app/templates/frontend/ingress.yaml new file mode 100644 index 0000000..ab68e7f --- /dev/null +++ b/charts/portkey-app/templates/frontend/ingress.yaml @@ -0,0 +1,30 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "portkey.fullname" . }}-{{ .Values.frontend.name }} + labels: + {{- include "portkey.labels" . | nindent 4 }} + annotations: + {{- include "portkey.annotations" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + ingressClassName: {{ .Values.ingress.ingressClassName }} + rules: + - host: {{ .Values.ingress.hostname }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "portkey.fullname" . }}-{{ .Values.frontend.name }} + port: + number: {{ .Values.frontend.service.httpPort }} + {{- if .Values.ingress.tls }} + tls: + {{- toYaml .Values.ingress.tls | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/portkey-app/templates/secrets.yaml b/charts/portkey-app/templates/secrets.yaml index ab974ff..ef404e6 100644 --- a/charts/portkey-app/templates/secrets.yaml +++ b/charts/portkey-app/templates/secrets.yaml @@ -10,10 +10,24 @@ metadata: data: jwtPrivateKey: {{ .Values.config.jwtPrivateKey | b64enc | quote }} {{- if .Values.config.oauth.enabled }} + {{- if .Values.config.oauth.oauthType }} + oauthType: {{ .Values.config.oauth.oauthType | b64enc | quote }} + {{- end }} + {{- if .Values.config.oauth.oauthClientId }} oauthClientId: {{ .Values.config.oauth.oauthClientId | b64enc | quote }} + {{- end }} + {{- if .Values.config.oauth.oauthIssuerUrl }} oauthIssuerUrl: {{ .Values.config.oauth.oauthIssuerUrl | b64enc | quote }} + {{- end }} + {{- if .Values.config.oauth.oauthClientSecret }} oauthClientSecret: {{ .Values.config.oauth.oauthClientSecret | b64enc | quote }} + {{- end }} + {{- if .Values.config.oauth.oauthRedirectURI }} oauthRedirectURI: {{ .Values.config.oauth.oauthRedirectURI | b64enc | quote }} + {{- end }} + {{- if .Values.config.oauth.oauthMetadataXml }} + oauthMetadataXml: {{ .Values.config.oauth.oauthMetadataXml | b64enc | quote }} + {{- end }} {{- end }} {{- if .Values.config.smtp.enabled }} smtpHost: {{ .Values.config.smtp.smtpHost | b64enc | quote }} diff --git a/charts/portkey-app/values.yaml b/charts/portkey-app/values.yaml index 9c1fd27..89ce8ca 100644 --- a/charts/portkey-app/values.yaml +++ b/charts/portkey-app/values.yaml @@ -90,16 +90,19 @@ config: defaultGatewayURL: "" defaultGatewayClientAuth: "" jwtPrivateKey: "abcd" + controlPlaneURL: "" noAuth: enabled: true oauth: enabled: false + oauthType: "" oauthClientId: "" oauthIssuerUrl: "" oauthClientSecret: "" oauthRedirectURI: "" + oauthMetadataXml: "" smtp: enabled: false