Apply reviewer suggestion: reduce verbose comment to a single line
and include the feature-gates value in the warning message.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
In the embedded executor, all Kubernetes components share a single
global utilfeature.DefaultFeatureGate. Feature gate flag parsing
normally occurs inside command.ExecuteContext(), but the API server's
REST storage registration can read the global gate before flags are
parsed, seeing alpha-default values instead of user-configured ones.
This causes an intermittent race condition where alpha feature gates
(e.g. InPlacePodVerticalScaling on K8s v1.32) are ignored even when
correctly configured via the k3s config file. The race depends on
goroutine scheduling: REST storage registration may complete before
the feature gate flag is parsed, causing the API server to not
register the corresponding subresources (e.g. pods/resize).
Fix: extract the feature-gates value from the API server args and
apply it to DefaultMutableFeatureGate before creating the API server
command and starting its goroutine. This ensures the global gate
reflects user configuration before any component reads it. The
subsequent flag parsing in ExecuteContext() will set the same values
again (idempotent).
Ref k3s-io/k3s#14286
AI-assisted: This change was developed with AI assistance.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Better isolates the K3s implementation from the interface, and aligns
the package path with other projects executors. This should also remove
the indirect flannel dep from other projects that don't use the embedded
executor.
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>