Compare commits

...

3 commits

Author SHA1 Message Date
01914f8d16 bump version to: 3.4.4-SNAPSHOT 2024-07-09 14:51:47 +02:00
7ccdf13af8 release: 3.4.3 2024-07-09 14:51:47 +02:00
6122e9139b Lift postgres config from k8s-objects
Add merge namespace in let.
2024-07-09 14:48:52 +02:00
5 changed files with 29 additions and 26 deletions

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "c4k-forgejo" name = "c4k-forgejo"
MODULE = "backup" MODULE = "backup"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "3.4.3-dev" version = "3.4.4-dev"
@init @init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = 'c4k-forgejo' name = 'c4k-forgejo'
MODULE = 'federated' MODULE = 'federated'
PROJECT_ROOT_PATH = '../..' PROJECT_ROOT_PATH = '../..'
version = "3.4.3-dev" version = "3.4.4-dev"
@init @init
def initialize(project): def initialize(project):

View file

@ -2,7 +2,7 @@
"name": "c4k-forgejo", "name": "c4k-forgejo",
"description": "Generate c4k yaml for a forgejo deployment.", "description": "Generate c4k yaml for a forgejo deployment.",
"author": "meissa GmbH", "author": "meissa GmbH",
"version": "3.4.3-SNAPSHOT", "version": "3.4.4-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-forgejo#readme",
"repository": "https://www.npmjs.com/package/c4k-forgejo", "repository": "https://www.npmjs.com/package/c4k-forgejo",
"license": "APACHE2", "license": "APACHE2",

View file

@ -1,4 +1,4 @@
(defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.3-SNAPSHOT" (defproject org.domaindrivenarchitecture/c4k-forgejo "3.4.4-SNAPSHOT"
:description "forgejo c4k-installation package" :description "forgejo c4k-installation package"
:url "https://domaindrivenarchitecture.org" :url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0" :license {:name "Apache License, Version 2.0"

View file

@ -33,35 +33,38 @@
(def vol? (s/keys :req-un [::forgejo/volume-total-storage-size])) (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? (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 (map yaml/to-string
(filter #(not (nil? %)) (filter #(not (nil? %))
(cm/concat-vec (cm/concat-vec
(ns/generate (merge {:namespace "forgejo"} config)) (ns/generate resolved-config)
[(postgres/generate-config {:postgres-size :2gb [(postgres/generate-config resolved-config)
:db-name "forgejo" (postgres/generate-secret {:namespace "forgejo"} auth)
:namespace "forgejo"}) (when (contains? resolved-config :postgres-data-volume-path)
(postgres/generate-secret auth) (postgres/generate-persistent-volume (select-keys resolved-config [:postgres-data-volume-path :pv-storage-size-gb])))
(when (contains? config :postgres-data-volume-path) (postgres/generate-pvc (merge resolved-config {:pvc-storage-class-name storage-class}))
(postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path :pv-storage-size-gb]))) (postgres/generate-deployment resolved-config)
(postgres/generate-pvc {:pv-storage-size-gb 5 (postgres/generate-service resolved-config)
:pvc-storage-class-name storage-class}) (forgejo/generate-deployment resolved-config)
(postgres/generate-deployment {:postgres-image "postgres:14"
:postgres-size :2gb})
(postgres/generate-service config)
(forgejo/generate-deployment config)
(forgejo/generate-service) (forgejo/generate-service)
(forgejo/generate-service-ssh) (forgejo/generate-service-ssh)
(forgejo/generate-data-volume config) (forgejo/generate-data-volume resolved-config)
(forgejo/generate-appini-env config) (forgejo/generate-appini-env resolved-config)
(forgejo/generate-secrets auth) (forgejo/generate-secrets auth)
(forgejo/generate-rate-limit-middleware rate-limit-defaults)] ; this does not have a vector as output (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 (forgejo/generate-rate-limit-ingress-and-cert resolved-config) ; this function has a vector as output
(when (contains? config :restic-repository) (when (contains? resolved-config :restic-repository)
[(backup/generate-config config) [(backup/generate-config resolved-config)
(backup/generate-secret auth) (backup/generate-secret auth)
(backup/generate-cron) (backup/generate-cron)
(backup/generate-backup-restore-deployment config)]) (backup/generate-backup-restore-deployment resolved-config)])
(when (:contains? config :mon-cfg) (when (:contains? resolved-config :mon-cfg)
(mon/generate (:mon-cfg config) (:mon-auth auth)))))))) (mon/generate (:mon-cfg resolved-config) (:mon-auth auth))))))))