Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .kube-linter.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
checks:
checks:
addAllBuiltIn: true
# ref. https://docs.kubelinter.io/#/generated/checks
exclude:
Expand All @@ -18,6 +18,7 @@ checks:
- latest-tag
# disable for now (need to add users in image Dockerfile)
- run-as-non-root
- sorted-keys
- privileged-ports
ignorePaths:
- charts/**/charts/**
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Kube Workload Toolkit
# Kube Workload Toolkit

[![GitLab Pipeline Status](https://gitlab.com/devpro-labs/automation/helm-charts/badges/main/pipeline.svg)](https://gitlab.com/devpro-labs/automation/helm-charts/-/pipelines)
[![CI](https://github.com/devpro/helm-charts/actions/workflows/ci.yml/badge.svg)](https://github.com/devpro/helm-charts/actions/workflows/ci.yml)
Expand Down Expand Up @@ -38,7 +38,7 @@ helm install <package_name>

### From ArgoCD

* Create a git repository to store Kubernetes definition files (GitOps approach)
- Create a git repository to store Kubernetes definition files (GitOps approach)

```yaml
# wordpress/Chart.yaml
Expand All @@ -54,11 +54,11 @@ dependencies:
repository: https://devpro.github.io/helm-charts
```

* Create a new application in ArgoCD to reference the git repository with the path to the folder
- Create a new application in ArgoCD to reference the git repository with the path to the folder

### From Fleet

* Create a git repository to store Kubernetes definition files (GitOps approach)
- Create a git repository to store Kubernetes definition files (GitOps approach)

```yaml
# wordpress/fleet.yaml
Expand All @@ -70,16 +70,15 @@ helm:
releaseName: wordpress
```

* Create a GitRepo to reference the git repository with the path to the folder
- Create a GitRepo to reference the git repository with the path to the folder

### From Rancher

* In your cluster
* Go to "Apps" > "Repositories", click on "Create" and enter `https://devpro.github.io/helm-charts` as "Index URL", then click on "Create"
* Go to "Apps" > "Charts", look at the available applications (charts) and install the one(s) you want

- In your cluster
- Go to "Apps" > "Repositories", click on "Create" and enter `https://devpro.github.io/helm-charts` as "Index URL", then click on "Create"
- Go to "Apps" > "Charts", look at the available applications (charts) and install the one(s) you want

## Samples

* [DevOpsDays Geneva 2023](samples/devopsdays-geneva-2023/README.md)
* [SUSE Exchange Paris 2023](samples/suse-exchange-paris-2023/README.md)
- [DevOpsDays Geneva 2023](samples/devopsdays-geneva-2023/README.md)
- [SUSE Exchange Paris 2023](samples/suse-exchange-paris-2023/README.md)
23 changes: 23 additions & 0 deletions charts/todoblazor/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
89 changes: 89 additions & 0 deletions charts/todoblazor/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contribution guide

## Update chart dependencies

Add Bitnami Helm repository:

```bash
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
```

Look for existing versions:

```bash
helm search repo -l mongodb --versions
```

Manually edit `Chart.yaml` with the version.

Update `Chart.lock`:

```bash
helm dependency update
```

## Validate on a test cluster

Create a `values.mine.yaml` file:

```yaml
dotnet:
environment: Development
enableOpenTelemetry: false
webapp:
db:
connectionString: mongodb://root:admin@todoblazor-mongodb:27017/todolist?authSource=admin
databaseName: todolist
ingress:
enabled: true
className: traefik
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
mongodb:
enabled: true
auth:
rootPassword: admin
```

Install or update the application:

```bash
helm upgrade --install todoblazor . \
-f values.yaml -f values.mine.yaml \
--set webapp.host=todoblazor.console.$SANDBOX_ID.instruqt.io \
--namespace demo --create-namespace
```

Check everything is ok in the namespace:

```bash
kubectl get pod,svc,deploy,rs,ingress,secret,pvc -n demo
```

Open the web application in a browser:

```bash
echo https://todoblazor.console.$SANDBOX_ID.instruqt.io/swagger
```

If needed, debug with:

- Forward MongoDB port to view the database from Compass (with connection string "mongodb://root:admin@localhost:27017/todolist?authSource=admin")

```bash
kubectl port-forward svc/todoblazor-mongodb -n demo 27017:27017
```

- Have a shell in a MongoDB container

```bash
kubectl exec -it deploy/todoblazor-mongodb -n demo -- bash
```

At the end, clean everything:

```bash
helm delete todoblazor -n demo
kubectl delete ns demo
```
6 changes: 6 additions & 0 deletions charts/todoblazor/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: 18.1.10
digest: sha256:1d8e259cedd55f3e4cf9e11249e3eb3af2279bace5424e570a5149834d63a480
generated: "2026-01-25T02:06:22.936299536+01:00"
15 changes: 15 additions & 0 deletions charts/todoblazor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: todoblazor
description: Helm chart for Todo Blazor web application
type: application
version: 0.1.0
appVersion: "1.0.0"
dependencies:
- name: mongodb
version: 18.1.10 # MongoDB 8.2.2
repository: https://charts.bitnami.com/bitnami
alias: mongodb
condition: mongodb.enabled
maintainers:
- name: devpro
email: [email protected]
24 changes: 24 additions & 0 deletions charts/todoblazor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Helm chart for Todo Blazor

This Helm chart will deploy [Todo Blazor](https://github.com/devpro/todo-blazor) on a Kubernetes cluster.

## Usage

Add the chart repository:

```bash
helm repo add devpro https://devpro.github.io/helm-charts
helm repo update
```

Create the `values.yaml` file to override [default values](values.yaml).

Install the application:

```bash
helm upgrade --install todoblazor devpro/todoblazor -f values.yaml --namespace demo --create-namespace
```

## Going further

Check the [contribution guide](CONTRIBUTING.md).
1 change: 1 addition & 0 deletions charts/todoblazor/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions charts/todoblazor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

92 changes: 92 additions & 0 deletions charts/todoblazor/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{{- $applications := list .Values.webapp -}}
{{ range $applications }}
{{- $name := .name -}}
{{- if .enabled -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .name }}
labels:
app: {{ .name }}
app.kubernetes.io/name: {{ .name }}
spec:
replicas: {{ .replicaCount }}
strategy:
type: RollingUpdate
selector:
matchLabels:
app: {{ .name }}
app.kubernetes.io/name: {{ .name }}
template:
metadata:
labels:
app: {{ $name }}
app.kubernetes.io/name: {{ $name }}
{{- if .additionalPodLabels }}
{{- toYaml .additionalPodLabels | nindent 8 }}
{{- end }}
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/arch"
operator: In
values: ["amd64"]
containers:
- name: {{ .name }}
image: {{ .image }}:{{ .tag }}
imagePullPolicy: Always
ports:
- name: http
containerPort: {{ .containerPort }}
protocol: TCP
livenessProbe:
httpGet:
path: {{ .healthEndpoint }}
port: http
readinessProbe:
httpGet:
path: {{ .healthEndpoint }}
port: http
resources:
{{- toYaml .resources | nindent 12 }}
securityContext:
runAsNonRoot: true
runAsUser: 1654 # "app" user
runAsGroup: 1654 # "app" group
allowPrivilegeEscalation: false
env:
{{- if .extraEnv }}
{{- toYaml .extraEnv | nindent 12 }}
{{- end }}
- name: HOST_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
- name: ASPNETCORE_ENVIRONMENT
value: "{{ $.Values.dotnet.environment }}"
- name: Logging__LogLevel__Default
value: {{ $.Values.dotnet.logLevels.default }}
- name: Logging__LogLevel__Microsoft.AspNetCore
value: {{ $.Values.dotnet.logLevels.framework }}
- name: Logging__LogLevel__Devpro
value: {{ $.Values.dotnet.logLevels.application }}
{{- if $.Values.dotnet.enableOpenTelemetry }}
- name: Application__IsOpenTelemetryEnabled
value: "true"
- name: OpenTelemetry__CollectorEndpoint
value: "http://$(HOST_IP):4317"
{{- end }}
{{- if .db }}
- name: DatabaseSettings__ConnectionString
value: {{ .db.connectionString }}
- name: DatabaseSettings__DatabaseName
value: {{ .db.databaseName }}
{{- end }}
restartPolicy: Always
{{- end }}
{{ end }}
50 changes: 50 additions & 0 deletions charts/todoblazor/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- $applications := list .Values.webapp -}}
{{ range $applications }}
{{- $name := .name -}}
{{- if and $.Values.ingress.enabled .enabled -}}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $name }}
{{- with $.Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if $.Values.ingress.className }}
ingressClassName: {{ $.Values.ingress.className }}
{{- end }}
rules:
- host: {{ .host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $name }}
port:
number: {{ .port }}
{{- range .ingressExtraHosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ $name }}
port:
number: {{ .port }}
{{- end }}
{{- end }}
{{- if .tls }}
tls:
- hosts:
- {{ .host | quote }}
secretName: {{ .tls.secretName }}
{{- end }}
{{- end }}
{{ end }}
Loading
Loading