fix: route CNB images through launcher on scheduler-k3s
Mirror the docker-local fix in #8525 for the k3s scheduler. CNB images default to a `/cnb/process/web` entrypoint that ignores incoming args, so non-web deployments, scheduled cron jobs, and ad-hoc `dokku run` / `cron:run` commands all need an explicit `launcher` entrypoint. The deployment and cron-job helm templates now set `command: [launcher]` when `image.type` is `pack`, and `TriggerSchedulerRun` sets the entrypoint to `launcher` for pack images while finishing the previously stubbed Procfile lookup branch so the resolved command is actually scheduled.
This commit is contained in:
@@ -75,6 +75,10 @@ spec:
|
||||
{{- range $config.args }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- if eq $.Values.global.image.type "pack" }}
|
||||
command:
|
||||
- launcher
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: config-{{ $.Values.global.app_name }}
|
||||
|
||||
@@ -63,6 +63,10 @@ spec:
|
||||
{{- range $config.args }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- if and (eq $.Values.global.image.type "pack") $config.args }}
|
||||
command:
|
||||
- launcher
|
||||
{{- end }}
|
||||
{{- if hasKey $config "web" }}
|
||||
env:
|
||||
- name: PORT
|
||||
|
||||
@@ -1409,16 +1409,22 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
||||
Trigger: "procfile-get-command",
|
||||
Args: []string{appName, args[0], "5000"},
|
||||
})
|
||||
if err == nil && resp.Stdout != "" {
|
||||
if err == nil && resp.StdoutContents() != "" {
|
||||
common.LogInfo1Quiet(fmt.Sprintf("Found '%s' in Procfile, running that command", args[0]))
|
||||
return err
|
||||
words, err := shellquote.Split(resp.StdoutContents())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing Procfile command: %w", err)
|
||||
}
|
||||
command = words
|
||||
}
|
||||
// todo: run command in procfile
|
||||
}
|
||||
|
||||
entrypoint := ""
|
||||
if imageSourceType == "herokuish" {
|
||||
switch imageSourceType {
|
||||
case "herokuish":
|
||||
entrypoint = "/exec"
|
||||
case "pack":
|
||||
entrypoint = "launcher"
|
||||
}
|
||||
|
||||
helmAgent, err := NewHelmAgent(namespace, DevNullPrinter)
|
||||
@@ -1482,7 +1488,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
||||
workingDir := common.GetWorkingDir(appName, image)
|
||||
job, err := templateKubernetesJob(Job{
|
||||
AppName: appName,
|
||||
Command: []string{commandShell},
|
||||
Command: command,
|
||||
DeploymentID: deploymentID,
|
||||
Entrypoint: entrypoint,
|
||||
Env: extraEnv,
|
||||
|
||||
Reference in New Issue
Block a user