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: 2 additions & 2 deletions .github/workflows/chart-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Package and push
run: |
helm package ./chart
helm push theia-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
helm push eduide-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts

- name: Comment install instructions
uses: marocchino/sticky-pull-request-comment@v2
Expand All @@ -49,7 +49,7 @@ jobs:
## Chart Preview Ready

```bash
helm install test oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts/theia-shared-cache --version ${{ env.PREVIEW_VERSION }}
helm install test oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts/eduide-shared-cache --version ${{ env.PREVIEW_VERSION }}
```

_Updated: ${{ github.sha }}_
20 changes: 14 additions & 6 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
push:
branches:
- main
tags:
- 'v*'
paths:
- 'src/**'
- 'chart/**'
- '.github/workflows/docker-build.yml'
pull_request:
branches:
- main
paths:
- 'src/**'
- 'chart/**'

env:
REGISTRY: ghcr.io
Expand All @@ -34,13 +34,22 @@ jobs:
uses: docker/setup-buildx-action@v3

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

- name: Compute version tag
id: version
run: |
BASE=$(grep '^version:' chart/Chart.yaml | awk '{print $2}')
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "tag=${BASE}-pr.${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "tag=${BASE}" >> $GITHUB_OUTPUT
fi

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
Expand All @@ -49,15 +58,14 @@ jobs:
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=raw,value=${{ steps.version.outputs.tag }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./src
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
- name: Package and push to OCI
run: |
helm package ./chart
helm push theia-shared-cache-${{ steps.chart.outputs.version }}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts
helm push eduide-shared-cache-${{ steps.chart.outputs.version }}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: theia-shared-cache-${{ steps.chart.outputs.version }}
name: theia-shared-cache ${{ steps.chart.outputs.version }}
tag_name: eduide-shared-cache-${{ steps.chart.outputs.version }}
name: eduide-shared-cache ${{ steps.chart.outputs.version }}
generate_release_notes: true

11 changes: 4 additions & 7 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
apiVersion: v2
name: theia-shared-cache
description: A Gradle Build Cache server with Redis backend for Theia IDE deployments in Kubernetes
name: eduide-shared-cache
description: A Gradle Build Cache server with Redis backend for EduIDE deployments in Kubernetes

type: application

# Chart version - bump for breaking changes
version: 0.4.0

# Application version - matches the cache server version
appVersion: "0.1.0"
# Bump this version on every release — also used as the Docker image tag
version: 0.5.0

dependencies:
- name: reposilite
Expand Down
7 changes: 3 additions & 4 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{{/*
Standard labels for theia-shared-cache resources
Standard labels for eduide-shared-cache resources
*/}}
{{- define "theia-shared-cache.labels" -}}
{{- define "eduide-shared-cache.labels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
{{- end -}}

{{- define "theia-shared-cache.selectorLabels" -}}
{{- define "eduide-shared-cache.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
8 changes: 3 additions & 5 deletions chart/templates/auth-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{{- if and .Values.enabled .Values.auth.enabled }}
# Read-only cache credentials (for Theia IDE / students)
# Read-only cache credentials (for EduIDE / students)
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-cache-reader
name: {{ .Chart.Name }}-reader
labels:
app: {{ .Release.Name }}
role: reader
type: kubernetes.io/basic-auth
data:
Expand All @@ -16,9 +15,8 @@ data:
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-cache-writer
name: {{ .Chart.Name }}-writer
labels:
app: {{ .Release.Name }}
role: writer
type: kubernetes.io/basic-auth
data:
Expand Down
6 changes: 3 additions & 3 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
name: {{ .Chart.Name }}-config
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: cache-server
data:
config.yaml: |
Expand All @@ -20,7 +20,7 @@ data:
{{- end}}

storage:
addr: "{{ .Release.Name }}-redis:6379"
addr: "{{ .Chart.Name }}-redis:6379"

cache:
max_entry_size_mb: {{ .Values.cache.maxEntrySizeMB }}
Expand Down
23 changes: 11 additions & 12 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-cache-server
name: {{ .Chart.Name }}-server
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: cache-server
spec:
replicas: 1
selector:
matchLabels:
{{- include "theia-shared-cache.selectorLabels" . | nindent 6 }}
{{- include "eduide-shared-cache.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: cache-server
template:
metadata:
labels:
{{- include "theia-shared-cache.selectorLabels" . | nindent 8 }}
{{- include "eduide-shared-cache.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: cache-server
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
Expand All @@ -29,15 +29,14 @@ spec:
- -c
- |
echo "Waiting for Redis to be ready..."
until nc -z {{ .Release.Name }}-redis 6379; do
until nc -z {{ .Chart.Name }}-redis 6379; do
echo "Redis not ready, waiting..."
sleep 2
done
echo "Redis is ready!"
containers:
- name: cache-server
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
ports:
- name: http
containerPort: 8080
Expand All @@ -46,25 +45,25 @@ spec:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-redis-secret
name: {{ .Chart.Name }}-redis-secret
key: redis-password
{{- if .Values.auth.enabled }}
- name: CACHE_READER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-cache-reader
name: {{ .Chart.Name }}-reader
key: password
- name: CACHE_WRITER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-cache-writer
name: {{ .Chart.Name }}-writer
key: password
{{- end }}
args:
- --config
- /etc/gradle-cache/config.yaml
resources:
{{- toYaml .Values.resources.cacheServer | nindent 12 }}
{{- toYaml .Values.resources | nindent 12 }}
livenessProbe:
httpGet:
path: /ping
Expand Down Expand Up @@ -99,7 +98,7 @@ spec:
volumes:
- name: config
configMap:
name: {{ .Release.Name }}-config
name: {{ .Chart.Name }}-config
{{- if .Values.tls.enabled }}
- name: tls-certs
secret:
Expand Down
14 changes: 7 additions & 7 deletions chart/templates/redis-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-redis
name: {{ .Chart.Name }}-redis
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: storage
spec:
replicas: 1
selector:
matchLabels:
{{- include "theia-shared-cache.selectorLabels" . | nindent 6 }}
{{- include "eduide-shared-cache.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: storage
template:
metadata:
labels:
{{- include "theia-shared-cache.selectorLabels" . | nindent 8 }}
{{- include "eduide-shared-cache.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: storage
spec:
containers:
Expand All @@ -37,10 +37,10 @@ spec:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-redis-secret
name: {{ .Chart.Name }}-redis-secret
key: redis-password
resources:
{{- toYaml .Values.resources.redis | nindent 12 }}
{{- toYaml .Values.redis.resources | nindent 12 }}
livenessProbe:
exec:
command:
Expand Down Expand Up @@ -72,7 +72,7 @@ spec:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-redis-secret
name: {{ .Chart.Name }}-redis-secret
key: redis-password
resources:
requests:
Expand Down
6 changes: 3 additions & 3 deletions chart/templates/redis-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-redis-secret
name: {{ .Chart.Name }}-redis-secret
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: storage
type: Opaque
data:
{{- $secretName := printf "%s-redis-secret" .Release.Name }}
{{- $secretName := printf "%s-redis-secret" .Chart.Name }}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{- if $existingSecret }}
redis-password: {{ index $existingSecret.data "redis-password" }}
Expand Down
6 changes: 3 additions & 3 deletions chart/templates/redis-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-redis
name: {{ .Chart.Name }}-redis
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: storage
spec:
type: ClusterIP
Expand All @@ -18,6 +18,6 @@ spec:
targetPort: metrics
protocol: TCP
selector:
{{- include "theia-shared-cache.selectorLabels" . | nindent 4 }}
{{- include "eduide-shared-cache.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: storage
{{- end }}
21 changes: 21 additions & 0 deletions chart/templates/reposilite-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.reposilite.enabled }}
{{- $secretName := printf "%s-reposilite-secrets" .Chart.Name }}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels:
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: dependency-cache
type: Opaque
data:
adminToken: {{ printf "admin:%s" .Values.reposilite.adminToken | b64enc | quote }}
{{- if $existingSecret }}
prometheusUsername: {{ index $existingSecret.data "prometheusUsername" }}
prometheusPassword: {{ index $existingSecret.data "prometheusPassword" }}
{{- else }}
prometheusUsername: {{ "prometheus" | b64enc | quote }}
prometheusPassword: {{ randAlphaNum 32 | b64enc | quote }}
{{- end }}
{{- end }}
13 changes: 5 additions & 8 deletions chart/templates/reposilite-shared-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ConfigMap
metadata:
name: reposilite-shared-config
labels:
{{- include "theia-shared-cache.labels" . | nindent 4 }}
{{- include "eduide-shared-cache.labels" . | nindent 4 }}
app.kubernetes.io/component: dependency-cache
data:
configuration.shared.json: |
Expand All @@ -17,18 +17,15 @@ data:
"redeployment": false,
"preserveSnapshots": false,
"proxied": [
{{- range $i, $url := .Values.reposilite.proxyRepositories }}
{{- if $i }},{{ end }}
{
"reference": "https://repo1.maven.org/maven2",
"store": true,
"allowedGroups": [],
"allowedExtensions": [".jar", ".war", ".xml", ".pom", ".module", ".asc", ".md5", ".sha1", ".sha256", ".sha512"]
},
{
"reference": "https://plugins.gradle.org/m2",
"reference": "{{ $url }}",
"store": true,
"allowedGroups": [],
"allowedExtensions": [".jar", ".war", ".xml", ".pom", ".module", ".asc", ".md5", ".sha1", ".sha256", ".sha512"]
}
{{- end }}
]
}
]
Expand Down
Loading
Loading