Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added internal ingress #102

Merged
merged 18 commits into from
May 17, 2024
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?

{{- 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: support@wandb.com
secondary:
create: false
install: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

nameOverride: ""
defaultBackend: "app"
annotations: {}
labels: {}
tls: []
additionalHosts: []
class: ""
issuer:
create: false
provider: ""
server: https://acme-v02.api.letsencrypt.org/directory
email: support@wandb.com
Comment on lines +132 to +134
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be wired up?


parquet:
install: true
Expand Down
Loading