From b5b45f8c1c089550d17ae4f13f1057186a0e5fcc Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 12:04:02 +0200 Subject: [PATCH 1/7] Add missing namespace kw --- src/main/cljc/dda/c4k_forgejo/core.cljc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/cljc/dda/c4k_forgejo/core.cljc b/src/main/cljc/dda/c4k_forgejo/core.cljc index c2a19aa..b181dd2 100644 --- a/src/main/cljc/dda/c4k_forgejo/core.cljc +++ b/src/main/cljc/dda/c4k_forgejo/core.cljc @@ -39,7 +39,9 @@ (filter #(not (nil? %)) (cm/concat-vec (ns/generate (merge {:namespace "forgejo"} config)) - [(postgres/generate-config {:postgres-size :2gb :db-name "forgejo"}) + [(postgres/generate-config {:postgres-size :2gb + :db-name "forgejo" + :namespace "forgejo"}) (postgres/generate-secret auth) (when (contains? config :postgres-data-volume-path) (postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path :pv-storage-size-gb]))) From 574cc0f76b32bc683ad82e725c4a89c6f83deca0 Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 12:04:14 +0200 Subject: [PATCH 2/7] Use non deprecated functions --- src/main/cljc/dda/c4k_forgejo/forgejo.cljc | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/cljc/dda/c4k_forgejo/forgejo.cljc b/src/main/cljc/dda/c4k_forgejo/forgejo.cljc index b9de1f8..10f35f4 100644 --- a/src/main/cljc/dda/c4k_forgejo/forgejo.cljc +++ b/src/main/cljc/dda/c4k_forgejo/forgejo.cljc @@ -100,15 +100,15 @@ deploy-federated-bool (boolean-from-string deploy-federated)] (-> (yaml/load-as-edn "forgejo/appini-env-configmap.yaml") - (cm/replace-all-matching-values-by-new-value "APPNAME" default-app-name) - (cm/replace-all-matching-values-by-new-value "FQDN" fqdn) - (cm/replace-all-matching-values-by-new-value "URL" (str "https://" fqdn)) - (cm/replace-all-matching-values-by-new-value "FROM" mailer-from) - (cm/replace-all-matching-values-by-new-value "MAILERHOST" mailer-host) - (cm/replace-all-matching-values-by-new-value "MAILERPORT" mailer-port) - (cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" service-domain-whitelist) - (cm/replace-all-matching-values-by-new-value "NOREPLY" service-noreply-address) - (cm/replace-all-matching-values-by-new-value "IS_FEDERATED" + (cm/replace-all-matching "APPNAME" default-app-name) + (cm/replace-all-matching "FQDN" fqdn) + (cm/replace-all-matching "URL" (str "https://" fqdn)) + (cm/replace-all-matching "FROM" mailer-from) + (cm/replace-all-matching "MAILERHOST" mailer-host) + (cm/replace-all-matching "MAILERPORT" mailer-port) + (cm/replace-all-matching "WHITELISTDOMAINS" service-domain-whitelist) + (cm/replace-all-matching "NOREPLY" service-noreply-address) + (cm/replace-all-matching "IS_FEDERATED" (if deploy-federated-bool "true" "false"))))) @@ -121,10 +121,10 @@ mailer-pw]} auth] (-> (yaml/load-as-edn "forgejo/secrets.yaml") - (cm/replace-all-matching-values-by-new-value "DBUSER" (b64/encode postgres-db-user)) - (cm/replace-all-matching-values-by-new-value "DBPW" (b64/encode postgres-db-password)) - (cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode mailer-user)) - (cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailer-pw))))) + (cm/replace-all-matching "DBUSER" (b64/encode postgres-db-user)) + (cm/replace-all-matching "DBPW" (b64/encode postgres-db-password)) + (cm/replace-all-matching "MAILERUSER" (b64/encode mailer-user)) + (cm/replace-all-matching "MAILERPW" (b64/encode mailer-pw))))) (defn generate-ingress-and-cert [config] @@ -162,7 +162,7 @@ data-storage-size (data-storage-by-volume-size volume-total-storage-size)] (-> (yaml/load-as-edn "forgejo/datavolume.yaml") - (cm/replace-all-matching-values-by-new-value "DATASTORAGESIZE" (str (str data-storage-size) "Gi"))))) + (cm/replace-all-matching "DATASTORAGESIZE" (str (str data-storage-size) "Gi"))))) (defn-spec generate-deployment pred/map-or-seq? [config config?] @@ -170,7 +170,7 @@ deploy-federated-bool (boolean-from-string deploy-federated)] (-> (yaml/load-as-edn "forgejo/deployment.yaml") - (cm/replace-all-matching-values-by-new-value "IMAGE_NAME" (generate-image-str config))))) + (cm/replace-all-matching "IMAGE_NAME" (generate-image-str config))))) (defn generate-service [] From 665008c1aa23ebcea22060c0abb4683e6782484c Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 12:07:26 +0200 Subject: [PATCH 3/7] release: 3.4.2 --- infrastructure/backup/build.py | 2 +- infrastructure/federated/build.py | 2 +- package.json | 2 +- project.clj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index 9851f14..2b94d3b 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "c4k-forgejo" MODULE = "backup" PROJECT_ROOT_PATH = "../.." -version = "3.4.2-dev" +version = "3.4.2" @init diff --git a/infrastructure/federated/build.py b/infrastructure/federated/build.py index eb3c186..bb96c18 100644 --- a/infrastructure/federated/build.py +++ b/infrastructure/federated/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = 'c4k-forgejo' MODULE = 'federated' PROJECT_ROOT_PATH = '../..' -version = "3.4.2-dev" +version = "3.4.2" @init def initialize(project): diff --git a/package.json b/package.json index bfb5e0a..4da6ad8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "c4k-forgejo", "description": "Generate c4k yaml for a forgejo deployment.", "author": "meissa GmbH", - "version": "3.4.2-SNAPSHOT", + "version": "3.4.2", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme", "repository": "https://www.npmjs.com/package/c4k-forgejo", "license": "APACHE2", diff --git a/project.clj b/project.clj index 128488f..4fa50f4 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.2-SNAPSHOT" +(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.2" :description "forgejo c4k-installation package" :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0" From 076bfd4d72c749dbbfca13396cca70fc15225430 Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 12:07:26 +0200 Subject: [PATCH 4/7] bump version to: 3.4.3-SNAPSHOT --- infrastructure/backup/build.py | 2 +- infrastructure/federated/build.py | 2 +- package.json | 2 +- project.clj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index 2b94d3b..eabcf0c 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "c4k-forgejo" MODULE = "backup" PROJECT_ROOT_PATH = "../.." -version = "3.4.2" +version = "3.4.3-dev" @init diff --git a/infrastructure/federated/build.py b/infrastructure/federated/build.py index bb96c18..aac0fe3 100644 --- a/infrastructure/federated/build.py +++ b/infrastructure/federated/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = 'c4k-forgejo' MODULE = 'federated' PROJECT_ROOT_PATH = '../..' -version = "3.4.2" +version = "3.4.3-dev" @init def initialize(project): diff --git a/package.json b/package.json index 4da6ad8..de5b64a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "c4k-forgejo", "description": "Generate c4k yaml for a forgejo deployment.", "author": "meissa GmbH", - "version": "3.4.2", + "version": "3.4.3-SNAPSHOT", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme", "repository": "https://www.npmjs.com/package/c4k-forgejo", "license": "APACHE2", diff --git a/project.clj b/project.clj index 4fa50f4..b4dfdb7 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.2" +(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.3-SNAPSHOT" :description "forgejo c4k-installation package" :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0" From 6122e9139b59a3575e6bdcd01a58ce7e85f9df3e Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 14:29:07 +0200 Subject: [PATCH 5/7] Lift postgres config from k8s-objects Add merge namespace in let. --- src/main/cljc/dda/c4k_forgejo/core.cljc | 47 +++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/main/cljc/dda/c4k_forgejo/core.cljc b/src/main/cljc/dda/c4k_forgejo/core.cljc index b181dd2..7d42c62 100644 --- a/src/main/cljc/dda/c4k_forgejo/core.cljc +++ b/src/main/cljc/dda/c4k_forgejo/core.cljc @@ -33,35 +33,38 @@ (def vol? (s/keys :req-un [::forgejo/volume-total-storage-size])) +(def postgres-config {:db-name "forgejo" + :pv-storage-size-gb 5 + :pvc-storage-class-name "" + :postgres-image "postgres:14" + :postgres-size :2gb}) + (defn k8s-objects [config auth] ; ToDo: ADR for generate functions - vector or no vector? - (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] + (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path) + resolved-config (merge {:namespace "forgejo"} postgres-config config)] (map yaml/to-string (filter #(not (nil? %)) (cm/concat-vec - (ns/generate (merge {:namespace "forgejo"} config)) - [(postgres/generate-config {:postgres-size :2gb - :db-name "forgejo" - :namespace "forgejo"}) - (postgres/generate-secret auth) - (when (contains? config :postgres-data-volume-path) - (postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path :pv-storage-size-gb]))) - (postgres/generate-pvc {:pv-storage-size-gb 5 - :pvc-storage-class-name storage-class}) - (postgres/generate-deployment {:postgres-image "postgres:14" - :postgres-size :2gb}) - (postgres/generate-service config) - (forgejo/generate-deployment config) + (ns/generate resolved-config) + [(postgres/generate-config resolved-config) + (postgres/generate-secret {:namespace "forgejo"} auth) + (when (contains? resolved-config :postgres-data-volume-path) + (postgres/generate-persistent-volume (select-keys resolved-config [:postgres-data-volume-path :pv-storage-size-gb]))) + (postgres/generate-pvc (merge resolved-config {:pvc-storage-class-name storage-class})) + (postgres/generate-deployment resolved-config) + (postgres/generate-service resolved-config) + (forgejo/generate-deployment resolved-config) (forgejo/generate-service) (forgejo/generate-service-ssh) - (forgejo/generate-data-volume config) - (forgejo/generate-appini-env config) + (forgejo/generate-data-volume resolved-config) + (forgejo/generate-appini-env resolved-config) (forgejo/generate-secrets auth) (forgejo/generate-rate-limit-middleware rate-limit-defaults)] ; this does not have a vector as output - (forgejo/generate-rate-limit-ingress-and-cert (merge {:namespace "forgejo"} config)) ; this function has a vector as output - (when (contains? config :restic-repository) - [(backup/generate-config config) + (forgejo/generate-rate-limit-ingress-and-cert resolved-config) ; this function has a vector as output + (when (contains? resolved-config :restic-repository) + [(backup/generate-config resolved-config) (backup/generate-secret auth) (backup/generate-cron) - (backup/generate-backup-restore-deployment config)]) - (when (:contains? config :mon-cfg) - (mon/generate (:mon-cfg config) (:mon-auth auth)))))))) + (backup/generate-backup-restore-deployment resolved-config)]) + (when (:contains? resolved-config :mon-cfg) + (mon/generate (:mon-cfg resolved-config) (:mon-auth auth)))))))) From 7ccdf13af8e8dbc614dfabdbb64596271b2ce525 Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 14:51:47 +0200 Subject: [PATCH 6/7] release: 3.4.3 --- infrastructure/backup/build.py | 2 +- infrastructure/federated/build.py | 2 +- package.json | 2 +- project.clj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index eabcf0c..20eed90 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "c4k-forgejo" MODULE = "backup" PROJECT_ROOT_PATH = "../.." -version = "3.4.3-dev" +version = "3.4.3" @init diff --git a/infrastructure/federated/build.py b/infrastructure/federated/build.py index aac0fe3..7d8e7b9 100644 --- a/infrastructure/federated/build.py +++ b/infrastructure/federated/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = 'c4k-forgejo' MODULE = 'federated' PROJECT_ROOT_PATH = '../..' -version = "3.4.3-dev" +version = "3.4.3" @init def initialize(project): diff --git a/package.json b/package.json index de5b64a..d2ce703 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "c4k-forgejo", "description": "Generate c4k yaml for a forgejo deployment.", "author": "meissa GmbH", - "version": "3.4.3-SNAPSHOT", + "version": "3.4.3", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme", "repository": "https://www.npmjs.com/package/c4k-forgejo", "license": "APACHE2", diff --git a/project.clj b/project.clj index b4dfdb7..475007d 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.3-SNAPSHOT" +(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.3" :description "forgejo c4k-installation package" :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0" From 01914f8d16128d5bc83032af86414b8006c6331c Mon Sep 17 00:00:00 2001 From: patdyn Date: Tue, 9 Jul 2024 14:51:47 +0200 Subject: [PATCH 7/7] bump version to: 3.4.4-SNAPSHOT --- infrastructure/backup/build.py | 2 +- infrastructure/federated/build.py | 2 +- package.json | 2 +- project.clj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py index 20eed90..4503c5f 100644 --- a/infrastructure/backup/build.py +++ b/infrastructure/backup/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = "c4k-forgejo" MODULE = "backup" PROJECT_ROOT_PATH = "../.." -version = "3.4.3" +version = "3.4.4-dev" @init diff --git a/infrastructure/federated/build.py b/infrastructure/federated/build.py index 7d8e7b9..8001247 100644 --- a/infrastructure/federated/build.py +++ b/infrastructure/federated/build.py @@ -6,7 +6,7 @@ from ddadevops import * name = 'c4k-forgejo' MODULE = 'federated' PROJECT_ROOT_PATH = '../..' -version = "3.4.3" +version = "3.4.4-dev" @init def initialize(project): diff --git a/package.json b/package.json index d2ce703..814ba93 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "c4k-forgejo", "description": "Generate c4k yaml for a forgejo deployment.", "author": "meissa GmbH", - "version": "3.4.3", + "version": "3.4.4-SNAPSHOT", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme", "repository": "https://www.npmjs.com/package/c4k-forgejo", "license": "APACHE2", diff --git a/project.clj b/project.clj index 475007d..a08839f 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.3" +(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.4-SNAPSHOT" :description "forgejo c4k-installation package" :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0"