From 377cfc7f59fa6cbfedb55c9e910ba5f59b2a95af Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 28 Feb 2024 17:16:32 -0500 Subject: [PATCH] refactor: only apply the cluster issuers helm chart when setting properties Otherwise, we're constantly re-installing the same helm chart during deploys, leading to longer deploys. --- plugins/scheduler-k3s/subcommands.go | 10 ++++++++++ plugins/scheduler-k3s/triggers.go | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/scheduler-k3s/subcommands.go b/plugins/scheduler-k3s/subcommands.go index dd85668c7..a01b53265 100644 --- a/plugins/scheduler-k3s/subcommands.go +++ b/plugins/scheduler-k3s/subcommands.go @@ -734,6 +734,16 @@ func CommandReport(appName string, format string, infoFlag string) error { // CommandSet set or clear a scheduler-k3s property for an app func CommandSet(appName string, property string, value string) error { common.CommandPropertySet("scheduler-k3s", appName, property, value, DefaultProperties, GlobalProperties) + + letsencryptProperties := map[string]bool{ + "letsencrypt-email-prod": true, + "letsencrypt-email-stag": true, + "letsencrypt-server": true, + } + if appName == "--global" && letsencryptProperties[property] { + return applyClusterIssuers(context.Background()) + } + return nil } diff --git a/plugins/scheduler-k3s/triggers.go b/plugins/scheduler-k3s/triggers.go index 2beaabc37..e4c2d597e 100644 --- a/plugins/scheduler-k3s/triggers.go +++ b/plugins/scheduler-k3s/triggers.go @@ -135,11 +135,6 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e return fmt.Errorf("Error loading environment for deployment: %w", err) } - err = applyClusterIssuers(ctx) - if err != nil { - return fmt.Errorf("Error applying cluster issuers: %w", err) - } - issuerName := "letsencrypt-stag" server := getComputedLetsencryptServer(appName) if server == "prod" || server == "production" {