implement-c4k-and-provs #1
4 changed files with 28 additions and 25 deletions
|
@ -2,34 +2,17 @@
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require [clojure.spec.alpha :as s]
|
||||||
bom marked this conversation as resolved
|
|||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[dda.build.devops.domain :as d]
|
[dda.build.devops.domain :as d]
|
||||||
[dda.c4k-common.predicate :as pred]))
|
[dda.build.terragrunt.domain :as td]))
|
||||||
|
|
||||||
(s/def ::c4k-output-filename string?)
|
(s/def ::c4k-output-filename string?)
|
||||||
(s/def ::autoapply boolean?)
|
|
||||||
|
|
||||||
(s/def ::sensitive boolean?)
|
|
||||||
|
|
||||||
(s/def ::type vector?)
|
|
||||||
|
|
||||||
(s/def ::fqdn pred/fqdn-string?)
|
|
||||||
(s/def ::ipv4 pred/ipv4-string?)
|
|
||||||
(s/def ::ipv6 pred/ipv6-string?)
|
|
||||||
(s/def ::value
|
|
||||||
(s/keys :req-un [::fqdn ::ipv4 ::ipv6]))
|
|
||||||
|
|
||||||
(s/def ::out
|
|
||||||
(s/keys :req-un [::sensitive ::type ::value]))
|
|
||||||
|
|
||||||
(s/def ::tf-out
|
|
||||||
(s/keys :req-un [::out]))
|
|
||||||
|
|
||||||
(s/def ::c4k-config-filename string?)
|
(s/def ::c4k-config-filename string?)
|
||||||
(s/def ::c4k-auth-filename string?)
|
(s/def ::c4k-auth-filename 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-output-filename ::autoapply ::c4k-config-filename ::c4k-auth-filename]
|
::d/dry-run ::c4k-output-filename ::c4k-config-filename ::c4k-auth-filename]
|
||||||
:opt-un []))
|
:opt-un [::d/module]))
|
||||||
|
|
||||||
(defn-spec config-path string?
|
(defn-spec config-path string?
|
||||||
[config ::config]
|
[config ::config]
|
||||||
|
@ -64,7 +47,7 @@
|
||||||
|
|
||||||
(defn-spec create-c4k-config map?
|
(defn-spec create-c4k-config map?
|
||||||
[config ::config
|
[config ::config
|
||||||
tf-out ::tf-out]
|
tf-out ::td/tf-out]
|
||||||
(let [{:keys [stage]} config
|
(let [{:keys [stage]} config
|
||||||
issuer (if (= stage "prod") "prod" "staging")
|
issuer (if (= stage "prod") "prod" "staging")
|
||||||
fqdn (:fqdn (:value (:out tf-out)))]
|
fqdn (:fqdn (:value (:out tf-out)))]
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[dda.build.devops.domain :as d]
|
[dda.build.devops.domain :as d]
|
||||||
[dda.c4k-common.predicate :as pred]
|
[dda.c4k-common.predicate :as pred]
|
||||||
[dda.build.c4k.domain :as c4k-d]))
|
[dda.build.c4k.domain :as c4k-d]
|
||||||
|
[dda.build.terragrunt.domain :as td]))
|
||||||
|
|
||||||
; TODO: Use a better spec for emails
|
; TODO: Use a better spec for emails
|
||||||
; should be added to c4k-common, it seems common enough
|
; should be added to c4k-common, it seems common enough
|
||||||
|
@ -34,14 +35,14 @@
|
||||||
|
|
||||||
(defn-spec provs-server-command seq?
|
(defn-spec provs-server-command seq?
|
||||||
[config ::config
|
[config ::config
|
||||||
tf-out ::c4k-d/tf-out]
|
tf-out ::td/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
|
||||||
tf-out ::c4k-d/tf-out]
|
tf-out ::td/tf-out]
|
||||||
(let [{:keys [stage email echo]} config
|
(let [{:keys [stage email echo]} config
|
||||||
letsencrypt-endpoint (if (= stage "prod") "prod" "staging")
|
letsencrypt-endpoint (if (= stage "prod") "prod" "staging")
|
||||||
values (:value (:out tf-out))
|
values (:value (:out tf-out))
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
(ns dda.build.terragrunt.domain
|
(ns dda.build.terragrunt.domain
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require [clojure.spec.alpha :as s]
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[dda.build.devops.domain :as d]))
|
[dda.build.devops.domain :as d]
|
||||||
|
[dda.c4k-common.predicate :as pred]))
|
||||||
|
|
||||||
|
(s/def ::sensitive boolean?)
|
||||||
|
|
||||||
|
(s/def ::type vector?)
|
||||||
|
|
||||||
|
(s/def ::fqdn pred/fqdn-string?)
|
||||||
|
(s/def ::ipv4 pred/ipv4-string?)
|
||||||
|
(s/def ::ipv6 pred/ipv6-string?)
|
||||||
|
(s/def ::value
|
||||||
|
(s/keys :req-un [::fqdn ::ipv4 ::ipv6]))
|
||||||
|
|
||||||
|
(s/def ::out
|
||||||
|
(s/keys :req-un [::sensitive ::type ::value]))
|
||||||
|
|
||||||
|
(s/def ::tf-out
|
||||||
|
(s/keys :req-un [::out]))
|
||||||
|
|
||||||
(s/def ::tg-output-filenname string?)
|
(s/def ::tg-output-filenname string?)
|
||||||
(s/def ::autoapply boolean?)
|
(s/def ::autoapply boolean?)
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
:dry-run false
|
:dry-run false
|
||||||
:k3s-output-filename "k3s-out.yaml"
|
:k3s-output-filename "k3s-out.yaml"
|
||||||
:k3s-provision-user "root"
|
:k3s-provision-user "root"
|
||||||
|
:c4k-config-filename "config.yaml"
|
||||||
|
:c4k-auth-filename "auth.yaml"
|
||||||
:c4k-output-filename "out.yaml"
|
:c4k-output-filename "out.yaml"
|
||||||
:email "test@test.t"
|
:email "test@test.t"
|
||||||
:echo false}
|
:echo false}
|
||||||
|
|
Loading…
Reference in a new issue
test first ?!