Add namespace

This commit is contained in:
bom 2024-03-22 13:42:31 +01:00
parent ab4c6e0d76
commit fcf6d7783e
11 changed files with 16 additions and 5 deletions

View file

@ -28,6 +28,7 @@
:pv-storage-size-gb 50 :pv-storage-size-gb 50
:pvc-storage-class-name default-storage-class} :pvc-storage-class-name default-storage-class}
auth) auth)
(ns/generate (merge {:namespace "nextcloud"} config))
[(nextcloud/generate-secret auth) [(nextcloud/generate-secret auth)
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config)) (nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
(nextcloud/generate-deployment config) (nextcloud/generate-deployment config)

View file

@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: backup-restore name: backup-restore
namespace: nextcloud
spec: spec:
replicas: 0 replicas: 0
selector: selector:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: backup-config name: backup-config
namespace: nextcloud
labels: labels:
app.kubernetes.io/name: backup app.kubernetes.io/name: backup
app.kubernetes.io/part-of: cloud app.kubernetes.io/part-of: cloud

View file

@ -2,6 +2,7 @@ apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
name: cloud-backup name: cloud-backup
namespace: nextcloud
labels: labels:
app.kubernetes.part-of: cloud app.kubernetes.part-of: cloud
spec: spec:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: backup-secret name: backup-secret
namespace: nextcloud
type: Opaque type: Opaque
data: data:
aws-access-key-id: "aws-access-key-id" aws-access-key-id: "aws-access-key-id"

View file

@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: cloud-deployment name: cloud-deployment
namespace: nextcloud
spec: spec:
selector: selector:
matchLabels: matchLabels:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: cloud-pvc name: cloud-pvc
namespace: nextcloud
labels: labels:
app.kubernetes.io/application: cloud app.kubernetes.io/application: cloud
spec: spec:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: cloud-secret name: cloud-secret
namespace: nextcloud
type: Opaque type: Opaque
data: data:
nextcloud-admin-user: "admin-user" nextcloud-admin-user: "admin-user"

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: cloud-service name: cloud-service
namespace: nextcloud
labels: labels:
app.kubernetes.io/name: cloud-service app.kubernetes.io/name: cloud-service
app.kubernetes.io/application: cloud app.kubernetes.io/application: cloud

View file

@ -8,7 +8,7 @@
(deftest should-generate-secret (deftest should-generate-secret
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "Secret" :kind "Secret"
:metadata {:name "backup-secret"} :metadata {:name "backup-secret", :namespace "nextcloud"}
:type "Opaque" :type "Opaque"
:data :data
{:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}} {:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}}
@ -18,6 +18,7 @@
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "ConfigMap" :kind "ConfigMap"
:metadata {:name "backup-config" :metadata {:name "backup-config"
:namespace "nextcloud"
:labels {:app.kubernetes.io/name "backup" :labels {:app.kubernetes.io/name "backup"
:app.kubernetes.io/part-of "cloud"}} :app.kubernetes.io/part-of "cloud"}}
:data :data
@ -27,7 +28,7 @@
(deftest should-generate-cron (deftest should-generate-cron
(is (= {:apiVersion "batch/v1" (is (= {:apiVersion "batch/v1"
:kind "CronJob" :kind "CronJob"
:metadata {:name "cloud-backup", :labels {:app.kubernetes.part-of "cloud"}} :metadata {:name "cloud-backup", :namespace "nextcloud", :labels {:app.kubernetes.part-of "cloud"}}
:spec :spec
{:schedule "10 23 * * *" {:schedule "10 23 * * *"
:successfulJobsHistoryLimit 1 :successfulJobsHistoryLimit 1

View file

@ -23,7 +23,7 @@
(deftest should-generate-secret (deftest should-generate-secret
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "Secret" :kind "Secret"
:metadata {:name "cloud-secret"} :metadata {:name "cloud-secret", :namespace "nextcloud"}
:type "Opaque" :type "Opaque"
:data :data
{:nextcloud-admin-user "Y2xvdWRhZG1pbg==" {:nextcloud-admin-user "Y2xvdWRhZG1pbg=="
@ -77,6 +77,7 @@
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "PersistentVolumeClaim" :kind "PersistentVolumeClaim"
:metadata {:name "cloud-pvc" :metadata {:name "cloud-pvc"
:namespace "nextcloud"
:labels {:app.kubernetes.io/application "cloud"}} :labels {:app.kubernetes.io/application "cloud"}}
:spec {:storageClassName "local-path" :spec {:storageClassName "local-path"
:accessModes ["ReadWriteOnce"] :accessModes ["ReadWriteOnce"]
@ -86,7 +87,7 @@
(deftest should-generate-deployment (deftest should-generate-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1"
:kind "Deployment" :kind "Deployment"
:metadata {:name "cloud-deployment"} :metadata {:name "cloud-deployment", :namespace "nextcloud"}
:spec :spec
{:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}} {:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}}
:strategy {:type "Recreate"} :strategy {:type "Recreate"}