Skip to content

Commit c297168

Browse files
committed
push helm chart via github action
1 parent aef27b5 commit c297168

9 files changed

Lines changed: 95 additions & 8 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and Push Training Application Helm Chart
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- helm-chart/**
9+
- makefile
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Login to Quay
20+
uses: docker/login-action@v3
21+
with:
22+
registry: quay.io
23+
username: ${{ secrets.QUAY_USERNAME }}
24+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
25+
- name: Install Helm
26+
uses: azure/setup-helm@v4.3.0
27+
- name: Push Helm Chart
28+
run: make helm-push

.github/workflows/build_and_push.yaml renamed to .github/workflows/build_and_push_images.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
name: Build and Push Training Application
1+
name: Build and Push Training Application Images
22

33
on:
44
push:
55
branches:
66
- "main"
7+
paths:
8+
- src/**
9+
- docker/**
10+
- training-application.conf
11+
- makefile
712

813
jobs:
914
build:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ training-application
22
.DS_Store
33
application.log
44
/data/
5+
*.tgz

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BUILD_VERSION = 4.0.0
44
BUILD_VERSION_A = ${BUILD_VERSION}-A
55
BUILD_VERSION_B = ${BUILD_VERSION}-B
66
BUILD_VERSION_DISTROLESS = ${BUILD_VERSION}-distroless
7+
HELM_CHART_VERSION = 1.0.1
78

89
.PHONY: update-dependencies
910
update-dependencies:
@@ -59,3 +60,8 @@ docker-push-all:
5960
docker buildx build --push --platform linux/arm64,linux/amd64 -f docker/Dockerfile-A --tag ${IMAGE_REPOSITORY}/${APPLICATION_NAME}:${BUILD_VERSION_A} .
6061
docker buildx build --push --platform linux/arm64,linux/amd64 -f docker/Dockerfile-B --tag ${IMAGE_REPOSITORY}/${APPLICATION_NAME}:${BUILD_VERSION_B} .
6162
docker buildx build --push --platform linux/arm64,linux/amd64 -f docker/Dockerfile-distroless --tag ${IMAGE_REPOSITORY}/${APPLICATION_NAME}:${BUILD_VERSION_DISTROLESS} .
63+
64+
.PHONY: helm-push
65+
helm-push:
66+
helm package ./helm-chart --version ${HELM_CHART_VERSION}
67+
helm push --debug training-application-${HELM_CHART_VERSION}.tgz oci://quay.io/kubermatic-labs/helm-charts/

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ The aim of this application is to be used in the context of trainings for Docker
88

99
**Nothing**, besides possibly (depending on the application configuration) showing a cute cat image 🙀.
1010

11-
<img width="500" alt="Screenshot 2025-06-04 at 15 40 30" src="https://github.com/user-attachments/assets/7cafc452-4f21-4202-8379-2a983ecbf122" />
12-
1311
## Available Endpoints
1412

1513
> **_NOTE:_** The application offers the following endpoints on port **8080**
@@ -166,6 +164,13 @@ spec:
166164
- **Default Value**: false
167165
- **Usage**: via config file
168166

167+
### `persistMetaInfo`
168+
169+
- **Description**: Writes metainfo into the file `./data/metainfo.txt`. The metainfo has to be provided via the environment variables named `WORKER_NODE_NAME`, `POD_NAME` and `POD_IP`.
170+
- **Type**: bool
171+
- **Default Value**: false
172+
- **Usage**: via config file
173+
169174
### `catMode`
170175

171176
- **Description**: Flag to get cute cat images in the root endpoint

helm-chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
apiVersion: v2
2-
name: my-app
3-
version: 1.0.0
2+
name: training-application
3+
version: 0.0.0

helm-chart/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
The chart is currently used in the following trainings. Ensure you do not introduce any breaking changes to it.
1+
# Training Application Helm Chart
22

3-
- in K1 (did not work, due to k1 needs index.yaml and packaged helm chart in repoURL)
4-
- in KKP
3+
## Prerequisites for the value `persistMetaInfo`
4+
5+
- The StorageClass with the name `my-storageclass` has to exist in the cluster
6+
7+
## Prerequisites for the value `ingress.enabled`
8+
9+
- The IngressClass with the name `nginx` has to exist in the cluster
10+
- CertManager has to exist in the cluster
11+
- The ClusterIssuer with the name `letsencrypt-issuer` has to exist in the cluster

helm-chart/templates/deployment.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ spec:
2424
ports:
2525
- name: http
2626
containerPort: 8080
27+
env:
28+
- name: WORKER_NODE_NAME
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: spec.nodeName
32+
- name: POD_NAME
33+
valueFrom:
34+
fieldRef:
35+
fieldPath: metadata.name
36+
- name: POD_IP
37+
valueFrom:
38+
fieldRef:
39+
fieldPath: status.podIP
2740
livenessProbe:
2841
httpGet:
2942
path: /liveness/
@@ -43,7 +56,16 @@ spec:
4356
- name: my-volume
4457
mountPath: /app/training-application.conf
4558
subPath: training-application.conf
59+
{{- if .Values.persistMetaInfo }}
60+
- name: persistence
61+
mountPath: /app/data/
62+
{{- end }}
4663
volumes:
4764
- name: my-volume
4865
configMap:
4966
name: my-app
67+
{{- if .Values.persistMetaInfo }}
68+
- name: persistence
69+
persistentVolumeClaim:
70+
claimName: training-application-pvc
71+
{{- end }}

helm-chart/templates/pvc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.persistMetaInfo }}
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
name: training-application-pvc
6+
spec:
7+
storageClassName: my-storageclass
8+
accessModes:
9+
- ReadWriteOnce
10+
resources:
11+
requests:
12+
storage: 100Mi
13+
{{- end }}

0 commit comments

Comments
 (0)