kubernetes-client / javascript

Javascript client
Apache License 2.0
2.01k stars 513 forks source link

Properly parse metadata of custom Kubernetes objects #1695

Closed schrodit closed 4 months ago

schrodit commented 4 months ago

Partially fixed https://github.com/kubernetes-client/javascript/issues/852 by adding a helper Seriliazer. That serializer is aware of Kubernetes objects and parses them accordingly to a valid KubernetesObject (before some types were wrongly parsed e.g. creationTimestamp was a string instead of a Date).

Supporting custom objects will follow in a separate PR. But the idea is that there will be a second map in the new Serializer were custom objects can be added at runtime.

schrodit commented 4 months ago

/assign brendandburns

schrodit commented 4 months ago

/assign mstruebing

schrodit commented 4 months ago

Great work - only a couple of nitpicks.

I think we should port this over to release-1.x as well so that we will have it in the next major release as well.

Whats the process here? Do I just open another PR for the release-1.x branch?

mstruebing commented 4 months ago

Yes exactly, otherwise these changes will be lost once we release the new client without the request library as a replacement for the current master. You can probably reuse most of the code you've created in this PR.

Your changes looking good from my point of view - will just wait a bit for @brendandburns to have a look as well probably.

brendandburns commented 4 months ago

Looks good to me also.

/lgtm

Once this merges, you can cherry-pick this against the release-1.x branch, but it may require reworking.

brendandburns commented 4 months ago

Looks like this is failing linting. Please fix to match our style guide.

schrodit commented 4 months ago

Looks good to me also.

/lgtm

Once this merges, you can cherry-pick this against the release-1.x branch, but it may require reworking.

ok will do that once merged

mstruebing commented 4 months ago

From the github action logs:

[warn] src/object.ts
[warn] src/serializer_test.ts
[warn] src/serializer.ts
[warn] Code style issues found in 3 files. Run Prettier to fix.

You should run: npm run format and commit the formatting changes.

schrodit commented 4 months ago

From the github action logs:

[warn] src/object.ts
[warn] src/serializer_test.ts
[warn] src/serializer.ts
[warn] Code style issues found in 3 files. Run Prettier to fix.

You should run: npm run format and commit the formatting changes.

thanks. Pushed all changes

mstruebing commented 4 months ago

/lgtm /approve

Thanks 🚀

k8s-ci-robot commented 4 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mstruebing, schrodit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-client/javascript/blob/master/OWNERS)~~ [mstruebing] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment