Skip to content

Commit 2b43515

Browse files
authored
Add Drupal chart (#52)
1 parent a2ac27a commit 2b43515

12 files changed

Lines changed: 179 additions & 2 deletions

File tree

.kube-linter.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
- charts/**/charts/**
2525
# disable for now (too many issues for something to rework from the container image)
2626
- charts/nfs-ganesha/**
27+
- charts/drupal/**
2728
# disable as no easy solution for secret management for MariaDB
2829
- charts/dvwa/**

charts/drupal/.helmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
.git
3+
.gitignore
4+
README.md

charts/drupal/CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contribution guide
2+
3+
## Validate on a test cluster
4+
5+
Create a `values.mine.yaml` file:
6+
7+
```yaml
8+
ingress:
9+
enabled: true
10+
className: "traefik"
11+
annotations:
12+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
13+
tls:
14+
enabled: true
15+
```
16+
17+
Install the chart:
18+
19+
```bash
20+
helm upgrade --install drupal . -f values.yaml -f values.mine.yaml --namespace drupal --create-namespace \
21+
--set ingress.domain="drupal.console.$SANDBOX_ID.instruqt.io"
22+
```
23+
24+
Wait for all pods to be ready:
25+
26+
```bash
27+
kubectl get pod,rs,deploy,svc,ingress,certificate -n drupal
28+
```
29+
30+
Open the web application in a browser:
31+
32+
```bash
33+
echo https://drupal.console.$SANDBOX_ID.instruqt.io
34+
```

charts/drupal/Chart.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v2
2+
name: drupal
3+
description: Drupal Web Application - for container security workshops
4+
type: application
5+
version: 1.0.0
6+
appVersion: "1.0.0"
7+
keywords:
8+
- security
9+
- vulnerable
10+
- workshop
11+
- training
12+
maintainers:
13+
- name: devpro
14+
email: bertrand@devpro.fr

charts/drupal/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Drupal Helm Chart
2+
3+
Helm chart for Drupal — designed for container security workshops.
4+
5+
## Quick Start
6+
7+
Add the chart repository:
8+
9+
```bash
10+
helm repo add devpro https://devpro.github.io/helm-charts
11+
helm repo update
12+
```
13+
14+
Create the `values.yaml` file to override [default values](values.yaml).
15+
16+
Install the chart:
17+
18+
```bash
19+
helm upgrade --install drupal devpro/drupal -f values.yaml --namespace drupal --create-namespace
20+
```
21+
22+
## Uninstall
23+
24+
```bash
25+
helm uninstall drupal -n drupal
26+
kubectl delete namespace drupal
27+
```
28+
29+
## Going further
30+
31+
Check the [contribution guide](CONTRIBUTING.md).
32+
33+
---
34+
> ⚠️ **FOR WORKSHOP USE ONLY** — intentionally vulnerable, never expose to the internet.

charts/drupal/templates/NOTES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
🎯 Drupal deployed!
2+
3+
⚠️ FOR WORKSHOP USE ONLY — never expose to the internet long-term!
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: drupal
5+
spec:
6+
replicas: {{ .Values.replicaCount }}
7+
strategy:
8+
type: RollingUpdate
9+
selector:
10+
matchLabels:
11+
app: drupal
12+
template:
13+
metadata:
14+
labels:
15+
app: drupal
16+
spec:
17+
containers:
18+
- name: drupal
19+
image: {{ .Values.image }}:{{ .Values.tag }}
20+
imagePullPolicy: IfNotPresent
21+
ports:
22+
- name: http
23+
containerPort: 80
24+
protocol: TCP
25+
livenessProbe:
26+
httpGet:
27+
path: /
28+
port: 80
29+
initialDelaySeconds: 10
30+
periodSeconds: 10
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: drupal
6+
{{- with .Values.ingress.annotations }}
7+
annotations:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
spec:
11+
{{- if .Values.ingress.className }}
12+
ingressClassName: {{ $.Values.ingress.className }}
13+
{{- end }}
14+
rules:
15+
- host: {{ .Values.ingress.domain | quote }}
16+
http:
17+
paths:
18+
- path: /
19+
pathType: Prefix
20+
backend:
21+
service:
22+
name: drupal
23+
port:
24+
number: 80
25+
{{- if .Values.ingress.tls.enabled }}
26+
tls:
27+
- hosts:
28+
- {{ .Values.ingress.domain | quote }}
29+
secretName: drupal-tls-secret
30+
{{- end }}
31+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: drupal
5+
labels:
6+
app: drupal
7+
spec:
8+
type: ClusterIP
9+
selector:
10+
app: drupal
11+
ports:
12+
- port: 80
13+
targetPort: 80
14+
protocol: TCP
15+
name: http

charts/drupal/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
replicaCount: 1
2+
image: vulhub/drupal
3+
tag: 8.5.0
4+
ingress:
5+
enabled: false
6+
className: "" # traefik
7+
domain: ""
8+
annotations: {}
9+
# cert-manager.io/cluster-issuer: letsencrypt-prod
10+
tls:
11+
enabled: false

0 commit comments

Comments
 (0)