diff --git a/plugins/scheduler-k3s/functions.go b/plugins/scheduler-k3s/functions.go index 472c06025..2fe549f6e 100644 --- a/plugins/scheduler-k3s/functions.go +++ b/plugins/scheduler-k3s/functions.go @@ -1494,6 +1494,10 @@ func getStartCommand(input StartCommandInput) (StartCommandOutput, error) { }, nil } +func getProcessSpecificKustomizeRootPath(appName string) string { + return "" +} + func hasKustomizeRootPath(appName string) bool { kustomizeRootPath := getComputedKustomizeRootPath(appName) if common.DirectoryExists(fmt.Sprintf("%s.%s.missing", kustomizeRootPath, os.Getenv("DOKKU_PID"))) { diff --git a/plugins/scheduler-k3s/helm.go b/plugins/scheduler-k3s/helm.go index f40502778..4f855c13f 100644 --- a/plugins/scheduler-k3s/helm.go +++ b/plugins/scheduler-k3s/helm.go @@ -56,6 +56,9 @@ type ChartInput struct { // ChartPath is the path to the chart to install or upgrade ChartPath string + // KustomizeRootPath is the path to the kustomize root path to use + KustomizeRootPath string + // Namespace is the namespace to install or upgrade the chart in Namespace string @@ -260,6 +263,10 @@ func (h *HelmAgent) InstallChart(ctx context.Context, input ChartInput) error { input.Values = map[string]interface{}{} } + kustomizeRenderer := KustomizeRenderer{ + KustomizeRootPath: input.KustomizeRootPath, + } + client := action.NewInstall(h.Configuration) client.Atomic = false client.ChartPathOptions = action.ChartPathOptions{} @@ -267,7 +274,11 @@ func (h *HelmAgent) InstallChart(ctx context.Context, input ChartInput) error { client.DryRun = false if os.Getenv("DOKKU_TRACE") == "1" { client.DryRun = true - client.PostRenderer = &DebugRenderer{} + client.PostRenderer = &DebugRenderer{ + Renderer: &kustomizeRenderer, + } + } else { + client.PostRenderer = &kustomizeRenderer } client.Namespace = namespace client.ReleaseName = input.ReleaseName @@ -376,6 +387,10 @@ func (h *HelmAgent) UpgradeChart(ctx context.Context, input ChartInput) error { input.Values = map[string]interface{}{} } + kustomizeRenderer := KustomizeRenderer{ + KustomizeRootPath: input.KustomizeRootPath, + } + client := action.NewUpgrade(h.Configuration) client.Atomic = input.RollbackOnFailure client.ChartPathOptions = action.ChartPathOptions{} @@ -383,7 +398,11 @@ func (h *HelmAgent) UpgradeChart(ctx context.Context, input ChartInput) error { client.MaxHistory = 10 if os.Getenv("DOKKU_TRACE") == "1" { client.DryRun = true - client.PostRenderer = &DebugRenderer{} + client.PostRenderer = &DebugRenderer{ + Renderer: &kustomizeRenderer, + } + } else { + client.PostRenderer = &kustomizeRenderer } client.Namespace = namespace client.Timeout = input.Timeout diff --git a/plugins/scheduler-k3s/triggers.go b/plugins/scheduler-k3s/triggers.go index 4f3366c51..c1b08d905 100644 --- a/plugins/scheduler-k3s/triggers.go +++ b/plugins/scheduler-k3s/triggers.go @@ -784,9 +784,15 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e } } + kustomizeRootPath := "" + if hasKustomizeRootPath(appName) { + kustomizeRootPath = getProcessSpecificKustomizeRootPath(appName) + } + common.LogInfo2(fmt.Sprintf("Installing %s", appName)) err = helmAgent.InstallOrUpgradeChart(ctx, ChartInput{ ChartPath: chartPath, + KustomizeRootPath: kustomizeRootPath, Namespace: namespace, ReleaseName: appName, RollbackOnFailure: allowRollbacks,