Swap to config impl

This commit is contained in:
2025-10-07 22:25:27 -05:00
parent e75d68a7c7
commit e7e2c2be5a

View File

@@ -1,33 +1,21 @@
(ns k8s.services.nextcloud.service (ns k8s.services.nextcloud.service
(:require (:require [utils.k8s :refer [make-transformer]]))
[utils.k8s :refer [ make-transformer deploy-stack]]))
(defn- add-skip-await-transformation [args _opts] (def config
(let [kind (get-in args [:resource :kind])] {:stack [:vault-secrets :helm-fn :chart :ingress]
(if (some #{kind} ["StatefulSet" "PersistentVolumeClaim" "Ingress"]) :app-namespace "nextcloud"
(update-in args [:resource :metadata :annotations] :app-name "nextcloud"
#(assoc (or % {}) "pulumi.com/skipAwait" "true")) :chart-repo "https://nextcloud.github.io/helm/"
args))) :image-port 8080
:vault-load-yaml true
(defn deploy :helm-values-fn (make-transformer
"Deploy Nextcloud using direct vault connection info."
[provider vault-provider]
(let [nextcloud-values-transformer
(make-transformer
(fn [{:keys [app-name secrets]}] (fn [{:keys [app-name secrets]}]
(let [{:keys [host]} secrets] (let [{:keys [host]} secrets]
[[["nextcloud" "host"] host] [[["nextcloud" "host"] host]
[["nextcloud" "trustedDomains"] [host app-name]]]))) [["nextcloud" "trustedDomains"] [host app-name]]])))
:transformations (fn [args _opts]
stack (deploy-stack (let [kind (get-in args [:resource :kind])]
:namespace :vault-secrets :helm-fn :chart :ingress (if (some #{kind} ["StatefulSet" "PersistentVolumeClaim" "Ingress"])
{:provider provider (update-in args [:resource :metadata :annotations]
:vault-provider vault-provider #(assoc (or % {}) "pulumi.com/skipAwait" "true"))
:app-namespace "nextcloud" args)))})
:app-name "nextcloud"
:image-port 8080
:vault-load-yaml true
:chart-repo "https://nextcloud.github.io/helm/"
:helm-values-fn nextcloud-values-transformer
:transformations add-skip-await-transformation})]
{:stack stack}))