Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/bbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ Kubernetes: `>= 1.21.0`
| externalDatabase.username | string | `"bbook"` | database user name |
| extraObjects | list | `[]` | extra Kubernetes objects deployed with the chart, rendered through tpl. |
| fullnameOverride | string | `""` | fullnameOverride configuration |
| httpRoute.allowlist | list | `[]` | source CIDRs allowed to reach the route, empty allows all. Creates a kgateway TrafficPolicy and needs kgateway as the gateway implementation |
| httpRoute.annotations | object | `{}` | HTTPRoute annotations |
| httpRoute.enabled | bool | `false` | create an HTTPRoute attaching bbook to an existing Gateway API gateway, as an alternative to the ingress |
| httpRoute.filters | list | `[]` | optional HTTPRoute rule filters |
| httpRoute.hosts | list | `["bbook.local"]` | hostnames served by the route |
| httpRoute.matches | object | `{"path":{"type":"PathPrefix","value":"/"}}` | path match for the route |
| httpRoute.parentRefs | list | `[]` | gateways to attach to, e.g. {name: infra, namespace: infra-kgateway} |
| httpRoute.redirect.enabled | bool | `false` | create a second HTTPRoute redirecting plain HTTP requests for the same hosts to HTTPS |
| httpRoute.redirect.parentRefs | list | `[]` | HTTP listeners to attach the redirect to, e.g. {name: infra, namespace: infra-kgateway, sectionName: http} |
| httpRoute.redirect.statusCode | int | `308` | status code of the redirect |
| httpRoute.timeouts | object | `{}` | optional HTTPRoute rule timeouts |
| image.pullPolicy | string | `"IfNotPresent"` | pullPolicy to use |
| image.repository | string | `"ghcr.io/adfinis/bbook"` | repository where the image is located |
Expand Down
22 changes: 22 additions & 0 deletions charts/bbook/templates/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,26 @@ spec:
- kind: Service
name: {{ include "bbook.fullname" . }}
port: {{ .Values.service.port }}
{{- if .Values.httpRoute.redirect.enabled }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ include "bbook.fullname" . }}-redirect
labels:
{{- include "bbook.labels" . | nindent 4 }}
spec:
hostnames:
{{- range .Values.httpRoute.hosts }}
- {{ . | quote }}
{{- end }}
parentRefs:
{{- toYaml .Values.httpRoute.redirect.parentRefs | nindent 4 }}
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: {{ .Values.httpRoute.redirect.statusCode }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/bbook/templates/trafficpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and .Values.httpRoute.enabled .Values.httpRoute.allowlist -}}
apiVersion: gateway.kgateway.dev/v1alpha1
kind: TrafficPolicy
metadata:
name: {{ include "bbook.fullname" . }}-allowlist
labels:
{{- include "bbook.labels" . | nindent 4 }}
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: {{ include "bbook.fullname" . }}
acl:
defaultAction: deny
rules:
- action: allow
cidrs:
{{- toYaml .Values.httpRoute.allowlist | nindent 10 }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/bbook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ httpRoute:
timeouts: {}
# -- optional HTTPRoute rule filters
filters: []
redirect:
# -- create a second HTTPRoute redirecting plain HTTP requests for the same hosts to HTTPS
enabled: false
# -- HTTP listeners to attach the redirect to, e.g. {name: infra, namespace: infra-kgateway, sectionName: http}
parentRefs: []
# -- status code of the redirect
statusCode: 308
# -- source CIDRs allowed to reach the route, empty allows all. Creates a kgateway TrafficPolicy and needs kgateway as the gateway implementation
allowlist: []
# - 10.0.0.0/8

# -- Pod resources to define
resources: {}
Expand Down
Loading