Closed robertosgm closed 2 weeks ago
It looks like this behavior changed with https://github.com/GoogleContainerTools/kpt-config-sync/pull/986.
Another alternative fix: Check whether the file exists at the returned KubeConfigPath
, and only use NewFromConfigFile
if the file exists. Otherwise, use NewFromInClusterConfig
.
When running on systems with correct user mapping from RunAsUser (like OpenShift), the root reconciler crashes with this error:
This was working on v1.16.1 and fails on v1.17.x, v1.18.x This is because the InClusterConfig from this new code never runs and jumps straight to trying to configure from a kubeconfig file:
The reason is that KubeConfigPath() only fails when user mapping is wrong and user 1000 is not proper, in OpenShift the user mapping is done correctly.
A more correct code should try to do the NewFromInClusterConfig first and if that fails, then try to configure from Kubeconfig. Or retry the NewFromInClusterConfig after the NewFromConfigFile fails.