From 1d81949768a7030f00541fceececc4ac3bb55726 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 2 Jul 2021 16:18:51 +0200 Subject: [PATCH] create yaml from all base yamls --- src/main/cljc/dda/c4k_jira/core.cljc | 12 +++++++++++- src/main/cljc/dda/c4k_jira/jira.cljc | 16 ++++++++++++++++ ...sistent-volume.yml => persistent-volume.yaml} | 0 src/main/resources/jira/pod.yaml | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) rename src/main/resources/jira/{persistent-volume.yml => persistent-volume.yaml} (100%) diff --git a/src/main/cljc/dda/c4k_jira/core.cljc b/src/main/cljc/dda/c4k_jira/core.cljc index af2cbe6..3e9f53e 100644 --- a/src/main/cljc/dda/c4k_jira/core.cljc +++ b/src/main/cljc/dda/c4k_jira/core.cljc @@ -19,4 +19,14 @@ my-auth auth?] (let [resulting-config (merge config-defaults my-config)] (cs/join "\n" - []))) + [(yaml/to-string (jira/generate-persistent-volume)) + "---" + (yaml/to-string (jira/generate-pvc)) + "---" + (yaml/to-string (jira/generate-certificate resulting-config)) + "---" + (yaml/to-string (jira/generate-ingress resulting-config)) + "---" + (yaml/to-string (jira/generate-service)) + "---" + (yaml/to-string (jira/generate-pod resulting-config))]))) diff --git a/src/main/cljc/dda/c4k_jira/jira.cljc b/src/main/cljc/dda/c4k_jira/jira.cljc index 341fd5d..68ad4d5 100644 --- a/src/main/cljc/dda/c4k_jira/jira.cljc +++ b/src/main/cljc/dda/c4k_jira/jira.cljc @@ -5,6 +5,8 @@ [dda.c4k-common.base64 :as b64] [dda.c4k-common.common :as cm])) +(s/def ::db-user-name cm/bash-env-string?) +(s/def ::db-user-password cm/bash-env-string?) (s/def ::fqdn cm/fqdn-string?) (s/def ::issuer cm/letsencrypt-issuer?) @@ -26,3 +28,17 @@ (yaml/from-string (yaml/load-resource "jira/ingress.yaml")) (assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer) (cm/replace-all-matching-values-by-new-value "fqdn" fqdn)))) + +(defn generate-persistent-volume [] + (yaml/from-string (yaml/load-resource "jira/persistent-volume.yaml"))) + +(defn generate-pvc [] + (yaml/from-string (yaml/load-resource "jira/pvc.yaml"))) + +(defn generate-service [] + (yaml/from-string (yaml/load-resource "jira/service.yaml"))) + +(defn generate-pod [config] + (let [{:keys [fqdn db-user-name db-user-password]}] + (-> (yaml/from-string (yaml/load-resource "jira/pod.yaml")) + (assoc-in [:spec :containers :args] [fqdn, db-user-name, db-user-password])))) diff --git a/src/main/resources/jira/persistent-volume.yml b/src/main/resources/jira/persistent-volume.yaml similarity index 100% rename from src/main/resources/jira/persistent-volume.yml rename to src/main/resources/jira/persistent-volume.yaml diff --git a/src/main/resources/jira/pod.yaml b/src/main/resources/jira/pod.yaml index 5c5afab..ee3577c 100644 --- a/src/main/resources/jira/pod.yaml +++ b/src/main/resources/jira/pod.yaml @@ -10,7 +10,7 @@ spec: image: domaindrivenarchitecture/meissa-jira-crate imagePullPolicy: IfNotPresent command: ["/app/entrypoint.sh"] - args: ["{{fqdn}}", "{{db-user-name}}", "{{db-user-password}}"] + args: ["fqdn", "db-user-name", "db-user-password"] volumeMounts: - mountPath: /var/jira name: jira-data-volume