From c9f4bff103ce3781cb4dc884d9cb9ae194e86e85 Mon Sep 17 00:00:00 2001 From: see Date: Fri, 13 May 2022 15:58:07 +0200 Subject: [PATCH] prep for release --- package.json | 64 ++++++++++++------------ project.clj | 2 +- shadow-cljs.edn | 2 +- src/main/cljc/dda/c4k_shynet/shynet.cljc | 20 +++++--- 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index c43988e..b538741 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,33 @@ { - "name": "c4k-shynet", - "description": "Generate c4k yaml for a shynet deployment.", - "author": "meissa GmbH", - "version": "1.0.6-SNAPSHOT", - "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet#readme", - "repository": "https://www.npmjs.com/package/c4k-shynet", - "license": "APACHE2", - "main": "c4k-shynet.js", - "bin": { - "c4k-shynet": "./c4k-shynet.js" - }, - "keywords": [ - "cljs", - "shynet", - "k8s", - "c4k", - "deployment", - "yaml", - "convention4kubernetes" - ], - "bugs": { - "url": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet/issues" - }, - "dependencies": { - "js-base64": "^3.6.1", - "js-yaml": "^4.0.0" - }, - "devDependencies": { - "shadow-cljs": "^2.11.18", - "source-map-support": "^0.5.19" - } -} + "name": "c4k-shynet", + "description": "Generate c4k yaml for a shynet deployment.", + "author": "meissa GmbH", + "version": "1.0.6", + "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet#readme", + "repository": "https://www.npmjs.com/package/c4k-shynet", + "license": "APACHE2", + "main": "c4k-shynet.js", + "bin": { + "c4k-shynet": "./c4k-shynet.js" + }, + "keywords": [ + "cljs", + "shynet", + "k8s", + "c4k", + "deployment", + "yaml", + "convention4kubernetes" + ], + "bugs": { + "url": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet/issues" + }, + "dependencies": { + "js-base64": "^3.6.1", + "js-yaml": "^4.0.0" + }, + "devDependencies": { + "shadow-cljs": "^2.11.18", + "source-map-support": "^0.5.19" + } +} \ No newline at end of file diff --git a/project.clj b/project.clj index 75d8148..4f688ff 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.10.3"] [org.clojure/tools.reader "1.3.6"] - [org.domaindrivenarchitecture/c4k-common-clj "2.0.1"] + [org.domaindrivenarchitecture/c4k-common-clj "2.0.3"] [hickory "0.7.1"]] :target-path "target/%s/" :source-paths ["src/main/cljc" diff --git a/shadow-cljs.edn b/shadow-cljs.edn index cc54411..58c87c7 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -4,7 +4,7 @@ "src/test/cljc" "src/test/cljs" "src/test/resources"] - :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "2.0.1"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "2.0.3"] [hickory "0.7.1"]] :builds {:frontend {:target :browser :modules {:main {:init-fn dda.c4k-shynet.browser/init}} diff --git a/src/main/cljc/dda/c4k_shynet/shynet.cljc b/src/main/cljc/dda/c4k_shynet/shynet.cljc index b0dd2b1..06392e7 100644 --- a/src/main/cljc/dda/c4k_shynet/shynet.cljc +++ b/src/main/cljc/dda/c4k_shynet/shynet.cljc @@ -21,11 +21,15 @@ "shynet/service-webserver.yaml" (rc/inline "shynet/service-webserver.yaml") "shynet/statefulset.yaml" (rc/inline "shynet/statefulset.yaml") (throw (js/Error. "Undefined Resource!"))))) + +#?(:cljs + (defmethod yaml/load-as-edn :shynet [resource-name] + (yaml/from-string (yaml/load-resource resource-name)))) (defn generate-secret [config] (let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config] (-> - (yaml/from-string (yaml/load-resource "shynet/secret.yaml")) + (yaml/load-as-edn "shynet/secret.yaml") ; TODO: See comment in secret.yaml ;(assoc-in [:stringData :ALLOWED_HOSTS] fqdn) (assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key) @@ -36,20 +40,20 @@ (let [{:keys [fqdn issuer]} config letsencrypt-issuer (name issuer)] (-> - (yaml/from-string (yaml/load-resource "shynet/certificate.yaml")) + (yaml/load-as-edn "shynet/certificate.yaml") (assoc-in [:spec :commonName] fqdn) (assoc-in [:spec :dnsNames] [fqdn]) (assoc-in [:spec :issuerRef :name] letsencrypt-issuer)))) (defn generate-webserver-deployment [] (let [shynet-application "shynet-webserver"] - (-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml")) + (-> (yaml/load-as-edn "shynet/deployments.yaml") (cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application) (update-in [:spec :template :spec :containers 0] dissoc :command)))) (defn generate-celeryworker-deployment [] (let [shynet-application "shynet-celeryworker"] - (-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml")) + (-> (yaml/load-as-edn "shynet/deployments.yaml") (cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application)))) (defn generate-ingress [config] @@ -57,15 +61,15 @@ :or {issuer :staging}} config letsencrypt-issuer (name issuer)] (-> - (yaml/from-string (yaml/load-resource "shynet/ingress.yaml")) + (yaml/load-as-edn "shynet/ingress.yaml") (assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer) (cm/replace-all-matching-values-by-new-value "fqdn" fqdn)))) (defn generate-statefulset [] - (yaml/from-string (yaml/load-resource "shynet/statefulset.yaml"))) + (yaml/load-as-edn "shynet/statefulset.yaml")) (defn generate-service-redis [] - (yaml/from-string (yaml/load-resource "shynet/service-redis.yaml"))) + (yaml/load-as-edn "shynet/service-redis.yaml")) (defn generate-service-webserver [] - (yaml/from-string (yaml/load-resource "shynet/service-webserver.yaml"))) + (yaml/load-as-edn "shynet/service-webserver.yaml"))