Skip to content

Commit

Permalink
feat: Added internal ingress (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: amanpruthi <[email protected]>
  • Loading branch information
amanpruthi and amanpruthi authored May 17, 2024
1 parent afcaee7 commit ab8c7cf
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 21 deletions.
2 changes: 1 addition & 1 deletion charts/operator-wandb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: operator-wandb
description: A Helm chart for deploying W&B to Kubernetes
type: application
version: 0.12.11
version: 0.13.0
appVersion: 1.0.0
icon: https://wandb.ai/logo.svg

Expand Down
24 changes: 24 additions & 0 deletions charts/operator-wandb/templates/_ingress.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,27 @@ It expects a dictionary with two entries:
{{- define "defaultHost" -}}
{{- replace "https://" "" (replace "http://" "" .Values.global.host) }}
{{- end -}}


{{- define "IngressPath" -}}
- pathType: Prefix
path: /
backend:
service:
{{- if eq $.Values.ingress.defaultBackend "console" }}
name: {{ $.Release.Name }}-console
port:
number: 8082
{{- else }}
name: {{ $.Release.Name }}-app
port:
number: 8080
{{- end }}
- pathType: Prefix
path: /console
backend:
service:
name: {{ $.Release.Name }}-console
port:
number: 8082
{{- end }}
66 changes: 46 additions & 20 deletions charts/operator-wandb/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
{{- end }}
{{- if .Values.ingress.install }}
---
{{- if .Values.ingress.create }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down Expand Up @@ -54,29 +55,54 @@ spec:
{{- end }}

rules:
{{- $dot := . }}
{{- range concat (list $defaultHost) .Values.ingress.additionalHosts }}
- host: {{ . }}
http:
paths:
- pathType: Prefix
path: /
backend:
service:
{{- if eq $.Values.ingress.defaultBackend "console" }}
name: {{ $.Release.Name }}-console
port:
number: 8082
{{- else }}
name: {{ $.Release.Name }}-app
port:
number: 8080
{{- end }}
- pathType: Prefix
path: /console
backend:
service:
name: {{ $.Release.Name }}-console
port:
number: 8082
{{- include "IngressPath" $dot | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if .Values.ingress.secondary.create }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ default .Release.Name .Values.ingress.secondary.nameOverride }}
labels:
{{- include "wandb.commonLabels" . | nindent 4 }}
{{- if .Values.ingress.secondary.labels -}}
{{- toYaml .Values.ingress.secondary.labels | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.ingress.secondary.issuer.create }}
"cert-manager.io/issuer": "{{ .Release.Name }}-issuer"
"cert-manager.io/acme-challenge-type": "http01"
"kubernetes.io/ingress.allow-http" : "false"
{{- end }}

{{- if .Values.ingress.secondary.annotations -}}
{{- toYaml .Values.ingress.secondary.annotations | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.secondary.class }}
{{- $defaultHost := include "defaultHost" . -}}

{{- if .Values.ingress.secondary.issuer.create }}
tls:
- host: [{{ $defaultHost }}]
secretName: {{ .Release.Name }}-tls
{{- else }}
tls: {{ toYaml .Values.ingress.secondary.tls | nindent 4 }}
{{- end }}

rules:
{{- $dot := . }}
{{- range concat (list $defaultHost) .Values.ingress.secondary.additionalHosts }}
- host: {{ . }}
http:
paths:
{{- include "IngressPath" $dot | nindent 6 }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/operator-wandb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ global:

ingress:
install: true
create: true
nameOverride: ""
defaultBackend: "app"
annotations: {}
Expand All @@ -116,6 +117,21 @@ ingress:
provider: ""
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]
secondary:
create: false
install: true
nameOverride: ""
defaultBackend: "app"
annotations: {}
labels: {}
tls: []
additionalHosts: []
class: ""
issuer:
create: false
provider: ""
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]

parquet:
install: true
Expand Down

0 comments on commit ab8c7cf

Please sign in to comment.