Add maintained visual-studio-code Helm chart
This commit is contained in:
@@ -0,0 +1,86 @@
|
|||||||
|
name: Validate, publish and promote visual-studio-code
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
HELM_VERSION: v4.2.2
|
||||||
|
CHART_NAME: visual-studio-code
|
||||||
|
GITOPS_REPOSITORY: feedc0de/homelab-gitops
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: azure/setup-helm@v4
|
||||||
|
with:
|
||||||
|
version: ${{ env.HELM_VERSION }}
|
||||||
|
- run: ./test.sh
|
||||||
|
|
||||||
|
publish:
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
needs: validate
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: azure/setup-helm@v4
|
||||||
|
with:
|
||||||
|
version: ${{ env.HELM_VERSION }}
|
||||||
|
- name: Publish chart
|
||||||
|
env:
|
||||||
|
PACKAGE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
CHART_VERSION=$(./scripts/chart-version.sh)
|
||||||
|
install -d dist
|
||||||
|
helm package "chart/${CHART_NAME}" --destination dist --version "${CHART_VERSION}"
|
||||||
|
curl --fail-with-body \
|
||||||
|
--user "${PACKAGE_USERNAME}:${PACKAGE_TOKEN}" \
|
||||||
|
--request POST \
|
||||||
|
--upload-file "dist/${CHART_NAME}-${CHART_VERSION}.tgz" \
|
||||||
|
https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
|
||||||
|
printf 'CHART_VERSION=%s\n' "${CHART_VERSION}" >> "${GITHUB_ENV}"
|
||||||
|
- name: Check that this is still current main
|
||||||
|
id: current-main
|
||||||
|
env:
|
||||||
|
COMMIT_SHA: ${{ gitea.sha }}
|
||||||
|
run: |
|
||||||
|
git fetch --no-tags origin main
|
||||||
|
if [ "$(git rev-parse FETCH_HEAD)" = "${COMMIT_SHA}" ]; then
|
||||||
|
echo 'promote=true' >> "${GITEA_OUTPUT}"
|
||||||
|
else
|
||||||
|
echo 'promote=false' >> "${GITEA_OUTPUT}"
|
||||||
|
fi
|
||||||
|
- name: Check out GitOps
|
||||||
|
if: steps.current-main.outputs.promote == 'true'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ env.GITOPS_REPOSITORY }}
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.GITOPS_TOKEN }}
|
||||||
|
path: homelab-gitops
|
||||||
|
- name: Promote exact chart version
|
||||||
|
if: steps.current-main.outputs.promote == 'true'
|
||||||
|
working-directory: homelab-gitops
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
./scripts/update-chart-version.sh "${CHART_NAME}" "${CHART_VERSION}"
|
||||||
|
git config user.name feedc0de
|
||||||
|
git config user.email feedc0de@users.noreply.code.brunner.ninja
|
||||||
|
git add "bootstrap/${CHART_NAME}.yaml"
|
||||||
|
if git diff --cached --quiet; then exit 0; fi
|
||||||
|
git commit -m "Deploy ${CHART_NAME} chart ${CHART_VERSION}"
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if git push origin HEAD:main; then exit 0; fi
|
||||||
|
test "${attempt}" != 3
|
||||||
|
git fetch origin main
|
||||||
|
git rebase origin/main
|
||||||
|
done
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# code-server Helm chart
|
||||||
|
|
||||||
|
This repository maintains the public `visual-studio-code` Helm chart.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
helm repo add brunner.ninja https://brunner.ninja/charts
|
||||||
|
helm repo update brunner.ninja
|
||||||
|
helm upgrade --install visual-studio-code brunner.ninja/visual-studio-code
|
||||||
|
```
|
||||||
|
|
||||||
|
Git tags version the chart. A `v1.0.0` tag publishes chart `1.0.0`; later
|
||||||
|
commits publish immutable versions such as `1.0.0-1-gabcdef0` using
|
||||||
|
`git describe --tags --long`.
|
||||||
|
|
||||||
|
Homelab-specific values live in
|
||||||
|
[`homelab-gitops/apps/visual-studio-code`](https://code.brunner.ninja/feedc0de/homelab-gitops/src/branch/main/apps/visual-studio-code).
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: visual-studio-code
|
||||||
|
description: Kubernetes deployment for Coder code-server
|
||||||
|
type: application
|
||||||
|
version: 0.1.0
|
||||||
|
appVersion: 4.141.0
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: visual-studio-code
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels: {app: visual-studio-code}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels: {app: visual-studio-code}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
containers:
|
||||||
|
- name: visual-studio-code
|
||||||
|
image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) | quote }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
args: {{- toYaml .Values.args | nindent 8 }}
|
||||||
|
ports: [{name: http, containerPort: 8080}]
|
||||||
|
startupProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
failureThreshold: 30
|
||||||
|
periodSeconds: 2
|
||||||
|
readinessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 30
|
||||||
|
resources: {{- toYaml .Values.resources | nindent 10 }}
|
||||||
|
{{- with .Values.persistence.mounts }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- range . }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
mountPath: {{ .mountPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.persistence.mounts }}
|
||||||
|
volumes:
|
||||||
|
{{- range . }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
persistentVolumeClaim: {claimName: "{{ .claimName }}"}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: visual-studio-code
|
||||||
|
spec:
|
||||||
|
ports: [{name: http, port: 80, protocol: TCP, targetPort: http}]
|
||||||
|
selector: {app: visual-studio-code}
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: visual-studio-code
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations: {{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ingressClassName: {{ .Values.ingress.className }}
|
||||||
|
rules:
|
||||||
|
- host: {{ .Values.ingress.host }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service: {name: visual-studio-code, port: {name: http}}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
image:
|
||||||
|
repository: ghcr.io/coder/code-server
|
||||||
|
tag: ""
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
args: [--auth, none]
|
||||||
|
persistence:
|
||||||
|
mounts: []
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
host: code.example.com
|
||||||
|
annotations: {}
|
||||||
|
resources: {}
|
||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
namespace=${NAMESPACE:-default}
|
||||||
|
release=${RELEASE_NAME:-visual-studio-code}
|
||||||
|
helm repo add brunner.ninja https://brunner.ninja/charts --force-update
|
||||||
|
helm repo update brunner.ninja
|
||||||
|
helm upgrade --install "$release" brunner.ninja/visual-studio-code \
|
||||||
|
--namespace "$namespace" --create-namespace \
|
||||||
|
--wait --timeout 10m "$@"
|
||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
description=$(git describe --tags --long --match 'v[0-9]*')
|
||||||
|
version=${description#v}
|
||||||
|
case "$version" in
|
||||||
|
*-0-g*) version=${version%%-0-g*} ;;
|
||||||
|
esac
|
||||||
|
printf '%s\n' "$version"
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
chart="chart/visual-studio-code"
|
||||||
|
helm lint "$chart"
|
||||||
|
rendered=$(mktemp)
|
||||||
|
trap 'rm -f "$rendered"' EXIT
|
||||||
|
helm template visual-studio-code "$chart" > "$rendered"
|
||||||
|
grep -q '^kind: Deployment$' "$rendered"
|
||||||
|
grep -q '^kind: Service$' "$rendered"
|
||||||
Reference in New Issue
Block a user