Commit 78628d6
committed
Fix frr-k8s-statuscleaner crash: move $(LOG_LEVEL) to end of args
The frr-k8s-statuscleaner pod was crashing with "invalid namespace for
secret" error during startup. The root cause was that none of the
command-line flags were being parsed.
The LOG_LEVEL env var is sourced from the optional "env-overrides"
ConfigMap which doesn't exist by default. When a ConfigMap referenced
with optional:true doesn't exist, Kubernetes leaves the env var
undefined. When $(LOG_LEVEL) is used in args and the env var is
undefined, Kubernetes passes the literal string "$(LOG_LEVEL)" instead
of substituting a value.
Inspecting the container at runtime with crictl showed:
["/statuscleaner", "$(LOG_LEVEL)", "--disable-cert-rotation=true",
"--namespace=openshift-frr-k8s", "--webhook-port=9123",
"--frrk8s-selector=component=frr-k8s"]
Go's flag.Parse() stops processing at the first non-flag argument.
Since "$(LOG_LEVEL)" was the first argument, flag parsing stopped
immediately and all subsequent flags (--disable-cert-rotation,
--namespace, etc.) were never parsed. The program ran with default
values, causing the crash.
Moving $(LOG_LEVEL) to the end of the args list ensures all real flags
are parsed before flag.Parse() encounters the literal string. The
unrecognized positional argument is then silently ignored, matching the
pattern already used successfully in frr-k8s.yaml.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: Riccardo Ravaioli <rravaiol@redhat.com>1 parent d2a643e commit 78628d6
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments