Skip to content

Commit

Permalink
Merge pull request #13 from Portkey-AI/fix/ingress
Browse files Browse the repository at this point in the history
fix: ingress
  • Loading branch information
sk-portkey authored Jan 9, 2025
2 parents db9d1f2 + b22e50b commit 344ce17
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 5 deletions.
23 changes: 20 additions & 3 deletions charts/portkey-app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions charts/portkey-app/templates/backend/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 1 addition & 2 deletions charts/portkey-app/templates/frontend/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
30 changes: 30 additions & 0 deletions charts/portkey-app/templates/frontend/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
14 changes: 14 additions & 0 deletions charts/portkey-app/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions charts/portkey-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 344ce17

Please sign in to comment.