Skip to content

Commit dfd92fc

Browse files
committed
Add helm chart including debug features
first pass at helm chart for fastcs instances fix service name better port exposure for service.yaml add helm chart publishing remove service account creation from helm switch to using Charts folder with subfolders for charts add schema for fastcs-instance chart values.yaml publish chart values schemas publish chart values schemas add schema generation to pre-commit fixing the fastcs-instance chart schema add debug features to helm chart repair incorrect helm chart debug now working fix non-debug mode fix incorrect terminationGracePeriodSeconds add debug entrypoint move initCommand into values rename charts to remove "instance"
1 parent 1294694 commit dfd92fc

File tree

18 files changed

+1374
-2
lines changed

18 files changed

+1374
-2
lines changed

.github/workflows/_helm.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Package helm charts
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
HELM_VERSION_TO_INSTALL: 3.14.3
8+
9+
jobs:
10+
package-helm-charts:
11+
name: Package and Push Helm Chart
12+
runs-on: ubuntu-latest
13+
environment: release
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Install helm
21+
uses: Azure/setup-helm@v3
22+
with:
23+
version: ${{ env.HELM_VERSION_TO_INSTALL }}
24+
25+
# Check that alpha/beta versions have the form X.Y.Z-alpha.A requried by Helm.
26+
# An early check saves waiting for the entire build before finding a problem.
27+
- name: Check helm version tag
28+
if: ${{ github.ref_type == 'tag' }}
29+
env:
30+
VERSION: "${{ github.ref_name }}"
31+
run: |
32+
if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha|-beta|-rc).*?$ ]]; then
33+
echo "Valid version format: ${VERSION}"
34+
else
35+
echo "Invalid version: ${VERSION}. Expected: X.Y.Z or X.Y.Z-beta.1 or X.Y.Z-alpha.1"
36+
exit 1
37+
fi
38+
39+
- name: Package helm charts
40+
env:
41+
VERSION: "${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}"
42+
run: |
43+
set -xe
44+
45+
mkdir -p charts
46+
for i in Charts/*; do
47+
if [[ ${i} =~ ^.*-ioc$ ]]; then
48+
echo "Skipping IOC schema chart: ${i}"
49+
continue
50+
fi
51+
echo "Packaging chart: ${i}"
52+
helm package -u --app-version ${VERSION} --version ${VERSION} ${i}
53+
mv $(basename ${i})-*.tgz charts/
54+
done
55+
56+
- name: Upload helm chart values schemas
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: helm-chart-schemas
60+
path: schemas/
61+
62+
- name: Push tagged helm chart to registry
63+
if: ${{ github.ref_type == 'tag' }}
64+
run: |
65+
set -x
66+
67+
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.repository_owner }} --password-stdin
68+
REGISTRY=oci://ghcr.io/diamondlightsource/charts
69+
for i in charts/*.tgz; do
70+
helm push "${i}" ${REGISTRY}
71+
done

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
if: needs.check.outputs.branch-pr == ''
4545
uses: ./.github/workflows/_dist.yml
4646

47+
helm:
48+
uses: ./.github/workflows/_helm.yml
49+
permissions:
50+
contents: read
51+
packages: write
52+
4753
pypi:
4854
if: github.ref_type == 'tag'
4955
needs: dist
@@ -53,7 +59,7 @@ jobs:
5359

5460
release:
5561
if: github.ref_type == 'tag'
56-
needs: [dist, docs]
62+
needs: [dist, docs, helm]
5763
uses: ./.github/workflows/_release.yml
5864
permissions:
5965
contents: write

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-added-large-files
66
- id: check-yaml
7+
exclude: ^Charts/
78
- id: check-merge-conflict
89
- id: end-of-file-fixer
910

@@ -22,3 +23,10 @@ repos:
2223
entry: ruff format --force-exclude
2324
types: [python]
2425
require_serial: true
26+
27+
- id: helm-schema
28+
name: Generate Helm schema
29+
entry: ./generate-schemas.sh
30+
language: system
31+
types: [yaml]
32+
require_serial: true

Charts/fastcs-ioc/Chart.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v2
2+
name: fastcs-ioc
3+
version: 0.1.0
4+
# This chart allows generating a schema for the fastcs-ioc values file.
5+
# fastcs-ioc schema is used by IOC instances which have fastcs
6+
# as a dependency.
7+
#
8+
# This chart is never used except by helm-schema.

0 commit comments

Comments
 (0)