diff --git a/.gitignore b/.gitignore index 8263f5f..ab17090 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,28 @@ .clj-kondo/ .lsp/ + +# pybuilder +.pybuilder/ +__pycache__/ + +# lein target/ +.lein-repl-history +.lein-failures +pom.* + +# cljs +.shadow-cljs +.nrepl-* +package-lock.json +node_modules/ +public/js/ + +# ide +.calva + +*.iml +.idea/ + +auth.edn +config.edn diff --git a/src/main/cljc/dda/c4k_matomo/matomo.cljc b/src/main/cljc/dda/c4k_matomo/matomo.cljc index 8b66c1d..06fe237 100644 --- a/src/main/cljc/dda/c4k_matomo/matomo.cljc +++ b/src/main/cljc/dda/c4k_matomo/matomo.cljc @@ -13,10 +13,10 @@ (defmethod yaml/load-resource :matomo [resource-name] (case resource-name "matomo/certificate.yaml" (rc/inline "matomo/certificate.yaml") - "matomo/deployments.yaml" (rc/inline "matomo/deployments.yaml") - "matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml") - "matomo/services.yaml" (rc/inline "matomo/services.yaml") - "matomo/statefulset.yaml" (rc/inline "matomo/statefulset.yaml") + ;"matomo/deployments.yaml" (rc/inline "matomo/deployments.yaml") + ;"matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml") + ;"matomo/services.yaml" (rc/inline "matomo/services.yaml") + ;"matomo/statefulset.yaml" (rc/inline "matomo/statefulset.yaml") (throw (js/Error. "Undefined Resource!"))))) (defn generate-certificate [config] @@ -31,8 +31,8 @@ (defn generate-webserver-deployment [] (let [shynet-application "shynet-webserver"] (-> (yaml/from-string (yaml/load-resource "matomo/deployments-template.yaml")) - (cm/replace-named-value "shynet-application" shynet-application) - (dissoc [:spec :template :spec :containers 0] :command)))) + (cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application) + (update-in [:spec :template :spec :containers 0] dissoc :command)))) (defn generate-ingress [config] (let [{:keys [fqdn issuer] diff --git a/src/test/cljc/dda/c4k_matomo/matomo_test.cljc b/src/test/cljc/dda/c4k_matomo/matomo_test.cljc new file mode 100644 index 0000000..337688f --- /dev/null +++ b/src/test/cljc/dda/c4k_matomo/matomo_test.cljc @@ -0,0 +1,28 @@ +(ns dda.c4k-matomo.matomo-test + (:require + #?(:clj [clojure.test :refer [deftest is are testing run-tests]] + :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) + [dda.c4k-matomo.matomo :as cut])) + + +(deftest should-generate-webserver-deployment + (is (= {:apiVersion "apps/v1" + :kind "Deployment" + :metadata + {:name "shynet-webserver" + :namespace "default" + :labels {:app "shynet-webserver"}} + :spec + {:selector {:matchLabels {:app "shynet-webserver"}} + :strategy {:type "Recreate"} + :replicas 1 + :template + {:metadata {:labels {:app "shynet-webserver"}} + :spec + {:containers + [{:name "shynet-webserver" + :image "milesmcc/shynet:edge" + :imagePullPolicy "IfNotPresent" + :envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}} + (cut/generate-webserver-deployment)))) +