Add hannah test wordpress instance

This commit is contained in:
Finn 2025-01-10 18:49:01 -08:00
parent e0b364f224
commit 0e3bd0c314
6 changed files with 181 additions and 0 deletions

View file

@ -16,3 +16,4 @@ resources:
- snipeit
- system-upgrade-controller
- tofu
- wordpress

View file

@ -0,0 +1,14 @@
apiVersion: generators.external-secrets.io/v1alpha1
kind: ClusterGenerator
metadata:
name: password
spec:
kind: Password
generator:
passwordSpec:
length: 64
digits: 5
symbols: 5
symbolCharacters: "-_$@"
noUpper: false
allowRepeat: true

View file

@ -5,3 +5,4 @@ resources:
- namespace.yaml
- bundle.yaml
- bitwarden.yaml
- generators.yaml

155
k8s/wordpress/hannah.yaml Normal file
View file

@ -0,0 +1,155 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hannah
spec:
selector:
matchLabels:
app: hannah
serviceName: hannah
replicas: 1
template:
metadata:
labels:
app: hannah
spec:
containers:
- name: wordpress
image: library/wordpress:6.7.1
env:
- name: WORDPRESS_DB_HOST
value: hannah-db
- name: WORDPRESS_DB_USER
value: wordpress
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: hannah-db
key: password
- name: WORDPRESS_DB_NAME
value: wordpress
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /var/www/html
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
name: hannah
spec:
ports:
- name: web
port: 80
clusterIP: None
selector:
app: hannah
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hannah-db
spec:
selector:
matchLabels:
app: hannah-db
serviceName: hannah-db
replicas: 1
template:
metadata:
labels:
app: hannah-db
spec:
containers:
- name: mysql
image: library/mysql:8.4.3
env:
- name: MYSQL_DATABASE
value: wordpress
- name: MYSQL_USER
value: wordpress
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: hannah-db
key: password
- name: MYSQL_RANDOM_ROOT_PASSWORD
value: "1"
ports:
- name: mysql
containerPort: 3306
volumeMounts:
- name: data
mountPath: /var/lib/mysql
subPath: mysql
resources:
requests:
cpu: 500m
memory: 500Mi
livenessProbe:
exec:
command: ["mysqladmin", "ping"]
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: hannah-db
spec:
ports:
- name: mysql
port: 3306
clusterIP: None
selector:
app: hannah-db
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: hannah-db
spec:
target:
name: hannah-db
dataFrom:
- sourceRef:
generatorRef:
apiVersion: generators.external-secrets.io/v1alpha1
kind: ClusterGenerator
name: password
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hannah
spec:
rules:
- host: hannah-wp.janky.solutions
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hannah
port:
name: web

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: wordpress
resources:
- namespace.yaml
- hannah.yaml

View file

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: wordpress