Skip to content

Commit 8c26988

Browse files
feat(helm): add Gateway API HTTPRoute and External Secrets Operator support
Add HTTPRoute template as an alternative to the classic Ingress resource for users running Kubernetes Gateway API controllers. The template supports parentRefs, hostnames, flexible match rules with filters, and automatically selects port 80/443 based on the existing nginx TLS configuration. Add ExternalSecret template for integrating with the External Secrets Operator (ESO), allowing users to sync secrets from external stores (e.g. HashiCorp Vault, AWS Secrets Manager, Azure Key Vault) instead of managing them directly in Helm values or Kubernetes Secrets. Both features are disabled by default and fully opt-in.
1 parent 6b14cc3 commit 8c26988

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{{- if .Values.django.httpRoute.enabled -}}
2+
{{- $fullName := include "defectdojo.fullname" . -}}
3+
apiVersion: gateway.networking.k8s.io/v1
4+
kind: HTTPRoute
5+
metadata:
6+
name: {{ $fullName }}
7+
namespace: {{ .Release.Namespace }}
8+
labels:
9+
defectdojo.org/component: django
10+
app.kubernetes.io/name: {{ include "defectdojo.name" . }}
11+
app.kubernetes.io/instance: {{ .Release.Name }}
12+
app.kubernetes.io/managed-by: {{ .Release.Service }}
13+
helm.sh/chart: {{ include "defectdojo.chart" . }}
14+
{{- range $key, $value := .Values.extraLabels }}
15+
{{ $key }}: {{ quote $value }}
16+
{{- end }}
17+
{{- with .Values.django.httpRoute.labels }}
18+
{{- toYaml . | nindent 4 }}
19+
{{- end }}
20+
{{- if or .Values.extraAnnotations .Values.django.httpRoute.annotations }}
21+
annotations:
22+
{{- range $key, $value := .Values.extraAnnotations }}
23+
{{ $key }}: {{ quote $value }}
24+
{{- end }}
25+
{{- with .Values.django.httpRoute.annotations }}
26+
{{- toYaml . | nindent 4 }}
27+
{{- end }}
28+
{{- end }}
29+
spec:
30+
{{- with .Values.django.httpRoute.parentRefs }}
31+
parentRefs:
32+
{{- toYaml . | nindent 4 }}
33+
{{- end }}
34+
{{- with .Values.django.httpRoute.hostnames }}
35+
hostnames:
36+
{{- toYaml . | nindent 4 }}
37+
{{- end }}
38+
rules:
39+
{{- range .Values.django.httpRoute.rules }}
40+
{{- with .matches }}
41+
- matches:
42+
{{- toYaml . | nindent 8 }}
43+
{{- end }}
44+
{{- with .filters }}
45+
filters:
46+
{{- toYaml . | nindent 8 }}
47+
{{- end }}
48+
backendRefs:
49+
- group: ""
50+
kind: Service
51+
name: {{ $fullName }}-django
52+
port: {{ $.Values.django.nginx.tls.enabled | ternary 443 80 }}
53+
weight: 1
54+
{{- end }}
55+
{{- end }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{- if .Values.externalSecret.enabled }}
2+
{{- $fullName := include "defectdojo.fullname" . -}}
3+
apiVersion: external-secrets.io/v1
4+
kind: ExternalSecret
5+
metadata:
6+
name: {{ $fullName }}
7+
namespace: {{ .Release.Namespace }}
8+
labels:
9+
defectdojo.org/component: django
10+
app.kubernetes.io/name: {{ include "defectdojo.name" . }}
11+
app.kubernetes.io/instance: {{ .Release.Name }}
12+
app.kubernetes.io/managed-by: {{ .Release.Service }}
13+
helm.sh/chart: {{ include "defectdojo.chart" . }}
14+
{{- range $key, $value := .Values.extraLabels }}
15+
{{ $key }}: {{ quote $value }}
16+
{{- end }}
17+
{{- with .Values.externalSecret.labels }}
18+
{{- toYaml . | nindent 4 }}
19+
{{- end }}
20+
{{- if or .Values.extraAnnotations .Values.externalSecret.annotations }}
21+
annotations:
22+
{{- range $key, $value := .Values.extraAnnotations }}
23+
{{ $key }}: {{ quote $value }}
24+
{{- end }}
25+
{{- with .Values.externalSecret.annotations }}
26+
{{- toYaml . | nindent 4 }}
27+
{{- end }}
28+
{{- end }}
29+
spec:
30+
refreshInterval: {{ .Values.externalSecret.refreshInterval | default "1h0m0s" }}
31+
secretStoreRef:
32+
{{- toYaml .Values.externalSecret.secretStoreRef | nindent 4 }}
33+
target:
34+
name: {{ .Values.externalSecret.targetSecretName }}
35+
data:
36+
{{- toYaml .Values.externalSecret.data | nindent 4 }}
37+
{{- end }}

helm/defectdojo/values.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ createSecret: false
1313
createValkeySecret: false
1414
# -- create postgresql secret in defectdojo chart, outside of postgresql chart
1515
createPostgresqlSecret: false
16+
17+
# -- External Secrets Operator integration
18+
externalSecret:
19+
# -- Enable the ExternalSecret resource
20+
enabled: false
21+
labels: {}
22+
annotations: {}
23+
# -- How often to refresh the secret from the external store
24+
refreshInterval: 1h0m0s
25+
# -- Reference to a SecretStore or ClusterSecretStore
26+
secretStoreRef:
27+
name: ""
28+
kind: ""
29+
# -- Name of the Kubernetes Secret created by ESO
30+
targetSecretName: ""
31+
# -- Data mappings from the external store
32+
data: []
33+
# - secretKey: DD_ADMIN_PASSWORD
34+
# remoteRef:
35+
# key: my-vault-path
36+
# property: admin-password
37+
1638
# -- Track configuration (trackConfig): will automatically respin application pods in case of config changes detection
1739
# can be:
1840
# 1. disabled (default)
@@ -372,6 +394,21 @@ django:
372394
# `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`
373395
# `nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"`
374396
annotations: {}
397+
# -- Kubernetes Gateway API HTTPRoute configuration (alternative to Ingress)
398+
httpRoute:
399+
enabled: false
400+
labels: {}
401+
annotations: {}
402+
parentRefs: []
403+
# - name: my-gateway
404+
# namespace: default
405+
hostnames: []
406+
# - defectdojo.example.com
407+
rules: []
408+
# - matches:
409+
# - path:
410+
# type: PathPrefix
411+
# value: /
375412
nginx:
376413
# -- If empty, uses values from images.nginx.image
377414
image:

0 commit comments

Comments
 (0)