Skip to content

Commit 4ba6553

Browse files
committed
separate into webapp and registry ingress
1 parent 79c382d commit 4ba6553

File tree

8 files changed

+231
-103
lines changed

8 files changed

+231
-103
lines changed

hosting/k8s/helm/README.md

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,13 @@ This chart deploys the following components:
113113
### Basic Configuration
114114
115115
```yaml
116-
# Application URLs
117-
config:
116+
webapp:
117+
# Application URLs
118118
appOrigin: "https://trigger.example.com"
119119
loginOrigin: "https://trigger.example.com"
120120
apiOrigin: "https://trigger.example.com"
121121

122-
# Bootstrap mode (auto-creates worker group)
123-
config:
122+
# Bootstrap mode (auto-creates worker group)
124123
bootstrap:
125124
enabled: true # Enable for combined setups
126125
workerGroupName: "bootstrap"
@@ -133,8 +132,7 @@ Use external managed services instead of bundled components:
133132
```yaml
134133
# External PostgreSQL
135134
postgres:
136-
enabled: false
137-
external: true
135+
deploy: false
138136
external:
139137
host: "your-postgres.rds.amazonaws.com"
140138
port: 5432
@@ -144,17 +142,15 @@ postgres:
144142

145143
# External Redis
146144
redis:
147-
enabled: false
148-
external: true
145+
deploy: false
149146
external:
150147
host: "your-redis.cache.amazonaws.com"
151148
port: 6379
152149
password: "your-password"
153150

154151
# External Docker Registry (e.g., Kind local registry)
155152
registry:
156-
enabled: true
157-
external: true
153+
deploy: true
158154
external:
159155
host: "localhost"
160156
port: 5001
@@ -165,20 +161,39 @@ registry:
165161
### Ingress Configuration
166162
167163
```yaml
168-
ingress:
169-
enabled: true
170-
className: "nginx"
171-
annotations:
172-
cert-manager.io/cluster-issuer: "letsencrypt-prod"
173-
hosts:
174-
- host: trigger.example.com
175-
paths:
176-
- path: /
177-
pathType: Prefix
178-
tls:
179-
- secretName: trigger-tls
180-
hosts:
181-
- trigger.example.com
164+
# Webapp ingress
165+
webapp:
166+
ingress:
167+
enabled: true
168+
className: "nginx"
169+
annotations:
170+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
171+
hosts:
172+
- host: trigger.example.com
173+
paths:
174+
- path: /
175+
pathType: Prefix
176+
tls:
177+
- secretName: trigger-tls
178+
hosts:
179+
- trigger.example.com
180+
181+
# Registry ingress
182+
registry:
183+
ingress:
184+
enabled: true
185+
className: "nginx"
186+
annotations:
187+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
188+
hosts:
189+
- host: registry.example.com
190+
paths:
191+
- path: /
192+
pathType: Prefix
193+
tls:
194+
- secretName: registry-tls
195+
hosts:
196+
- registry.example.com
182197
```
183198
184199
### Resource Configuration

hosting/k8s/helm/templates/NOTES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ To get started:
2424
kubectl get pods --namespace {{ .Release.Namespace }} -w
2525

2626
2. Access the webapp:
27-
{{- if .Values.ingress.enabled }}
28-
{{- range $host := .Values.ingress.hosts }}
27+
{{- if .Values.webapp.ingress.enabled }}
28+
{{- range $host := .Values.webapp.ingress.hosts }}
2929
{{- range .paths }}
30-
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
30+
http{{ if $.Values.webapp.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
3131
{{- end }}
3232
{{- end }}
3333
{{- else if contains "NodePort" .Values.webapp.service.type }}

hosting/k8s/helm/templates/_helpers.tpl

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,20 +306,37 @@ Generate docker config for image pull secret
306306
{{- end }}
307307

308308
{{/*
309-
Merge ingress annotations to avoid duplicates
309+
Merge webapp ingress annotations to avoid duplicates
310310
*/}}
311-
{{- define "trigger-v4.ingress.annotations" -}}
311+
{{- define "trigger-v4.webapp.ingress.annotations" -}}
312312
{{- $annotations := dict -}}
313-
{{- if .Values.ingress.annotations -}}
314-
{{- $annotations = .Values.ingress.annotations -}}
313+
{{- if .Values.webapp.ingress.annotations -}}
314+
{{- $annotations = .Values.webapp.ingress.annotations -}}
315315
{{- end -}}
316-
{{- if .Values.ingress.certManager.enabled -}}
317-
{{- $_ := set $annotations "cert-manager.io/cluster-issuer" .Values.ingress.certManager.clusterIssuer -}}
316+
{{- if .Values.webapp.ingress.certManager.enabled -}}
317+
{{- $_ := set $annotations "cert-manager.io/cluster-issuer" .Values.webapp.ingress.certManager.clusterIssuer -}}
318318
{{- end -}}
319-
{{- if .Values.ingress.externalDns.enabled -}}
320-
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/hostname" .Values.ingress.externalDns.hostname -}}
321-
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/ttl" (.Values.ingress.externalDns.ttl | toString) -}}
319+
{{- if .Values.webapp.ingress.externalDns.enabled -}}
320+
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/hostname" .Values.webapp.ingress.externalDns.hostname -}}
321+
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/ttl" (.Values.webapp.ingress.externalDns.ttl | toString) -}}
322322
{{- end -}}
323323
{{- toYaml $annotations -}}
324324
{{- end }}
325325

326+
{{/*
327+
Merge registry ingress annotations to avoid duplicates
328+
*/}}
329+
{{- define "trigger-v4.registry.ingress.annotations" -}}
330+
{{- $annotations := dict -}}
331+
{{- if .Values.registry.ingress.annotations -}}
332+
{{- $annotations = .Values.registry.ingress.annotations -}}
333+
{{- end -}}
334+
{{- if .Values.registry.ingress.certManager.enabled -}}
335+
{{- $_ := set $annotations "cert-manager.io/cluster-issuer" .Values.registry.ingress.certManager.clusterIssuer -}}
336+
{{- end -}}
337+
{{- if .Values.registry.ingress.externalDns.enabled -}}
338+
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/hostname" .Values.registry.ingress.externalDns.hostname -}}
339+
{{- $_ := set $annotations "external-dns.alpha.kubernetes.io/ttl" (.Values.registry.ingress.externalDns.ttl | toString) -}}
340+
{{- end -}}
341+
{{- toYaml $annotations -}}
342+
{{- end }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{- if and .Values.registry.deploy .Values.registry.ingress.enabled -}}
2+
{{- $fullName := include "trigger-v4.fullname" . -}}
3+
{{- $svcPort := .Values.registry.service.port -}}
4+
apiVersion: networking.k8s.io/v1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}-registry
8+
labels:
9+
{{- $component := "registry" }}
10+
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
11+
annotations:
12+
{{- include "trigger-v4.registry.ingress.annotations" . | nindent 4 }}
13+
spec:
14+
{{- if .Values.registry.ingress.className }}
15+
ingressClassName: {{ .Values.registry.ingress.className }}
16+
{{- end }}
17+
{{- if .Values.registry.ingress.tls }}
18+
tls:
19+
{{- range .Values.registry.ingress.tls }}
20+
- hosts:
21+
{{- range .hosts }}
22+
- {{ . | quote }}
23+
{{- end }}
24+
secretName: {{ .secretName }}
25+
{{- end }}
26+
{{- end }}
27+
rules:
28+
{{- range .Values.registry.ingress.hosts }}
29+
- host: {{ .host | quote }}
30+
http:
31+
paths:
32+
{{- if .paths }}
33+
{{- range .paths }}
34+
- path: {{ .path }}
35+
pathType: {{ .pathType | default "Prefix" }}
36+
backend:
37+
service:
38+
name: {{ $fullName }}-registry
39+
port:
40+
number: {{ $svcPort }}
41+
{{- end }}
42+
{{- else }}
43+
- path: /
44+
pathType: Prefix
45+
backend:
46+
service:
47+
name: {{ $fullName }}-registry
48+
port:
49+
number: {{ $svcPort }}
50+
{{- end }}
51+
{{- end }}
52+
{{- end }}

hosting/k8s/helm/templates/ingress.yaml renamed to hosting/k8s/helm/templates/webapp-ingress.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
{{- if .Values.ingress.enabled -}}
1+
{{- if .Values.webapp.ingress.enabled -}}
22
{{- $fullName := include "trigger-v4.fullname" . -}}
33
{{- $svcPort := .Values.webapp.service.port -}}
44
apiVersion: networking.k8s.io/v1
55
kind: Ingress
66
metadata:
7-
name: {{ $fullName }}
7+
name: {{ $fullName }}-webapp
88
labels:
9-
{{- include "trigger-v4.labels" . | nindent 4 }}
9+
{{- $component := "webapp" }}
10+
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
1011
annotations:
11-
{{- include "trigger-v4.ingress.annotations" . | nindent 4 }}
12+
{{- include "trigger-v4.webapp.ingress.annotations" . | nindent 4 }}
1213
spec:
13-
{{- if .Values.ingress.className }}
14-
ingressClassName: {{ .Values.ingress.className }}
14+
{{- if .Values.webapp.ingress.className }}
15+
ingressClassName: {{ .Values.webapp.ingress.className }}
1516
{{- end }}
16-
{{- if .Values.ingress.tls }}
17+
{{- if .Values.webapp.ingress.tls }}
1718
tls:
18-
{{- range .Values.ingress.tls }}
19+
{{- range .Values.webapp.ingress.tls }}
1920
- hosts:
2021
{{- range .hosts }}
2122
- {{ . | quote }}
@@ -24,7 +25,7 @@ spec:
2425
{{- end }}
2526
{{- end }}
2627
rules:
27-
{{- range .Values.ingress.hosts }}
28+
{{- range .Values.webapp.ingress.hosts }}
2829
- host: {{ .host | quote }}
2930
http:
3031
paths:

hosting/k8s/helm/templates/webapp.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ spec:
172172
{{- toYaml .Values.webapp.resources | nindent 12 }}
173173
env:
174174
- name: APP_ORIGIN
175-
value: {{ .Values.config.appOrigin | quote }}
175+
value: {{ .Values.webapp.appOrigin | quote }}
176176
- name: LOGIN_ORIGIN
177-
value: {{ .Values.config.loginOrigin | quote }}
177+
value: {{ .Values.webapp.loginOrigin | quote }}
178178
- name: API_ORIGIN
179-
value: {{ .Values.config.apiOrigin | quote }}
179+
value: {{ .Values.webapp.apiOrigin | quote }}
180180
- name: ELECTRIC_ORIGIN
181181
value: {{ include "trigger-v4.electric.url" . | quote }}
182182
- name: DATABASE_URL
@@ -194,7 +194,7 @@ spec:
194194
- name: APP_LOG_LEVEL
195195
value: {{ .Values.webapp.logLevel | quote }}
196196
- name: DEV_OTEL_EXPORTER_OTLP_ENDPOINT
197-
value: "{{ .Values.config.appOrigin }}/otel"
197+
value: "{{ .Values.webapp.appOrigin }}/otel"
198198
- name: DEPLOY_REGISTRY_HOST
199199
value: {{ include "trigger-v4.registry.host" . | quote }}
200200
- name: DEPLOY_REGISTRY_NAMESPACE

hosting/k8s/helm/values-production-example.yaml

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,30 @@ secrets:
1212
accessKeyId: "your-access-key"
1313
secretAccessKey: "your-secret-key"
1414

15-
# Production configuration
16-
config:
15+
# Production webapp configuration
16+
webapp:
17+
# Origin configuration
1718
appOrigin: "https://trigger.example.com"
1819
loginOrigin: "https://trigger.example.com"
1920
apiOrigin: "https://trigger.example.com"
2021

21-
# Production ingress
22-
ingress:
23-
enabled: true
24-
className: "nginx"
25-
annotations:
26-
cert-manager.io/cluster-issuer: "letsencrypt-prod"
27-
nginx.ingress.kubernetes.io/ssl-redirect: "true"
28-
hosts:
29-
- host: trigger.example.com
30-
paths:
31-
- path: /
32-
pathType: Prefix
33-
tls:
34-
- secretName: trigger-tls
35-
hosts:
36-
- trigger.example.com
22+
# Production ingress
23+
ingress:
24+
enabled: true
25+
className: "nginx"
26+
annotations:
27+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
28+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
29+
hosts:
30+
- host: trigger.example.com
31+
paths:
32+
- path: /
33+
pathType: Prefix
34+
tls:
35+
- secretName: trigger-tls
36+
hosts:
37+
- trigger.example.com
3738

38-
# Production webapp configuration
39-
webapp:
40-
bootstrap:
41-
enabled: false # Usually disabled in production
4239
resources:
4340
limits:
4441
cpu: 2000m
@@ -114,6 +111,23 @@ registry:
114111
size: 100Gi
115112
storageClass: "standard"
116113

114+
# Production ingress
115+
ingress:
116+
enabled: true
117+
className: "nginx"
118+
annotations:
119+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
120+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
121+
hosts:
122+
- host: registry.example.com
123+
paths:
124+
- path: /
125+
pathType: Prefix
126+
tls:
127+
- secretName: registry-tls
128+
hosts:
129+
- registry.example.com
130+
117131
# Production Supervisor (Kubernetes worker orchestrator)
118132
supervisor:
119133
resources:

0 commit comments

Comments
 (0)