Compare commits

..

No commits in common. "5f1626f488c787cf65101a7d42ed27ecf2602f37" and "46283232e90d494df6d5a4cb48802d120ff4b671" have entirely different histories.

11 changed files with 88 additions and 194 deletions

View file

@ -28,7 +28,7 @@
(s/def ::mon-cfg ::mon/mon-cfg) (s/def ::mon-cfg ::mon/mon-cfg)
(s/def ::mon-auth ::mon/mon-auth) (s/def ::mon-auth ::mon/mon-auth)
(s/def ::taiga-secret-key cp/bash-env-string?) (s/def ::taiga-secret cp/bash-env-string?)
(s/def ::mailer-user string?) (s/def ::mailer-user string?)
(s/def ::mailer-pw string?) (s/def ::mailer-pw string?)
(s/def ::django-superuser-username string?) (s/def ::django-superuser-username string?)
@ -50,7 +50,7 @@
(def auth? (s/keys :req-un [::postgres/postgres-db-user (def auth? (s/keys :req-un [::postgres/postgres-db-user
::postgres/postgres-db-password ::postgres/postgres-db-password
::taiga-secret-key ::taiga-secret
::mailer-pw ::mailer-pw
::mailer-user ::mailer-user
::django-superuser-email ::django-superuser-email
@ -88,8 +88,7 @@
"taiga/front-deployment.yaml" (rc/inline "taiga/front-deployment.yaml") "taiga/front-deployment.yaml" (rc/inline "taiga/front-deployment.yaml")
"taiga/front-service.yaml" (rc/inline "taiga/front-service.yaml") "taiga/front-service.yaml" (rc/inline "taiga/front-service.yaml")
"taiga/gateway-service.yaml" (rc/inline "taiga/gateway-service.yaml") "taiga/gateway-service.yaml" (rc/inline "taiga/gateway-service.yaml")
"taiga/pvc-taiga-media-data.yaml" (rc/inline "taiga/pvc-taiga-media-data.yaml") "taiga/data-pvcs.yaml" (rc/inline "taiga/data-pvcs.yaml")
"taiga/pvc-taiga-static-data.yaml" (rc/inline "taiga/pvc-taiga-static-data.yaml")
"taiga/async-rabbitmq-deployment.yaml" (rc/inline "taiga/async-rabbitmq-deployment.yaml") "taiga/async-rabbitmq-deployment.yaml" (rc/inline "taiga/async-rabbitmq-deployment.yaml")
"taiga/protected-service.yaml" (rc/inline "taiga/protected-service.yaml") "taiga/protected-service.yaml" (rc/inline "taiga/protected-service.yaml")
"taiga/secret.yaml" (rc/inline "taiga/secret.yaml") "taiga/secret.yaml" (rc/inline "taiga/secret.yaml")
@ -97,8 +96,7 @@
"taiga/events-service.yaml" (rc/inline "taiga/events-service.yaml") "taiga/events-service.yaml" (rc/inline "taiga/events-service.yaml")
"taiga/back-service.yaml" (rc/inline "taiga/back-service.yaml") "taiga/back-service.yaml" (rc/inline "taiga/back-service.yaml")
"taiga/events-rabbitmq-service.yaml" (rc/inline "taiga/events-rabbitmq-service.yaml") "taiga/events-rabbitmq-service.yaml" (rc/inline "taiga/events-rabbitmq-service.yaml")
"taiga/rabbitmq-pvc-async.yaml" (rc/inline "taiga/rabbitmq-pvc-async.yaml") "taiga/rabbitmq-pvc.yaml" (rc/inline "taiga/rabbitmq-pvc.yaml")
"taiga/rabbitmq-pvc-events.yaml" (rc/inline "taiga/rabbitmq-pvc-events.yaml")
(throw (js/Error. "Undefined Resource!"))))) (throw (js/Error. "Undefined Resource!")))))
(defn-spec generate-ingress-and-cert cp/map-or-seq? (defn-spec generate-ingress-and-cert cp/map-or-seq?
@ -109,6 +107,7 @@
:service-port 80} :service-port 80}
config))) config)))
; TODO; postgres genenration
; TODO: Check which ones need configuration or authentication information ; TODO: Check which ones need configuration or authentication information
(defn-spec generate-events-rabbitmq-deployment cp/map-or-seq? [] (defn-spec generate-events-rabbitmq-deployment cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/events-rabbitmq-deployment.yaml"))) (yaml/from-string (yaml/load-resource "taiga/events-rabbitmq-deployment.yaml")))
@ -122,11 +121,8 @@
(defn-spec generate-gateway-configmap cp/map-or-seq? [] (defn-spec generate-gateway-configmap cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/gateway-configmap.yaml"))) (yaml/from-string (yaml/load-resource "taiga/gateway-configmap.yaml")))
(defn-spec generate-configmap cp/map-or-seq? (defn-spec generate-configmap cp/map-or-seq? []
[config config?] (yaml/from-string (yaml/load-resource "taiga/configmap.yaml")))
(let [{:keys [fqdn]} config]
(-> (yaml/load-as-edn "taiga/configmap.yaml")
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
(defn-spec generate-async-service cp/map-or-seq? [] (defn-spec generate-async-service cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/async-service.yaml"))) (yaml/from-string (yaml/load-resource "taiga/async-service.yaml")))
@ -149,13 +145,8 @@
(defn-spec generate-gateway-service cp/map-or-seq? [] (defn-spec generate-gateway-service cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/gateway-service.yaml"))) (yaml/from-string (yaml/load-resource "taiga/gateway-service.yaml")))
(defn-spec generate-pvc-taiga-media-data cp/map-or-seq? (defn-spec generate-data-pvcs cp/map-or-seq? []
[config config?] (yaml/from-string (yaml/load-resource "taiga/data-pvcs.yaml")))
(yaml/from-string (yaml/load-resource "taiga/pvc-taiga-media-data.yaml")))
(defn-spec generate-pvc-taiga-static-data cp/map-or-seq?
[config config?]
(yaml/from-string (yaml/load-resource "taiga/pvc-taiga-static-data.yaml")))
(defn-spec generate-async-rabbitmq-deployment cp/map-or-seq? [] (defn-spec generate-async-rabbitmq-deployment cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/async-rabbitmq-deployment.yaml"))) (yaml/from-string (yaml/load-resource "taiga/async-rabbitmq-deployment.yaml")))
@ -163,8 +154,7 @@
(defn-spec generate-protected-service cp/map-or-seq? [] (defn-spec generate-protected-service cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/protected-service.yaml"))) (yaml/from-string (yaml/load-resource "taiga/protected-service.yaml")))
(defn-spec generate-secret cp/map-or-seq? (defn-spec generate-secret cp/map-or-seq? []
[auth auth?]
(yaml/from-string (yaml/load-resource "taiga/secret.yaml"))) (yaml/from-string (yaml/load-resource "taiga/secret.yaml")))
(defn-spec generate-async-rabbitmq-service cp/map-or-seq? [] (defn-spec generate-async-rabbitmq-service cp/map-or-seq? []
@ -179,11 +169,6 @@
(defn-spec generate-events-rabbitmq-service cp/map-or-seq? [] (defn-spec generate-events-rabbitmq-service cp/map-or-seq? []
(yaml/from-string (yaml/load-resource "taiga/events-rabbitmq-service.yaml"))) (yaml/from-string (yaml/load-resource "taiga/events-rabbitmq-service.yaml")))
(defn-spec generate-rabbitmq-pvc-async cp/map-or-seq? (defn-spec generate-rabbitmq-pvc cp/map-or-seq? []
[config config?] (yaml/from-string (yaml/load-resource "taiga/rabbitmq-pvc.yaml")))
(yaml/from-string (yaml/load-resource "taiga/rabbitmq-pvc-async.yaml")))
(defn-spec generate-rabbitmq-pvc-events cp/map-or-seq?
[config config?]
(yaml/from-string (yaml/load-resource "taiga/rabbitmq-pvc-events.yaml")))

View file

@ -0,0 +1,31 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-media-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-static-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-media-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-static-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-async-rabbitmq-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-events-rabbitmq-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -0,0 +1,31 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-async-rabbitmq-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: taiga-events-rabbitmq-data
namespace: default
labels:
app: taiga
app.kubernetes.part-of: taiga
spec:
storageClassName: REPLACEME
accessModes:
- ReadWriteOnce
resources:
requests:
storage: REPLACEME

View file

@ -5,15 +5,14 @@
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) :cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.c4k-common.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-taiga.core :as cut])) [dda.c4k-taiga.core :as cut]
[clojure.spec.alpha :as s]))
#?(:cljs #?(:cljs
(defmethod yaml/load-resource :website-test [resource-name] (defmethod yaml/load-resource :website-test [resource-name]
(case resource-name (case resource-name
"taiga-test/valid-config.yaml" (rc/inline "taiga-test/valid-config.yaml")
"taiga-test/valid-auth.yaml" (rc/inline "taiga-test/valid-auth.yaml")
(throw (js/Error. "Undefined Resource!"))))) (throw (js/Error. "Undefined Resource!")))))
(deftest validate-valid-resources (deftest validate-valid-resources
(is (s/valid? cut/config? (yaml/load-as-edn "taiga-test/valid-config.yaml"))) ;(is (s/valid? cut/config? (yaml/load-as-edn "website-test/valid-config.yaml")))
(is (s/valid? cut/auth? (yaml/load-as-edn "taiga-test/valid-auth.yaml")))) )

View file

@ -5,100 +5,8 @@
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) :cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.c4k-common.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-taiga.taiga :as cut])) [dda.c4k-taiga.core :as cut]
[clojure.spec.alpha :as s]))
#?(:cljs (deftest dummy-taiga-test
(defmethod yaml/load-resource :website-test [resource-name] (is true))
(case resource-name
"taiga-test/valid-config.yaml" (rc/inline "taiga-test/valid-config.yaml")
"taiga-test/valid-auth.yaml" (rc/inline "taiga-test/valid-auth.yaml")
(throw (js/Error. "Undefined Resource!")))))
(deftest should-generate-configmap
(is (= {:apiVersion "v1",
:kind "ConfigMap",
:metadata {:name "taiga-configmap", :namespace "default"},
:data
{:ENABLE_TELEMETRY "false",
:TAIGA_SITES_SCHEME "https",
:TAIGA_SITES_DOMAIN "taiga.test.meissa.de",
:TAIGA_SUBPATH "",
:TAIGA_URL "https://taiga.test.meissa.de",
:TAIGA_WEBSOCKETS_URL "wss://taiga.test.meissa.de",
:PUBLIC_REGISTER_ENABLED "false",
:ENABLE_GITHUB_IMPORTER "false",
:ENABLE_JIRA_IMPORTER "false",
:ENABLE_TRELLO_IMPORTER "false",
:RABBITMQ_DEFAULT_VHOST "taiga",
:SESSION_COOKIE_SECURE "false",
:CSRF_COOKIE_SECURE "false"}}
(cut/generate-configmap (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
(deftest should-generate-pvc-taiga-media-data
(is (= {:apiVersion "v1",
:kind "PersistentVolumeClaim",
:metadata
{:name "taiga-media-data",
:namespace "default",
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
:spec
{:storageClassName "local-path",
:accessModes ["ReadWriteOnce"],
:resources {:requests {:storage "5"}}}}
(cut/generate-pvc-taiga-media-data (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
(deftest should-generate-pvc-taiga-static-data
(is (= {:apiVersion "v1",
:kind "PersistentVolumeClaim",
:metadata
{:name "taiga-media-data",
:namespace "default",
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
:spec
{:storageClassName "local-path",
:accessModes ["ReadWriteOnce"],
:resources {:requests {:storage "5"}}}}
(cut/generate-pvc-taiga-static-data (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
(deftest should-generate-rabbitmq-pvc-async
(is (= {:apiVersion "v1",
:kind "PersistentVolumeClaim",
:metadata
{:name "taiga-media-data",
:namespace "default",
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
:spec
{:storageClassName "local-path",
:accessModes ["ReadWriteOnce"],
:resources {:requests {:storage "5"}}}}
(cut/generate-rabbitmq-pvc-async(yaml/load-as-edn "taiga-test/valid-config.yaml")))))
(deftest should-generate-rabbitmq-pvc-events
(is (= {:apiVersion "v1",
:kind "PersistentVolumeClaim",
:metadata
{:name "taiga-media-data",
:namespace "default",
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
:spec
{:storageClassName "local-path",
:accessModes ["ReadWriteOnce"],
:resources {:requests {:storage "5"}}}}
(cut/generate-rabbitmq-pvc-events (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
(deftest should-generate-secret
(is (= {:apiVersion "v1",
:kind "Secret",
:metadata
{:name "taiga-secret", :labels {:app.kubernetes.part-of "taiga"}},
:data
{:TAIGA_SECRET_KEY "some-key",
:EMAIL_HOST_USER "mailer-user",
:EMAIL_HOST_PASSWORD "mailer-pw",
:RABBITMQ_USER "rabbit-user",
:RABBITMQ_PASS "rabbit-pw",
:RABBITMQ_ERLANG_COOKIE "rabbit-erlang",
:DJANGO_SUPERUSER_USERNAME "taiga-admin",
:DJANGO_SUPERUSER_PASSWORD "super-password",
:DJANGO_SUPERUSER_EMAIL "some@example.com"}}
(cut/generate-secret (yaml/load-as-edn "taiga-test/valid-auth.yaml")))))

View file

@ -1,14 +1,14 @@
taiga-secret-key: "some-key" taiga-secret-key: "some-key"
postgres-db-user: "forgejo" postgres-db-user: "forgejo"
postgres-db-password: "forgejo-db-password" postgres-db-password: "forgejo-db-password"
mailer-user: "mailer-user" mailer-user: ""
mailer-pw: "mailer-pw" mailer-pw: ""
django-superuser-username: "taiga-admin" django-superuser-username: "taiga-admin"
django-superuser-password: "super-password" django-superuser-password: ""
django-superuser-email: "some@example.com" django-superuser-email: "some@example.com"
rabbitmq-user: "rabbit-user" rabbitmq-user: ""
rabbitmq-pw: "rabbit-pw" rabbitmq-pw: ""
rabbitmq-erlang-cookie: "rabbit-erlang" rabbitmq-erlang-cookie: ""
mon-auth: mon-auth:
grafana-cloud-user: "user" grafana-cloud-user: "user"
grafana-cloud-password: "password" grafana-cloud-password: "password"