Improvement: Add helm

This commit is contained in:
Filip Bednárik 2024-12-13 17:38:29 +01:00
parent a3ce01a90f
commit 900388cdd3
8 changed files with 138 additions and 1 deletions

58
.github/workflows/helm-publish.yml vendored Normal file
View File

@ -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

View File

@ -48,6 +48,5 @@ TBD:
- Filament spending based on printing
- Evidently needed GUI improvements
- Code cleanup
- Deployment as Helm chart
- Video showcase
- TODOs

View File

@ -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/

View File

@ -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"

View File

@ -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: []

Binary file not shown.

View File

@ -0,0 +1,2 @@
{{/* Render the templates */}}
{{ include "tc.v1.common.loader.all" . }}

View File

@ -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