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