Skip to content
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

add examples to generic api (inside object.ts) #1705

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

zfrhv
Copy link
Contributor

@zfrhv zfrhv commented Jun 3, 2024

solves #1595

let me know if it looks good.
then I will add it to docs and maybe also use genericApi at get/apply/delete...

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 3, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @zfrhv!

It looks like this is your first PR to kubernetes-client/javascript 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/javascript has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 3, 2024
src/generic_api.ts Outdated Show resolved Hide resolved
src/generic_api.ts Outdated Show resolved Hide resolved
@brendandburns
Copy link
Contributor

This looks pretty good, added some small comments and it looks like you need to rebase to pick up some dependabot changes that got merged.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2024
@zfrhv zfrhv force-pushed the generic-api branch 2 times, most recently from 1f49e89 to d5af957 Compare June 4, 2024 05:54
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 4, 2024

I was going to create genericApi class for get/apply/delete/create.. functions but i stumbled into object.ts, it looks like its the generic api that I was looking for.
although looking at example usage it seems a bit complicated to use.
still this class is exactly what I was about to make.

should I just add more example and try to use watch with object.ts instead of creating genericApi?

Copy link
Member

@mstruebing mstruebing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one comment about the casing of the CreatePath function, otherwise great PR from my point of view. 🚀

Would be great if you could cherry-pick your commit into the release-1.x branch after this got merged to not loose these changes if we release the new major version.
You should be able to reuse most of your code but perhaps get into trouble with package.json/package-lock.json files.

src/generic_api.ts Outdated Show resolved Hide resolved
@brendandburns
Copy link
Contributor

@zfrhv Thanks! I had forgotten about that. Yes, I think adding watch to that and also maybe simplifying it if you want to? That would be great!

@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 6, 2024

I tried to combine object.ts with watch.ts but it seems too complex for me.
I can create seperate watch function inside object.ts but thats just copy paste from watch.ts and it will look messy.
So I tried to call the watch function from KubernetesObjectApi inside object.ts but cant figure out how to pass the Kubernetes config, it seems like its locally stored as a token and im not sure how to use it.
maybe @schrodit can help to create watch inside object.ts

About the extra examples I added: i didnt tested them but i think they should work.
All my k8s clusters are airgapped and testing something from the internet is pain.
I wish someone else could test it for me <3

@schrodit
Copy link
Contributor

schrodit commented Jun 6, 2024

I tried to combine object.ts with watch.ts but it seems too complex for me.

I can create seperate watch function inside object.ts but thats just copy paste from watch.ts and it will look messy.

So I tried to call the watch function from KubernetesObjectApi inside object.ts but cant figure out how to pass the Kubernetes config, it seems like its locally stored as a token and im not sure how to use it.

maybe @schrodit can help to create watch inside object.ts

About the extra examples I added: i didnt tested them but i think they should work.

All my k8s clusters are airgapped and testing something from the internet is pain.

I wish someone else could test it for me <3

I think I already did that in an internal wrapper.

Let me take a look and I open a separate PR.

@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 9, 2024

I fixed the examples.
Im not good enought to understand how to add watch function inside object.js so I will leave it to the pros

@zfrhv zfrhv changed the title add watch using genericApi add examples to generic api (inside object.ts) Jun 9, 2024
@mstruebing
Copy link
Member

@zfrhv started the CI process and it seems like you have linting errors.
You can see the results either in the github action logs or locally by running npm run lint

@brendandburns
Copy link
Contributor

You can also run npm run format to fix at least some of them.

@mstruebing
Copy link
Member

/lgtm
/approve

Thanks for these example, I think they are very useful for new users. 🚀
As mentioned above, if you ever find the time, it would be great to port these to the release-1.x branch as well.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 24, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2024
@k8s-ci-robot k8s-ci-robot merged commit f61f3b2 into kubernetes-client:master Jun 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants