-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kc.loadFromCluster() doesn't setup getCurrentCluster()
correctly.
#2168
Comments
it looks like But we should probably check and fix to make it so that |
getCurrentCluster()
correctly.
I think this is a minimal reproduction: import * as k8s from '@kubernetes/client-node';
const kc = new k8s.KubeConfig();
kc.loadFromCluster();
const currentContext = kc.getCurrentContext();
const currentCluster = kc.getCluster(currentContext);
console.log(currentCluster); // Logs null When [
{
name: 'inCluster',
caFile: `${pathPrefix}${SERVICEACCOUNT_CA_PATH}`,
server: `${scheme}://${serverHost}:${port}`,
skipTLSVerify: false,
},
] The call to So, you're always executing |
It looks like that does work. |
@koooge can you confirm if changing the code from |
@cjihrig thanks for looking closer at this. You are correct, there is a bug in the code from @koooge It should be:
but really I did notice that our code coverage for this code is low, so I added #2191 I'm going to close this as working as intended. |
This commit updates the patch examples to use getCurrentCluster(). The existing code relied on the current context having the same name as a cluster. Refs: kubernetes-client#2168
Hi there,
patch-example.js doesn't work with
kc.loadFromCluster()
instead ofkc.loadFromDefault()
. The app is running in a pod, and it causesError: Cluster is undefined
#2117 (comment)I'm not sure if it's a bug or if there is another usage to fix it. At least, loadFromCluster works in v0 for me.
The text was updated successfully, but these errors were encountered: