From fcf6d7783e41baf320ff7ac48b1fc1bc7e753c0d Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 22 Mar 2024 13:42:31 +0100 Subject: [PATCH] Add namespace --- src/main/cljc/dda/c4k_nextcloud/core.cljc | 1 + src/main/resources/backup/backup-restore-deployment.yaml | 1 + src/main/resources/backup/config.yaml | 1 + src/main/resources/backup/cron.yaml | 1 + src/main/resources/backup/secret.yaml | 1 + src/main/resources/nextcloud/deployment.yaml | 1 + src/main/resources/nextcloud/pvc.yaml | 1 + src/main/resources/nextcloud/secret.yaml | 1 + src/main/resources/nextcloud/service.yaml | 1 + src/test/cljc/dda/c4k_nextcloud/backup_test.cljc | 5 +++-- src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc | 7 ++++--- 11 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index 95ead37..72feec3 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -28,6 +28,7 @@ :pv-storage-size-gb 50 :pvc-storage-class-name default-storage-class} auth) + (ns/generate (merge {:namespace "nextcloud"} config)) [(nextcloud/generate-secret auth) (nextcloud/generate-pvc (merge nextcloud-default-storage-config config)) (nextcloud/generate-deployment config) diff --git a/src/main/resources/backup/backup-restore-deployment.yaml b/src/main/resources/backup/backup-restore-deployment.yaml index ffe9951..d560412 100644 --- a/src/main/resources/backup/backup-restore-deployment.yaml +++ b/src/main/resources/backup/backup-restore-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: backup-restore + namespace: nextcloud spec: replicas: 0 selector: diff --git a/src/main/resources/backup/config.yaml b/src/main/resources/backup/config.yaml index 17aa35c..e48e088 100644 --- a/src/main/resources/backup/config.yaml +++ b/src/main/resources/backup/config.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: backup-config + namespace: nextcloud labels: app.kubernetes.io/name: backup app.kubernetes.io/part-of: cloud diff --git a/src/main/resources/backup/cron.yaml b/src/main/resources/backup/cron.yaml index df933c8..0424ec6 100644 --- a/src/main/resources/backup/cron.yaml +++ b/src/main/resources/backup/cron.yaml @@ -2,6 +2,7 @@ apiVersion: batch/v1 kind: CronJob metadata: name: cloud-backup + namespace: nextcloud labels: app.kubernetes.part-of: cloud spec: diff --git a/src/main/resources/backup/secret.yaml b/src/main/resources/backup/secret.yaml index d345d7e..02a03eb 100644 --- a/src/main/resources/backup/secret.yaml +++ b/src/main/resources/backup/secret.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: backup-secret + namespace: nextcloud type: Opaque data: aws-access-key-id: "aws-access-key-id" diff --git a/src/main/resources/nextcloud/deployment.yaml b/src/main/resources/nextcloud/deployment.yaml index 1dd46da..676cfbc 100644 --- a/src/main/resources/nextcloud/deployment.yaml +++ b/src/main/resources/nextcloud/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: cloud-deployment + namespace: nextcloud spec: selector: matchLabels: diff --git a/src/main/resources/nextcloud/pvc.yaml b/src/main/resources/nextcloud/pvc.yaml index 029723b..76fb92d 100644 --- a/src/main/resources/nextcloud/pvc.yaml +++ b/src/main/resources/nextcloud/pvc.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: cloud-pvc + namespace: nextcloud labels: app.kubernetes.io/application: cloud spec: diff --git a/src/main/resources/nextcloud/secret.yaml b/src/main/resources/nextcloud/secret.yaml index 58d649b..e8f014d 100644 --- a/src/main/resources/nextcloud/secret.yaml +++ b/src/main/resources/nextcloud/secret.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: cloud-secret + namespace: nextcloud type: Opaque data: nextcloud-admin-user: "admin-user" diff --git a/src/main/resources/nextcloud/service.yaml b/src/main/resources/nextcloud/service.yaml index 2ef29e4..76b4ef2 100644 --- a/src/main/resources/nextcloud/service.yaml +++ b/src/main/resources/nextcloud/service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: cloud-service + namespace: nextcloud labels: app.kubernetes.io/name: cloud-service app.kubernetes.io/application: cloud diff --git a/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc b/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc index 3eb79c9..9a0ccfa 100644 --- a/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc @@ -8,7 +8,7 @@ (deftest should-generate-secret (is (= {:apiVersion "v1" :kind "Secret" - :metadata {:name "backup-secret"} + :metadata {:name "backup-secret", :namespace "nextcloud"} :type "Opaque" :data {:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}} @@ -18,6 +18,7 @@ (is (= {:apiVersion "v1" :kind "ConfigMap" :metadata {:name "backup-config" + :namespace "nextcloud" :labels {:app.kubernetes.io/name "backup" :app.kubernetes.io/part-of "cloud"}} :data @@ -27,7 +28,7 @@ (deftest should-generate-cron (is (= {:apiVersion "batch/v1" :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 {:schedule "10 23 * * *" :successfulJobsHistoryLimit 1 diff --git a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc index 8919c24..cb4ab1b 100644 --- a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc @@ -23,7 +23,7 @@ (deftest should-generate-secret (is (= {:apiVersion "v1" :kind "Secret" - :metadata {:name "cloud-secret"} + :metadata {:name "cloud-secret", :namespace "nextcloud"} :type "Opaque" :data {:nextcloud-admin-user "Y2xvdWRhZG1pbg==" @@ -77,7 +77,8 @@ (is (= {:apiVersion "v1" :kind "PersistentVolumeClaim" :metadata {:name "cloud-pvc" - :labels {:app.kubernetes.io/application "cloud"}} + :namespace "nextcloud" + :labels {:app.kubernetes.io/application "cloud"}} :spec {:storageClassName "local-path" :accessModes ["ReadWriteOnce"] :resources {:requests {:storage "50Gi"}}}} @@ -86,7 +87,7 @@ (deftest should-generate-deployment (is (= {:apiVersion "apps/v1" :kind "Deployment" - :metadata {:name "cloud-deployment"} + :metadata {:name "cloud-deployment", :namespace "nextcloud"} :spec {:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}} :strategy {:type "Recreate"}