Skip to content

Commit 60e44b1

Browse files
Feat/bazel (#35)
* add bazel * Bump Chart version * Update Bazel put * helm improvements * add service monitor to chart
1 parent 92984f3 commit 60e44b1

17 files changed

Lines changed: 207 additions & 105 deletions

.github/workflows/chart-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Package and push
4040
run: |
4141
helm package ./chart
42-
helm push theia-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
42+
helm push eduide-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
4343
4444
- name: Comment install instructions
4545
uses: marocchino/sticky-pull-request-comment@v2
@@ -49,7 +49,7 @@ jobs:
4949
## Chart Preview Ready
5050
5151
```bash
52-
helm install test oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts/theia-shared-cache --version ${{ env.PREVIEW_VERSION }}
52+
helm install test oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts/eduide-shared-cache --version ${{ env.PREVIEW_VERSION }}
5353
```
5454
5555
_Updated: ${{ github.sha }}_

.github/workflows/docker-build.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- 'v*'
97
paths:
108
- 'src/**'
9+
- 'chart/**'
1110
- '.github/workflows/docker-build.yml'
1211
pull_request:
1312
branches:
1413
- main
1514
paths:
1615
- 'src/**'
16+
- 'chart/**'
1717

1818
env:
1919
REGISTRY: ghcr.io
@@ -34,13 +34,22 @@ jobs:
3434
uses: docker/setup-buildx-action@v3
3535

3636
- name: Log in to Container Registry
37-
if: github.event_name != 'pull_request'
3837
uses: docker/login-action@v3
3938
with:
4039
registry: ${{ env.REGISTRY }}
4140
username: ${{ github.actor }}
4241
password: ${{ secrets.GITHUB_TOKEN }}
4342

43+
- name: Compute version tag
44+
id: version
45+
run: |
46+
BASE=$(grep '^version:' chart/Chart.yaml | awk '{print $2}')
47+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
48+
echo "tag=${BASE}-pr.${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
49+
else
50+
echo "tag=${BASE}" >> $GITHUB_OUTPUT
51+
fi
52+
4453
- name: Extract metadata (tags, labels)
4554
id: meta
4655
uses: docker/metadata-action@v5
@@ -49,15 +58,14 @@ jobs:
4958
tags: |
5059
type=ref,event=branch
5160
type=ref,event=pr
52-
type=semver,pattern={{version}}
53-
type=semver,pattern={{major}}.{{minor}}
5461
type=sha,prefix=
62+
type=raw,value=${{ steps.version.outputs.tag }}
5563
5664
- name: Build and push Docker image
5765
uses: docker/build-push-action@v5
5866
with:
5967
context: ./src
60-
push: ${{ github.event_name != 'pull_request' }}
68+
push: true
6169
tags: ${{ steps.meta.outputs.tags }}
6270
labels: ${{ steps.meta.outputs.labels }}
6371
cache-from: type=gha

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ jobs:
4141
- name: Package and push to OCI
4242
run: |
4343
helm package ./chart
44-
helm push theia-shared-cache-${{ steps.chart.outputs.version }}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
44+
helm push eduide-shared-cache-${{ steps.chart.outputs.version }}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
4545
4646
- name: Create GitHub Release
4747
uses: softprops/action-gh-release@v2
4848
with:
49-
tag_name: theia-shared-cache-${{ steps.chart.outputs.version }}
50-
name: theia-shared-cache ${{ steps.chart.outputs.version }}
49+
tag_name: eduide-shared-cache-${{ steps.chart.outputs.version }}
50+
name: eduide-shared-cache ${{ steps.chart.outputs.version }}
5151
generate_release_notes: true
5252

chart/Chart.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
apiVersion: v2
2-
name: theia-shared-cache
3-
description: A Gradle Build Cache server with Redis backend for Theia IDE deployments in Kubernetes
2+
name: eduide-shared-cache
3+
description: A Gradle Build Cache server with Redis backend for EduIDE deployments in Kubernetes
44

55
type: application
66

7-
# Chart version - bump for breaking changes
8-
version: 0.4.0
9-
10-
# Application version - matches the cache server version
11-
appVersion: "0.1.0"
7+
# Bump this version on every release — also used as the Docker image tag
8+
version: 0.5.0
129

1310
dependencies:
1411
- name: reposilite

chart/templates/_helpers.tpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{{/*
2-
Standard labels for theia-shared-cache resources
2+
Standard labels for eduide-shared-cache resources
33
*/}}
4-
{{- define "theia-shared-cache.labels" -}}
4+
{{- define "eduide-shared-cache.labels" -}}
55
app.kubernetes.io/name: {{ .Chart.Name }}
6-
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
76
app.kubernetes.io/instance: {{ .Release.Name }}
87
app.kubernetes.io/managed-by: {{ .Release.Service }}
98
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
109
{{- end -}}
1110

12-
{{- define "theia-shared-cache.selectorLabels" -}}
11+
{{- define "eduide-shared-cache.selectorLabels" -}}
1312
app.kubernetes.io/name: {{ .Chart.Name }}
1413
app.kubernetes.io/instance: {{ .Release.Name }}
1514
{{- end -}}

chart/templates/auth-secrets.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{{- if and .Values.enabled .Values.auth.enabled }}
2-
# Read-only cache credentials (for Theia IDE / students)
2+
# Read-only cache credentials (for EduIDE / students)
33
apiVersion: v1
44
kind: Secret
55
metadata:
6-
name: {{ .Release.Name }}-cache-reader
6+
name: {{ .Chart.Name }}-reader
77
labels:
8-
app: {{ .Release.Name }}
98
role: reader
109
type: kubernetes.io/basic-auth
1110
data:
@@ -16,9 +15,8 @@ data:
1615
apiVersion: v1
1716
kind: Secret
1817
metadata:
19-
name: {{ .Release.Name }}-cache-writer
18+
name: {{ .Chart.Name }}-writer
2019
labels:
21-
app: {{ .Release.Name }}
2220
role: writer
2321
type: kubernetes.io/basic-auth
2422
data:

chart/templates/configmap.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:
5-
name: {{ .Release.Name }}-config
5+
name: {{ .Chart.Name }}-config
66
labels:
7-
{{- include "theia-shared-cache.labels" . | nindent 4 }}
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
88
app.kubernetes.io/component: cache-server
99
data:
1010
config.yaml: |
@@ -20,7 +20,7 @@ data:
2020
{{- end}}
2121
2222
storage:
23-
addr: "{{ .Release.Name }}-redis:6379"
23+
addr: "{{ .Chart.Name }}-redis:6379"
2424
2525
cache:
2626
max_entry_size_mb: {{ .Values.cache.maxEntrySizeMB }}

chart/templates/deployment.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ .Release.Name }}-cache-server
5+
name: {{ .Chart.Name }}-server
66
labels:
7-
{{- include "theia-shared-cache.labels" . | nindent 4 }}
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
88
app.kubernetes.io/component: cache-server
99
spec:
1010
replicas: 1
1111
selector:
1212
matchLabels:
13-
{{- include "theia-shared-cache.selectorLabels" . | nindent 6 }}
13+
{{- include "eduide-shared-cache.selectorLabels" . | nindent 6 }}
1414
app.kubernetes.io/component: cache-server
1515
template:
1616
metadata:
1717
labels:
18-
{{- include "theia-shared-cache.selectorLabels" . | nindent 8 }}
18+
{{- include "eduide-shared-cache.selectorLabels" . | nindent 8 }}
1919
app.kubernetes.io/component: cache-server
2020
annotations:
2121
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
@@ -29,15 +29,14 @@ spec:
2929
- -c
3030
- |
3131
echo "Waiting for Redis to be ready..."
32-
until nc -z {{ .Release.Name }}-redis 6379; do
32+
until nc -z {{ .Chart.Name }}-redis 6379; do
3333
echo "Redis not ready, waiting..."
3434
sleep 2
3535
done
3636
echo "Redis is ready!"
3737
containers:
3838
- name: cache-server
39-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
40-
imagePullPolicy: {{ .Values.image.pullPolicy }}
39+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
4140
ports:
4241
- name: http
4342
containerPort: 8080
@@ -46,25 +45,25 @@ spec:
4645
- name: REDIS_PASSWORD
4746
valueFrom:
4847
secretKeyRef:
49-
name: {{ .Release.Name }}-redis-secret
48+
name: {{ .Chart.Name }}-redis-secret
5049
key: redis-password
5150
{{- if .Values.auth.enabled }}
5251
- name: CACHE_READER_PASSWORD
5352
valueFrom:
5453
secretKeyRef:
55-
name: {{ .Release.Name }}-cache-reader
54+
name: {{ .Chart.Name }}-reader
5655
key: password
5756
- name: CACHE_WRITER_PASSWORD
5857
valueFrom:
5958
secretKeyRef:
60-
name: {{ .Release.Name }}-cache-writer
59+
name: {{ .Chart.Name }}-writer
6160
key: password
6261
{{- end }}
6362
args:
6463
- --config
6564
- /etc/gradle-cache/config.yaml
6665
resources:
67-
{{- toYaml .Values.resources.cacheServer | nindent 12 }}
66+
{{- toYaml .Values.resources | nindent 12 }}
6867
livenessProbe:
6968
httpGet:
7069
path: /ping
@@ -99,7 +98,7 @@ spec:
9998
volumes:
10099
- name: config
101100
configMap:
102-
name: {{ .Release.Name }}-config
101+
name: {{ .Chart.Name }}-config
103102
{{- if .Values.tls.enabled }}
104103
- name: tls-certs
105104
secret:

chart/templates/redis-deployment.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ .Release.Name }}-redis
5+
name: {{ .Chart.Name }}-redis
66
labels:
7-
{{- include "theia-shared-cache.labels" . | nindent 4 }}
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
88
app.kubernetes.io/component: storage
99
spec:
1010
replicas: 1
1111
selector:
1212
matchLabels:
13-
{{- include "theia-shared-cache.selectorLabels" . | nindent 6 }}
13+
{{- include "eduide-shared-cache.selectorLabels" . | nindent 6 }}
1414
app.kubernetes.io/component: storage
1515
template:
1616
metadata:
1717
labels:
18-
{{- include "theia-shared-cache.selectorLabels" . | nindent 8 }}
18+
{{- include "eduide-shared-cache.selectorLabels" . | nindent 8 }}
1919
app.kubernetes.io/component: storage
2020
spec:
2121
containers:
@@ -37,10 +37,10 @@ spec:
3737
- name: REDIS_PASSWORD
3838
valueFrom:
3939
secretKeyRef:
40-
name: {{ .Release.Name }}-redis-secret
40+
name: {{ .Chart.Name }}-redis-secret
4141
key: redis-password
4242
resources:
43-
{{- toYaml .Values.resources.redis | nindent 12 }}
43+
{{- toYaml .Values.redis.resources | nindent 12 }}
4444
livenessProbe:
4545
exec:
4646
command:
@@ -72,7 +72,7 @@ spec:
7272
- name: REDIS_PASSWORD
7373
valueFrom:
7474
secretKeyRef:
75-
name: {{ .Release.Name }}-redis-secret
75+
name: {{ .Chart.Name }}-redis-secret
7676
key: redis-password
7777
resources:
7878
requests:

chart/templates/redis-secret.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
apiVersion: v1
33
kind: Secret
44
metadata:
5-
name: {{ .Release.Name }}-redis-secret
5+
name: {{ .Chart.Name }}-redis-secret
66
labels:
7-
{{- include "theia-shared-cache.labels" . | nindent 4 }}
7+
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
88
app.kubernetes.io/component: storage
99
type: Opaque
1010
data:
11-
{{- $secretName := printf "%s-redis-secret" .Release.Name }}
11+
{{- $secretName := printf "%s-redis-secret" .Chart.Name }}
1212
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }}
1313
{{- if $existingSecret }}
1414
redis-password: {{ index $existingSecret.data "redis-password" }}

0 commit comments

Comments
 (0)