Skip to content

Commit ab8c7cf

Browse files
amanpruthiamanpruthi
and
amanpruthi
authored
feat: Added internal ingress (#102)
Co-authored-by: amanpruthi <[email protected]>
1 parent afcaee7 commit ab8c7cf

File tree

4 files changed

+87
-21
lines changed

4 files changed

+87
-21
lines changed

charts/operator-wandb/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: operator-wandb
33
description: A Helm chart for deploying W&B to Kubernetes
44
type: application
5-
version: 0.12.11
5+
version: 0.13.0
66
appVersion: 1.0.0
77
icon: https://wandb.ai/logo.svg
88

charts/operator-wandb/templates/_ingress.tpl

+24
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,27 @@ It expects a dictionary with two entries:
3838
{{- define "defaultHost" -}}
3939
{{- replace "https://" "" (replace "http://" "" .Values.global.host) }}
4040
{{- end -}}
41+
42+
43+
{{- define "IngressPath" -}}
44+
- pathType: Prefix
45+
path: /
46+
backend:
47+
service:
48+
{{- if eq $.Values.ingress.defaultBackend "console" }}
49+
name: {{ $.Release.Name }}-console
50+
port:
51+
number: 8082
52+
{{- else }}
53+
name: {{ $.Release.Name }}-app
54+
port:
55+
number: 8080
56+
{{- end }}
57+
- pathType: Prefix
58+
path: /console
59+
backend:
60+
service:
61+
name: {{ $.Release.Name }}-console
62+
port:
63+
number: 8082
64+
{{- end }}

charts/operator-wandb/templates/ingress.yaml

+46-20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ spec:
2222
{{- end }}
2323
{{- if .Values.ingress.install }}
2424
---
25+
{{- if .Values.ingress.create }}
2526
apiVersion: networking.k8s.io/v1
2627
kind: Ingress
2728
metadata:
@@ -54,29 +55,54 @@ spec:
5455
{{- end }}
5556

5657
rules:
58+
{{- $dot := . }}
5759
{{- range concat (list $defaultHost) .Values.ingress.additionalHosts }}
5860
- host: {{ . }}
5961
http:
6062
paths:
61-
- pathType: Prefix
62-
path: /
63-
backend:
64-
service:
65-
{{- if eq $.Values.ingress.defaultBackend "console" }}
66-
name: {{ $.Release.Name }}-console
67-
port:
68-
number: 8082
69-
{{- else }}
70-
name: {{ $.Release.Name }}-app
71-
port:
72-
number: 8080
73-
{{- end }}
74-
- pathType: Prefix
75-
path: /console
76-
backend:
77-
service:
78-
name: {{ $.Release.Name }}-console
79-
port:
80-
number: 8082
63+
{{- include "IngressPath" $dot | nindent 6 }}
8164
{{- end }}
8265
{{- end }}
66+
{{- end }}
67+
---
68+
{{- if .Values.ingress.secondary.create }}
69+
apiVersion: networking.k8s.io/v1
70+
kind: Ingress
71+
metadata:
72+
name: {{ default .Release.Name .Values.ingress.secondary.nameOverride }}
73+
labels:
74+
{{- include "wandb.commonLabels" . | nindent 4 }}
75+
{{- if .Values.ingress.secondary.labels -}}
76+
{{- toYaml .Values.ingress.secondary.labels | nindent 4 }}
77+
{{- end }}
78+
annotations:
79+
{{- if .Values.ingress.secondary.issuer.create }}
80+
"cert-manager.io/issuer": "{{ .Release.Name }}-issuer"
81+
"cert-manager.io/acme-challenge-type": "http01"
82+
"kubernetes.io/ingress.allow-http" : "false"
83+
{{- end }}
84+
85+
{{- if .Values.ingress.secondary.annotations -}}
86+
{{- toYaml .Values.ingress.secondary.annotations | nindent 4 }}
87+
{{- end }}
88+
spec:
89+
ingressClassName: {{ .Values.ingress.secondary.class }}
90+
{{- $defaultHost := include "defaultHost" . -}}
91+
92+
{{- if .Values.ingress.secondary.issuer.create }}
93+
tls:
94+
- host: [{{ $defaultHost }}]
95+
secretName: {{ .Release.Name }}-tls
96+
{{- else }}
97+
tls: {{ toYaml .Values.ingress.secondary.tls | nindent 4 }}
98+
{{- end }}
99+
100+
rules:
101+
{{- $dot := . }}
102+
{{- range concat (list $defaultHost) .Values.ingress.secondary.additionalHosts }}
103+
- host: {{ . }}
104+
http:
105+
paths:
106+
{{- include "IngressPath" $dot | nindent 6 }}
107+
{{- end }}
108+
{{- end }}

charts/operator-wandb/values.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ global:
104104

105105
ingress:
106106
install: true
107+
create: true
107108
nameOverride: ""
108109
defaultBackend: "app"
109110
annotations: {}
@@ -116,6 +117,21 @@ ingress:
116117
provider: ""
117118
server: https://acme-v02.api.letsencrypt.org/directory
118119
120+
secondary:
121+
create: false
122+
install: true
123+
nameOverride: ""
124+
defaultBackend: "app"
125+
annotations: {}
126+
labels: {}
127+
tls: []
128+
additionalHosts: []
129+
class: ""
130+
issuer:
131+
create: false
132+
provider: ""
133+
server: https://acme-v02.api.letsencrypt.org/directory
134+
119135

120136
parquet:
121137
install: true

0 commit comments

Comments
 (0)