From 5ae6c1c84531c1d0774a0801a26e8f9d813bd074 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 8 Jul 2025 20:52:26 -0400 Subject: [PATCH] feat: add the ability to specify a kustomize-root-path This will default to `config/kustomize`, though may change to `.dokku/kustomize` in the future. --- plugins/scheduler-k3s/functions.go | 17 +++++++++++++++++ plugins/scheduler-k3s/report.go | 15 +++++++++++++++ plugins/scheduler-k3s/scheduler_k3s.go | 2 ++ 3 files changed, 34 insertions(+) diff --git a/plugins/scheduler-k3s/functions.go b/plugins/scheduler-k3s/functions.go index 942d5c4f2..a7ec92f92 100644 --- a/plugins/scheduler-k3s/functions.go +++ b/plugins/scheduler-k3s/functions.go @@ -1190,6 +1190,23 @@ func getGlobalLetsencryptEmailStag() string { return common.PropertyGetDefault("scheduler-k3s", "--global", "letsencrypt-email-stag", "") } +func getKustomizeRootPath(appName string) string { + return common.PropertyGetDefault("scheduler-k3s", appName, "kustomize-root-path", "") +} + +func getGlobalKustomizeRootPath() string { + return common.PropertyGetDefault("scheduler-k3s", "--global", "kustomize-root-path", "config/kustomize") +} + +func getComputedKustomizeRootPath(appName string) string { + kustomizeRootPath := getKustomizeRootPath(appName) + if kustomizeRootPath == "" { + kustomizeRootPath = getGlobalKustomizeRootPath() + } + + return kustomizeRootPath +} + func getNamespace(appName string) string { return common.PropertyGetDefault("scheduler-k3s", appName, "namespace", "") } diff --git a/plugins/scheduler-k3s/report.go b/plugins/scheduler-k3s/report.go index d480969b6..d1bb6d2de 100644 --- a/plugins/scheduler-k3s/report.go +++ b/plugins/scheduler-k3s/report.go @@ -28,6 +28,9 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { "--scheduler-k3s-global-ingress-class": reportGlobalIngressClass, "--scheduler-k3s-global-letsencrypt-email-prod": reportGlobalLetsencryptEmailProd, "--scheduler-k3s-global-letsencrypt-email-stag": reportGlobalLetsencryptEmailStag, + "--scheduler-k3s-computed-kustomize-root-path": reportComputedKustomizeRootPath, + "--scheduler-k3s-kustomize-root-path": reportKustomizeRootPath, + "--scheduler-k3s-global-kustomize-root-path": reportGlobalKustomizeRootPath, "--scheduler-k3s-computed-namespace": reportComputedNamespace, "--scheduler-k3s-namespace": reportNamespace, "--scheduler-k3s-global-namespace": reportGlobalNamespace, @@ -148,6 +151,18 @@ func reportGlobalLetsencryptEmailStag(appName string) string { return getGlobalLetsencryptEmailStag() } +func reportComputedKustomizeRootPath(appName string) string { + return getComputedKustomizeRootPath(appName) +} + +func reportKustomizeRootPath(appName string) string { + return getKustomizeRootPath(appName) +} + +func reportGlobalKustomizeRootPath(appName string) string { + return getGlobalKustomizeRootPath() +} + func reportComputedNamespace(appName string) string { return getComputedNamespace(appName) } diff --git a/plugins/scheduler-k3s/scheduler_k3s.go b/plugins/scheduler-k3s/scheduler_k3s.go index 9a37a78bd..fbf29a7bc 100644 --- a/plugins/scheduler-k3s/scheduler_k3s.go +++ b/plugins/scheduler-k3s/scheduler_k3s.go @@ -20,6 +20,7 @@ var ( DefaultProperties = map[string]string{ "deploy-timeout": "", "letsencrypt-server": "", + "kustomize-root-path": "", "image-pull-secrets": "", "namespace": "", "rollback-on-failure": "", @@ -33,6 +34,7 @@ var ( "ingress-class": true, "kube-context": true, "kubeconfig-path": true, + "kustomize-root-path": true, "letsencrypt-server": true, "letsencrypt-email-prod": true, "letsencrypt-email-stag": true,