prep for release

This commit is contained in:
see 2022-05-13 15:58:07 +02:00
parent 2fab2a1335
commit c9f4bff103
4 changed files with 46 additions and 42 deletions

View file

@ -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"
}
}

View file

@ -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"

View file

@ -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}}

View file

@ -22,10 +22,14 @@
"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"))