Skip to content

Commit

Permalink
make(helm): fix http route
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoreiradj committed Jun 18, 2024
1 parent e5d4a28 commit f7de395
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 5 deletions.
24 changes: 24 additions & 0 deletions helm/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
httpRoute:
enabled: true
parentRefs:
- name: default-gw
namespace: kube-system
sectionName: https-0
hostnames:
- monitoring.moreiradj.net
rules:
- matches:
- path:
type: PathPrefix
value: /
filters:
- type: ResponseHeaderModifier
responseHeaderModifier:
add:
- name: PROTOCOL
value: HTTPS-Secure
- type: RequestHeaderModifier
requestHeaderModifier:
add:
- name: PROTOCOL
value: HTTPS-Secure
38 changes: 38 additions & 0 deletions helm/frontend/templates/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.httpRoute.enabled -}}
{{- $fullName := include "frontend.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
labels:
{{- include "frontend.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
parentRefs:
{{- with .Values.httpRoute.parentRefs }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.httpRoute.hostnames }}
hostnames:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range .Values.httpRoute.rules }}
{{- with .matches }}
- matches:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .filters }}
filters:
{{- toYaml . | nindent 8 }}
{{- end }}
backendRefs:
- name: {{ $fullName }}
port: {{ $svcPort }}
weight: 1
{{- end }}
{{- end }}
36 changes: 36 additions & 0 deletions helm/frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,42 @@ ingress:
# hosts:
# - chart-example.local

# -- How the service is exposed via gateway-apis HTTPRoute.
httpRoute:
# -- HTTPRoute enabled.
enabled: false
# -- HTTPRoute annotations.
annotations: {}
# -- Which Gateways this Route is attached to
parentRefs:
- name: gateway
sectionName: http
# namespace: default
# -- Hostnames matching HTTP header.
hostnames:
- chart-example.local
# -- List of rules and filters applied.
rules:
- matches:
- path:
type: PathPrefix
value: /
# filters:
# - type: RequestHeaderModifier
# requestHeaderModifier:
# set:
# - name: My-Overwrite-Header
# value: this-is-the-only-value
# remove:
# - User-Agent
# - matches:
# - path:
# type: PathPrefix
# value: /echo
# headers:
# - name: version
# value: v2

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down
11 changes: 6 additions & 5 deletions helmfile.yaml → helm/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ releases:
value: local-path

- name: person
chart: ./helm/person
chart: ./person
version: 0.1.0
namespace: observability
set:
- name: postgres.host
value: postgres-postgresql
values:
- ./person.yaml

- name: frontend
chart: ./helm/frontend
chart: ./frontend
version: 0.1.0
namespace: observability
values:
- ./frontend.yaml
2 changes: 2 additions & 0 deletions helm/person.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
postgres:
host: postgres-postgresql

0 comments on commit f7de395

Please # to comment.