Fix infinite recursion loop with kube login #107
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
As raised in #37 and in rancher-sandbox/rancher-desktop#1308, When using kubelogin or any other credentials benefiting from kubectl plugins, an infinite recursion loop happens.
kuberlr is designed to be a built-in replacement for
kubectl
and hence replaces thekubectl
command in thePATH
.Using kubectl exec plugin configured as below,
the Kubernetes version client will systematically
execute kubectl to obtain credentials to the cluster.
This will result calling
kuberlr
which will try to get the version again.To prevent this infinite loop, mark the execution of
KubectlVersionToUse
in an environment variable.This way, when
kuberlr
is executed again to authenticate to Kubernetes so it can retrieve the Kubernetes version, it will systematically use the latest stable Kubectl version and avoid the infinite recursion loop.fixes: #37
fixes: rancher-sandbox/rancher-desktop#1308