diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml new file mode 100644 index 0000000..50af98e --- /dev/null +++ b/.github/workflows/helm-publish.yml @@ -0,0 +1,58 @@ +name: Build and Push Helm Chart + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + +jobs: + build-and-push: + name: Build image & push + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + # Step 1: Check out the repository + - name: Checkout code + uses: actions/checkout@v3 + + # Step 2: Extract version from __version__.py + - name: Extract version + run: | + VERSION=$(python -c "exec(open('__version__.py').read()); print(__version__)") + echo "Version is $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + # Step 3: Set up Helm + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.12.0 + + # Step 4: Authenticate to GitHub Container Registry + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Step 5: Package the Helm Chart + - name: Package Helm Chart + run: | + helm package helm/openspoolman --destination ./ + + # Step 6: Push the Helm Chart to GHCR + - name: Push Helm Chart to GHCR + run: | + CHART_NAME=$(helm show chart helm/openspoolman | grep '^name:' | awk '{print $2}') + CHART_VERSION=${{ env.VERSION }} + CHART_FILE="${CHART_NAME}-${CHART_VERSION}.tgz" + echo "Pushing chart: $CHART_FILE" + + # Push chart to GHCR + helm push "$CHART_FILE" oci://ghcr.io/${{ github.repository }}/helm diff --git a/README.md b/README.md index e02d009..6bc9999 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,5 @@ TBD: - Filament spending based on printing - Evidently needed GUI improvements - Code cleanup - - Deployment as Helm chart - Video showcase - TODOs diff --git a/helm/openspoolman/.helmignore b/helm/openspoolman/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/openspoolman/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/openspoolman/Chart.lock b/helm/openspoolman/Chart.lock new file mode 100644 index 0000000..14e498b --- /dev/null +++ b/helm/openspoolman/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: oci://tccr.io/truecharts + version: 25.1.7 +digest: sha256:136293235d994e0b8f6742629bcfc6e177b6d601e13f9271c18d15647c55d452 +generated: "2024-12-13T17:39:20.5007907+01:00" diff --git a/helm/openspoolman/Chart.yaml b/helm/openspoolman/Chart.yaml new file mode 100644 index 0000000..13b023e --- /dev/null +++ b/helm/openspoolman/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +appVersion: 0.0.1 +description: A Helm chart for Kubernetes +name: openspoolman +type: application +version: 0.0.1 +dependencies: + - name: common + version: 25.1.7 + repository: oci://tccr.io/truecharts + condition: "" + alias: "" + tags: [] + import-values: [] diff --git a/helm/openspoolman/charts/common-25.1.7.tgz b/helm/openspoolman/charts/common-25.1.7.tgz new file mode 100644 index 0000000..e11381e Binary files /dev/null and b/helm/openspoolman/charts/common-25.1.7.tgz differ diff --git a/helm/openspoolman/templates/common.yaml b/helm/openspoolman/templates/common.yaml new file mode 100644 index 0000000..d773502 --- /dev/null +++ b/helm/openspoolman/templates/common.yaml @@ -0,0 +1,2 @@ +{{/* Render the templates */}} +{{ include "tc.v1.common.loader.all" . }} diff --git a/helm/openspoolman/values.yaml b/helm/openspoolman/values.yaml new file mode 100644 index 0000000..1eda107 --- /dev/null +++ b/helm/openspoolman/values.yaml @@ -0,0 +1,35 @@ +image: + pullPolicy: IfNotPresent + repository: ghcr.io/drndos/openspoolman +portal: + open: + enabled: false +operator: + verify: + enabled: false +global: + addTraefikAnnotations: false +podOptions: + nodeSelector: {} + topologySpreadConstraints: [] + defaultSpread: false +securityContext: + container: + readOnlyRootFilesystem: false + runAsGroup: 0 + runAsUser: 0 +service: + main: + ports: + main: + port: 8000 + protocol: tcp +workload: + main: + podSpec: + containers: + main: + env: + ENTRY: "{{ .Values.service.main.ports.main.port }}" + PORT: "{{ .Values.service.main.ports.main.port }}" + SCHEME: http