-
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
1.0.0 released - where are the migration docs? #2117
Comments
1.0.0 marks a major switch in the HTTP backend from Unfortunately, there's breaking changes all over the place as a result of this switch. We would definitely love help in authoring a migration guide, at this point the best thing to do is to look at the examples in the release-1.x branch: https://github.com/kubernetes-client/javascript/tree/release-1.x/examples |
There's also fairly extensive discussion here: |
It looks like the new generator does have an |
@brendandburns I looked to see if I could start taking a stab at this, but it appears that at least some of the examples might be incorrect/outdated?
I can't find a single updated example that shows how to handle an error and determine if a resource doesn't exist... |
The examples definitely need a refresh. Here is a way of doing that in the new API: const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
try {
const pod = await k8sApi.readNamespacedPod({ name: 'does-not-exist', namespace: 'default' });
console.log(pod);
} catch (err) {
const isNotFoundError = err instanceof k8s.ApiException && err.code === 404;
console.log(isNotFoundError);
} The
Unfortunately, you currently have to |
This is something that changed with v1.0.0 of the K8s client. Refs: kubernetes-client/javascript#2117
Shameless plug, but I have been porting some Golang K8s utilities to Node.js. These functions in particular can be used to check error types. I just published an updated version of them that should work with v0.x and v1.x. It would look something like this: import * as k8s from '@kubernetes/client-node';
import { apimachinery } from '@kubenode/controller-runtime';
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
try {
const pod = await k8sApi.readNamespacedPod({ name: 'does-not-exist', namespace: 'default' });
console.log(pod);
} catch (err) {
console.log(apimachinery.errors.isNotFound(err));
} |
We'd be happy to take PRs updating the examples. A lot of them were ported over and as long as they compiled they were assumed to be "working" That's clearly not an awesome way to determine if they are correct. Help cleaning them up would be appreciated. |
Hi there, how do we migrate patch APIs? It looks like patch-example.js uses the internal PromiseMiddlewareWrapper as mentioned in #754. |
Describe the bug
HttpError
is no longer exported in 1.0.0** Client Version **
1.0.0
To Reproduce
Prior to 1.0.0:
Expected behavior
If
HttpError
is not exported, I would be happy to see any upgrade docs state what the replacement is.The text was updated successfully, but these errors were encountered: