Skip to content

Commit d5e8d7b

Browse files
committed
feat: add basic support for Gateway API HTTPRoute for routing
1 parent 46332da commit d5e8d7b

4 files changed

Lines changed: 83 additions & 0 deletions

File tree

helm/defectdojo/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ A Helm chart for Kubernetes to install DefectDojo
618618
| django.extraInitContainers | list | `[]` | A list of additional initContainers to run before the uwsgi and nginx containers. |
619619
| django.extraVolumeMounts | list | `[]` | Array of additional volume mount points common to all containers and initContainers. |
620620
| django.extraVolumes | list | `[]` | A list of extra volumes to mount. |
621+
| django.httpRoute | object | `{"annotations":{},"enabled":false,"parentRefs":[]}` | Expose the Django service via Gateway API HTTPRoute |
622+
| django.httpRoute.annotations | object | `{}` | Annotations for the HTTPRoute resource |
623+
| django.httpRoute.parentRefs | list | `[]` | Parent gateway references for the HTTPRoute parentRefs: - name: my-gateway namespace: default |
621624
| django.ingress.activateTLS | bool | `true` | |
622625
| django.ingress.annotations | object | `{}` | Restricts the type of ingress controller that can interact with our chart (nginx, traefik, ...) `kubernetes.io/ingress.class: nginx` Depending on the size and complexity of your scans, you might want to increase the default ingress timeouts if you see repeated 504 Gateway Timeouts `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"` `nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"` |
623626
| django.ingress.enabled | bool | `true` | |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{{- if .Values.django.httpRoute.enabled -}}
2+
{{- $fullName := include "defectdojo.fullname" . -}}
3+
apiVersion: gateway.networking.k8s.io/v1
4+
kind: HTTPRoute
5+
metadata:
6+
{{- if or .Values.extraAnnotations .Values.django.httpRoute.annotations }}
7+
annotations:
8+
{{- range $key, $value := .Values.extraAnnotations }}
9+
{{ $key }}: {{ quote $value }}
10+
{{- end }}
11+
{{- range $key, $value := .Values.django.httpRoute.annotations }}
12+
{{ $key }}: {{ quote $value }}
13+
{{- end }}
14+
{{- end }}
15+
labels:
16+
defectdojo.org/component: django
17+
app.kubernetes.io/name: {{ include "defectdojo.name" . }}
18+
app.kubernetes.io/instance: {{ .Release.Name }}
19+
app.kubernetes.io/managed-by: {{ .Release.Service }}
20+
helm.sh/chart: {{ include "defectdojo.chart" . }}
21+
{{- range $key, $value := .Values.extraLabels }}
22+
{{ $key }}: {{ quote $value }}
23+
{{- end }}
24+
name: {{ $fullName }}
25+
namespace: {{ .Release.Namespace }}
26+
spec:
27+
parentRefs:
28+
{{- range .Values.django.httpRoute.parentRefs }}
29+
- group: {{ .group | default "gateway.networking.k8s.io" }}
30+
kind: {{ .kind | default "Gateway" }}
31+
name: {{ .name }}
32+
{{- if .namespace }}
33+
namespace: {{ .namespace }}
34+
{{- end }}
35+
{{- if .sectionName }}
36+
sectionName: {{ .sectionName }}
37+
{{- end }}
38+
{{- end }}
39+
hostnames:
40+
- {{ .Values.host | quote }}
41+
rules:
42+
- matches:
43+
- path:
44+
type: PathPrefix
45+
{{- if .Values.django.httpRoute.path }}
46+
value: {{ .Values.django.httpRoute.path }}
47+
{{- else }}
48+
value: "/"
49+
{{- end }}
50+
backendRefs:
51+
- name: {{ $fullName }}-django
52+
port: {{ .Values.django.nginx.tls.enabled | ternary 443 80 }}
53+
{{- end }}

helm/defectdojo/values.schema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,23 @@
532532
}
533533
}
534534
},
535+
"httpRoute": {
536+
"description": "Expose the Django service via Gateway API HTTPRoute. For more info follow https://gateway-api.sigs.k8s.io/guides/http-routing/",
537+
"type": "object",
538+
"properties": {
539+
"enabled": {
540+
"type": "boolean"
541+
},
542+
"annotations": {
543+
"description": "Annotations for the HTTPRoute resource",
544+
"type": "object"
545+
},
546+
"parentRefs": {
547+
"description": "Parent gateway references for the HTTPRoute",
548+
"type": "array"
549+
}
550+
}
551+
},
535552
"mediaPersistentVolume": {
536553
"description": "This feature needs more preparation before can be enabled, please visit KUBERNETES.md#media-persistent-volume",
537554
"type": "object",

helm/defectdojo/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,16 @@ django:
372372
# `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`
373373
# `nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"`
374374
annotations: {}
375+
# -- Expose the Django service via Gateway API HTTPRoute
376+
httpRoute:
377+
enabled: false
378+
# -- Annotations for the HTTPRoute resource
379+
annotations: {}
380+
# -- Parent gateway references for the HTTPRoute
381+
# parentRefs:
382+
# - name: my-gateway
383+
# namespace: default
384+
parentRefs: []
375385
nginx:
376386
# -- If empty, uses values from images.nginx.image
377387
image:

0 commit comments

Comments
 (0)