implement-c4k-and-provs #1
2 changed files with 59 additions and 3 deletions
|
@ -16,8 +16,9 @@
|
||||||
(s/def ::k3s-provision-user pred/bash-env-string?)
|
(s/def ::k3s-provision-user pred/bash-env-string?)
|
||||||
(s/def ::config
|
(s/def ::config
|
||||||
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug
|
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug
|
||||||
::d/dry-run ::d/module ::c4k-d/c4k-output-filenname
|
::d/dry-run ::c4k-d/c4k-output-filename
|
||||||
::email ::echo ::k3s-output-filename ::k3s-provision-user]))
|
::email ::echo ::k3s-output-filename ::k3s-provision-user]
|
||||||
|
:opt-un [::d/module]))
|
||||||
(s/def ::node
|
(s/def ::node
|
||||||
(s/keys :req-un [::ipv4 ::ipv6]))
|
(s/keys :req-un [::ipv4 ::ipv6]))
|
||||||
(s/def ::letsencryptEndpoint pred/letsencrypt-issuer?)
|
(s/def ::letsencryptEndpoint pred/letsencrypt-issuer?)
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
tf-out ::c4k-d/tf-out]
|
tf-out ::c4k-d/tf-out]
|
||||||
(let [{:keys [k3s-output-filename k3s-provision-user]} config
|
(let [{:keys [k3s-output-filename k3s-provision-user]} config
|
||||||
fqdn (get-in tf-out [:out :value :fqdn])]
|
fqdn (get-in tf-out [:out :value :fqdn])]
|
||||||
[["provs-server.jar" "k3s" (str k3s-provision-user "@" fqdn) "-c" (output-path config) "-a" (c4k-d/output-path config)]]))
|
["provs-server.jar" "k3s" (str k3s-provision-user "@" fqdn) "-c" (output-path config) "-a" (c4k-d/output-path config)]))
|
||||||
|
|
||||||
(defn-spec create-k3s-config map?
|
(defn-spec create-k3s-config map?
|
||||||
[config ::config
|
[config ::config
|
||||||
|
|
55
test/dda/build/provs/domain_test.clj
Normal file
55
test/dda/build/provs/domain_test.clj
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
(ns dda.build.provs.domain-test
|
||||||
|
(:require
|
||||||
|
[clojure.test :refer [deftest is]]
|
||||||
|
[clojure.spec.test.alpha :as st]
|
||||||
|
[dda.build.provs.domain :as cut]))
|
||||||
|
|
||||||
|
(st/instrument `cut/output-path)
|
||||||
|
(st/instrument `cut/provs-server-command)
|
||||||
|
(st/instrument `cut/create-k3s-config)
|
||||||
|
|
||||||
|
(deftest should-calculate-output-path
|
||||||
|
(is (= "../../target/dda-backup/k3s-out.yaml"
|
||||||
|
(cut/output-path {:name "dda-backup"
|
||||||
|
:project-root-path "../.."
|
||||||
|
:build-dir-name "target"
|
||||||
|
:version "4.11.8-dev"
|
||||||
|
:stage "dev"
|
||||||
|
:debug false
|
||||||
|
:dry-run false
|
||||||
|
:c4k-output-filename "out.yaml"
|
||||||
|
:k3s-provision-user "root"
|
||||||
|
:k3s-output-filename "k3s-out.yaml"
|
||||||
|
:email "test@test.t"
|
||||||
|
:echo false})))
|
||||||
|
(is (= "../../target/dda/backup/k3s-out.yaml"
|
||||||
|
(cut/output-path {:name "dda"
|
||||||
|
:module "backup"
|
||||||
|
:project-root-path "../.."
|
||||||
|
:build-dir-name "target"
|
||||||
|
:version "4.11.8-dev"
|
||||||
|
:stage "dev"
|
||||||
|
:debug false
|
||||||
|
:dry-run false
|
||||||
|
:c4k-output-filename "out.yaml"
|
||||||
|
:k3s-provision-user "root"
|
||||||
|
:k3s-output-filename "k3s-out.yaml"
|
||||||
|
:email "test@test.t"
|
||||||
|
:echo false}))))
|
||||||
|
|
||||||
|
(deftest should-calculate-provs-server-command
|
||||||
|
(is (= ["provs-server.jar" "k3s" "root@test.test.de" "-c" "../../target/dda-backup/k3s-out.yaml" "-a" "../../target/dda-backup/out.yaml"]
|
||||||
|
(cut/provs-server-command {:name "dda-backup"
|
||||||
|
:project-root-path "../.."
|
||||||
|
:build-dir-name "target"
|
||||||
|
:version "4.11.8-dev"
|
||||||
|
:stage "dev"
|
||||||
|
:debug false
|
||||||
|
:dry-run false
|
||||||
|
:k3s-output-filename "k3s-out.yaml"
|
||||||
|
:k3s-provision-user "root"
|
||||||
|
:c4k-output-filename "out.yaml"
|
||||||
|
:email "test@test.t"
|
||||||
|
:echo false}
|
||||||
|
{:out {:sensitive false :type [] :value {:fqdn "test.test.de" :ipv4 "127.0.0.1" :ipv6 "::"}}}))))
|
||||||
|
|
Loading…
Reference in a new issue