Skip to content

Commit

Permalink
feat: add routing
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Jan 28, 2025
1 parent c9f1274 commit 7b61158
Show file tree
Hide file tree
Showing 30 changed files with 2,340 additions and 826 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ schema:
helm-schema -n -c charts/beam
helm-schema -n -c charts/namespace
helm-schema -n -c charts/sesamy-gtm
helm-schema -n -c charts/sesamy-umami
helm-schema -n -c charts/gateway-crds
helm-schema -n -c charts/contentserver
helm-schema -n -c charts/squadron-keel-server
helm-schema -n -c charts/squadron-keel-cronjob
helm-schema -n -c charts/squadron-nextjs-server
helm schema-gen charts/csp-reporter/values.yaml > charts/csp-reporter/values.schema.json
helm schema-gen charts/sesamy-umami/values.yaml > charts/sesamy-umami/values.schema.json
#@set -e; for dir in ./charts/* ; do \
# helm-schema -n -c $${dir} ;\
#done
Expand Down
2 changes: 1 addition & 1 deletion charts/contentserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ annotations:
- name: Image Source
url: https://github.com/foomo/contentserver
version: 0.1.1
version: 0.2.0
appVersion: 1.11.2
10 changes: 9 additions & 1 deletion charts/contentserver/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# contentserver

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.2](https://img.shields.io/badge/AppVersion-1.11.2-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.2](https://img.shields.io/badge/AppVersion-1.11.2-informational?style=flat-square)

Helm chart for the foomo Content Server.

Expand Down Expand Up @@ -138,6 +138,14 @@ Helm chart for the foomo Content Server.
| revisionHistoryLimit | int | `10` | Number of revisions to keep |
| updateStrategy | string | `"RollingUpdate"` | Deployment update strategy |

### Routing

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| routing.enabled | bool | `false` | Indicates wether routing is enabled or not |
| routing.parentRefs | list | `[]` | Parent references |
| routing.paths | list | `[]` | Path matches |

### Scheduling

| Key | Type | Default | Description |
Expand Down
22 changes: 22 additions & 0 deletions charts/contentserver/templates/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.routing.enabled }}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ include "contentserver.fullname" . }}
labels: {{- include "contentserver.labels" . | nindent 4 }}
namespace: {{ include "contentserver.namespace" . }}
spec:
{{- with .Values.routing.parentRefs }}
parentRefs: {{ toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range .Values.routing.paths }}
- matches:
- path:
type: {{ default .pathType "PathPrefix" }}
value: {{ .path }}
backendRefs:
- name: {{ include "contentserver.fullname" $ }}
port: {{ .port }}
{{- end }}
{{- end }}
38 changes: 38 additions & 0 deletions charts/contentserver/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,44 @@
"title": "revisionHistoryLimit",
"type": "integer"
},
"routing": {
"additionalProperties": false,
"description": "Routing settings",
"properties": {
"enabled": {
"default": false,
"description": "Indicates wether routing is enabled or not",
"required": [],
"title": "enabled",
"type": "boolean"
},
"parentRefs": {
"description": "Parent references",
"items": {
"additionalProperties": true,
"required": [],
"type": "object"
},
"required": [],
"title": "parentRefs",
"type": "array"
},
"paths": {
"description": "Path matches",
"items": {
"additionalProperties": true,
"required": [],
"type": "object"
},
"required": [],
"title": "paths",
"type": "array"
}
},
"required": [],
"title": "routing",
"type": "object"
},
"scheduling": {
"additionalProperties": false,
"description": "Scheduling settings",
Expand Down
30 changes: 30 additions & 0 deletions charts/contentserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,36 @@ ingress:
# hosts:
# - chart-example.local

# @schema
# type: object
# @schema
# Routing settings
routing:
# @schema
# type: boolean
# @schema
# -- Indicates wether routing is enabled or not
# @section -- Routing
enabled: false
# @schema
# type: array
# items:
# type: object
# additionalProperties: true
# @schema
# -- Path matches
# @section -- Routing
paths: []
# @schema
# type: array
# items:
# type: object
# additionalProperties: true
# @schema
# -- Parent references
# @section -- Routing
parentRefs: []

# @schema
# type: object
# @schema
Expand Down
2 changes: 1 addition & 1 deletion charts/sesamy-gtm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ annotations:
url: https://github.com/foomo/helm-charts/tree/main/charts/sesamy-gtm
- name: GTM Changelog
url: https://developers.google.com/tag-platform/tag-manager/server-side/release-notes
version: 0.1.3
version: 0.2.0
appVersion: 2.4.0
21 changes: 12 additions & 9 deletions charts/sesamy-gtm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sesamy-gtm

![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.4.0](https://img.shields.io/badge/AppVersion-2.4.0-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.4.0](https://img.shields.io/badge/AppVersion-2.4.0-informational?style=flat-square)

Helm chart for the Sesamy GTM tagging & preview service.

Expand Down Expand Up @@ -93,8 +93,8 @@ Helm chart for the Sesamy GTM tagging & preview service.
| ingress.annotations | object | `{}` | Annotations |
| ingress.className | string | `""` | Ingress class name |
| ingress.enabled | bool | `false` | Enable ingress |
| ingress.hosts | list | `["example.com"]` | Hosts to listen to |
| ingress.paths | object | `{"preview":[{"path":"/gtm","pathType":"Prefix","port":8080}],"tagging":[{"path":"/gtm.js","pathType":"Exact","port":8080},{"path":"/gtag/js","pathType":"Prefix","port":8080},{"path":"/g/collect","pathType":"Prefix","port":8080}]}` | Path settings |
| ingress.hosts | list | `[]` | Hosts to listen to |
| ingress.paths | object | `{"preview":[{"path":"/gtm","pathType":"Prefix","port":8080}],"tagging":[{"path":"/gtm.js","pathType":"Exact","port":8080},{"path":"/_set_cookie","pathType":"Exact","port":8080},{"path":"/gtag/js","pathType":"Prefix","port":8080},{"path":"/g/collect","pathType":"Prefix","port":8080}]}` | Path settings |
| ingress.tls | list | `[]` | Tls setttings |

### Network Policy
Expand Down Expand Up @@ -163,6 +163,14 @@ Helm chart for the Sesamy GTM tagging & preview service.
| revisionHistoryLimit | int | `10` | Number of revisions to keep |
| updateStrategy | string | `"RollingUpdate"` | Deployment update strategy |

### Routing

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| routing.enabled | bool | `false` | Indicates wether routing is enabled or not |
| routing.parentRefs | list | `[]` | Parent references |
| routing.paths | object | `{"preview":[{"path":"/gtm","pathType":"PathPrefix","port":8080}],"tagging":[{"path":"/gtm.js","pathType":"Exact","port":8080},{"path":"/_set_cookie","pathType":"Exact","port":8080},{"path":"/gtag/js","pathType":"PathPrefix","port":8080},{"path":"/g/collect","pathType":"PathPrefix","port":8080}]}` | Path matches |

### Scheduling

| Key | Type | Default | Description |
Expand Down Expand Up @@ -192,6 +200,7 @@ Helm chart for the Sesamy GTM tagging & preview service.
| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels |
| serviceMonitor.metricRelabelings | list | `[]` | ServiceMonitor metric relabel configs to apply to samples before ingestion |
| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabel configs to apply to samples before scraping |
| serviceMonitor.scrapeTimeout | string | `""` | ServiceMonitor scrape timeout in Go duration format (e.g. 15s) |
| serviceMonitor.targetLabels | list | `[]` | ServiceMonitor will add labels from the service to the Prometheus metric |

### Tagging
Expand Down Expand Up @@ -222,9 +231,3 @@ Helm chart for the Sesamy GTM tagging & preview service.
| tagging.service.type | string | `"ClusterIP"` | Type of the service |
| tagging.startupProbe | object | `{"httpGet":{"path":"/healthz","port":"http"}}` | Liveness probe settings for pods |

### Other Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| serviceMonitor.scrapeTimeout | string | `""` | ServiceMonitor scrape timeout in Go duration format (e.g. 15s) |

25 changes: 25 additions & 0 deletions charts/sesamy-gtm/templates/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.routing.enabled }}
{{- $fullName := include "sesamy.gtm.fullname" . -}}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
labels: {{- include "sesamy.gtm.labels" . | nindent 4 }}
namespace: {{ include "sesamy.gtm.namespace" . }}
spec:
{{- with .Values.routing.parentRefs }}
parentRefs: {{ toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range $svcName, $paths := $.Values.routing.paths }}
{{- range $paths }}
- matches:
- path:
type: {{ default .pathType "PathPrefix" }}
value: {{ .path }}
backendRefs:
- name: {{ include "sesamy.gtm.fullname" $ }}-{{ $svcName }}
port: {{ .port }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 2 additions & 4 deletions charts/sesamy-gtm/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "sesamy.gtm.labels" . | nindent 4 }}
labels: {{- include "sesamy.gtm.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "sesamy.gtm.namespace" . }}
spec:
Expand Down
Loading

0 comments on commit 7b61158

Please sign in to comment.