Skip to content

Commit 5524389

Browse files
gateway api impl (#36)
1 parent 60e44b1 commit 5524389

5 files changed

Lines changed: 128 additions & 1 deletion

File tree

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: A Gradle Build Cache server with Redis backend for EduIDE deploymen
55
type: application
66

77
# Bump this version on every release — also used as the Docker image tag
8-
version: 0.5.0
8+
version: 0.5.2
99

1010
dependencies:
1111
- name: reposilite

chart/templates/_helpers.tpl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,31 @@ helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1212
app.kubernetes.io/name: {{ .Chart.Name }}
1313
app.kubernetes.io/instance: {{ .Release.Name }}
1414
{{- end -}}
15+
16+
{{/*
17+
Resolve the cache hostname: explicit gateway.cache.hostname wins,
18+
otherwise derive `cache.<gateway.baseHost>`.
19+
*/}}
20+
{{- define "eduide-shared-cache.cacheHostname" -}}
21+
{{- if .Values.gateway.cache.hostname -}}
22+
{{ .Values.gateway.cache.hostname }}
23+
{{- else if .Values.gateway.baseHost -}}
24+
cache.{{ .Values.gateway.baseHost }}
25+
{{- else -}}
26+
{{ fail "Set gateway.baseHost or gateway.cache.hostname" }}
27+
{{- end -}}
28+
{{- end -}}
29+
30+
{{/*
31+
Resolve the repo hostname: explicit gateway.repo.hostname wins,
32+
otherwise derive `repo.<gateway.baseHost>`.
33+
*/}}
34+
{{- define "eduide-shared-cache.repoHostname" -}}
35+
{{- if .Values.gateway.repo.hostname -}}
36+
{{ .Values.gateway.repo.hostname }}
37+
{{- else if .Values.gateway.baseHost -}}
38+
repo.{{ .Values.gateway.baseHost }}
39+
{{- else -}}
40+
{{ fail "Set gateway.baseHost or gateway.repo.hostname" }}
41+
{{- end -}}
42+
{{- end -}}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.gateway.enabled }}
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: HTTPRoute
4+
metadata:
5+
name: {{ .Chart.Name }}-cache
6+
labels:
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: cache-server
9+
spec:
10+
parentRefs:
11+
{{- if .Values.gateway.parentRefs.cache }}
12+
{{- toYaml .Values.gateway.parentRefs.cache | nindent 4 }}
13+
{{- else }}
14+
{{- fail "gateway.parentRefs.cache must be set when gateway.enabled is true" }}
15+
{{- end }}
16+
hostnames:
17+
- {{ include "eduide-shared-cache.cacheHostname" . | quote }}
18+
rules:
19+
- matches:
20+
- path:
21+
type: PathPrefix
22+
value: /
23+
backendRefs:
24+
- name: {{ .Chart.Name }}
25+
port: 8080
26+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if and .Values.gateway.enabled .Values.reposilite.enabled }}
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: HTTPRoute
4+
metadata:
5+
name: {{ .Chart.Name }}-repo
6+
labels:
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: dependency-cache
9+
spec:
10+
parentRefs:
11+
{{- if .Values.gateway.parentRefs.repo }}
12+
{{- toYaml .Values.gateway.parentRefs.repo | nindent 4 }}
13+
{{- else }}
14+
{{- fail "gateway.parentRefs.repo must be set when gateway.enabled is true and reposilite.enabled is true" }}
15+
{{- end }}
16+
hostnames:
17+
- {{ include "eduide-shared-cache.repoHostname" . | quote }}
18+
rules:
19+
- matches:
20+
- path:
21+
type: PathPrefix
22+
value: /
23+
backendRefs:
24+
- name: {{ .Values.reposilite.fullnameOverride | default (printf "%s-reposilite" .Release.Name) }}
25+
port: 8080
26+
{{- end }}

chart/values.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,49 @@ tls:
3333
# Kubernetes secret name containing tls.crt and tls.key
3434
secretName: ""
3535

36+
# ============================================================
37+
# Gateway API (HTTPRoutes only)
38+
# ============================================================
39+
#
40+
# This chart does NOT create a Gateway. It expects one to already exist
41+
# (e.g. the shared `theia-shared-gateway` in the `gateway-system` namespace)
42+
# with listeners configured for the hostnames below.
43+
#
44+
# Before installing with gateway.enabled=true, the cluster operator must:
45+
# 1. Add a listener per hostname on the shared Gateway, each with a TLS cert.
46+
# 2. Point DNS for those hostnames at the shared Gateway's load balancer IP.
47+
48+
gateway:
49+
# -- Render HTTPRoute resources. Disable to skip all Gateway API wiring.
50+
enabled: false
51+
52+
# -- Environment base host. Hostnames default to:
53+
# cache.<baseHost> and repo.<baseHost>
54+
# e.g. baseHost: test2.theia-test.artemis.cit.tum.de
55+
baseHost: ""
56+
57+
# -- parentRefs for the HTTPRoutes. Each route attaches to one listener
58+
# on the shared Gateway via `sectionName`. The listener's hostname on
59+
# the Gateway must match the route's effective hostname.
60+
# Example:
61+
# cache:
62+
# - name: theia-shared-gateway
63+
# namespace: gateway-system
64+
# sectionName: test2-cache
65+
# repo:
66+
# - name: theia-shared-gateway
67+
# namespace: gateway-system
68+
# sectionName: test2-repo
69+
parentRefs:
70+
cache: []
71+
repo: []
72+
73+
# -- Optional explicit hostname overrides. Leave empty to derive from baseHost.
74+
cache:
75+
hostname: ""
76+
repo:
77+
hostname: ""
78+
3679
resources:
3780
requests:
3881
memory: "256Mi"
@@ -70,6 +113,10 @@ monitoring:
70113
reposilite:
71114
enabled: true
72115

116+
# Override the full name of the Reposilite release (controls the service name).
117+
# The HTTPRoute backend ref uses this same value.
118+
fullnameOverride: "eduide-shared-cache-reposilite"
119+
73120
# Admin access token for Reposilite management
74121
adminToken: "changeme"
75122

0 commit comments

Comments
 (0)