Skip to content

feat(k8s): Add helm chart for deploying to k8s - #154

Open
heathcliff26 wants to merge 3 commits into
pehlicd:mainfrom
heathcliff26:helm-chart
Open

feat(k8s): Add helm chart for deploying to k8s#154
heathcliff26 wants to merge 3 commits into
pehlicd:mainfrom
heathcliff26:helm-chart

Conversation

@heathcliff26

Copy link
Copy Markdown
Contributor

This PR add a helm chart for deploying to kubernetes.
Additionally it generates the static k8s manifest from the helm chart to maintain a single source of truth.
Finally it add CI workflows to automate verficiation of the helm chart as well as the release.

Example helm chart generated with the new workflow:

helm install crd-wizard oci://ghcr.io/heathcliff26/helm-charts/crd-wizard --version 0.2.0-test.4

Please not that there currently is no working image for k8s.

Closes: #152

Special Notes:

  • Helm adds the chart name to the artifact. To keep the chart name the same as app, the helm chart will be pushed to ghcr.io/pehlicd/helm-charts/crd-wizard instead of the originally planned ghcr.io/pehlicd/crd-wizard-helm
  • Breaking Change: It is no possible to upgrade directly from the old static manifest to the new one, as some labels and resource names have changed. The old deployment should be deleted before applying the new one. Simply updating the image version in the cluster would also work.

@heathcliff26 heathcliff26 changed the title feat!(k8s): Add helm chart for deploying to k8s feat(k8s): Add helm chart for deploying to k8s Aug 8, 2026
@heathcliff26

Copy link
Copy Markdown
Contributor Author

Just realised i forgot to add the workflow for validating that the static manifest has been generated.
I created the PR as a draft while i fix that.

@heathcliff26
heathcliff26 force-pushed the helm-chart branch 3 times, most recently from fb57f5d to 8f7d8d9 Compare August 8, 2026 14:53
@heathcliff26
heathcliff26 marked this pull request as ready for review August 8, 2026 14:55
@heathcliff26
heathcliff26 requested a review from pehlicd as a code owner August 8, 2026 14:55
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. ci For ci related stuff documentation Improvements or additions to documentation enhancement New feature or request labels Aug 8, 2026
@heathcliff26

Copy link
Copy Markdown
Contributor Author

Added the missing workflow

@pehlicd pehlicd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just couple of minor adjustments and questions need to be addressed. Thanks a lot for massive effort you put in this PR, I highly appreciate it.

Comment thread deploy/k8s/base/deployment.yaml Outdated
Comment on lines +1 to +146
---
apiVersion: v1
kind: Namespace
metadata:
name: crd-wizard
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: crd-wizard
namespace: crd-wizard
labels:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: crd-wizard
labels:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list"]
# "Extensive" permissions requested.
# This provides full read access to all resources in all API groups.
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: crd-wizard
labels:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
subjects:
- kind: ServiceAccount
name: crd-wizard
namespace: crd-wizard
roleRef:
kind: ClusterRole
name: crd-wizard
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: Service
metadata:
name: crd-wizard
namespace: crd-wizard
labels:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
spec:
type: ClusterIP
ipFamilyPolicy: PreferDualStack
ports:
- port: 8080
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: crd-wizard
namespace: crd-wizard
labels:
app: crd-wizard
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
spec:
replicas: 1
selector:
matchLabels:
app: crd-wizard
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
template:
metadata:
labels:
app: crd-wizard
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
spec:
serviceAccountName: crd-wizard-sa
serviceAccountName: crd-wizard
containers:
- name: crd-wizard
image: ghcr.io/pehlicd/crd-wizard:latest
imagePullPolicy: Always
# Explicit command and args allow overriding the Dockerfile ENTRYPOINT ["crd-wizard", "web"]
# This makes it easier to use Kustomize patches to change arguments (e.g. adding flags)
command: ["crd-wizard"]
args: ["web"]
ports:
- containerPort: 8080
name: http
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
- name: crd-wizard
image: "ghcr.io/pehlicd/crd-wizard:latest"
imagePullPolicy: IfNotPresent
command:
- crd-wizard
args:
- web
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: crd-wizard
namespace: crd-wizard
labels:
app.kubernetes.io/name: crd-wizard
app.kubernetes.io/instance: crd-wizard
app.kubernetes.io/version: "0.0.0"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: crd-wizard
port:
name: http

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the motivation behind moving ingress, rbac and service objects into one place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is just how helm template outputs it, so it is merely a consequence of generating the manifest from the helm chart.
Though since it is no longer intended to be manually changed i think this should be ok.

Comment thread deploy/k8s/helm/README.md Outdated
Comment thread deploy/k8s/helm/README.md Outdated
Add helm chart derived from `helm create` command.
Add README.md and LICENSE files to the helm chart directory.
Add lint target to Makefile for helm chart linting.

Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
Use the helm chart as a single source of truth for k8s.
Generate the base manifest from the helm chart.
This consolidates the manifest into a single file.

Breaking change: The selector and resource names have changed. Delete the old
manifest before applying the new one.

Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
Add workflow for linting helm chart.
Add workflow for checking if manifests have been updated.
Add step for releasing helm chart in release workflow.

Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci For ci related stuff documentation Improvements or additions to documentation enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add helm chart for kubernetes deployment option

2 participants