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

chore: update js and typescript examples #1082

Conversation

clintonmedbery
Copy link
Contributor

This is part two of updating examples to node-fetch. A lot of these examples do not work do to this issue (#893) but I have updated the syntax to match what we need with fetch. Other examples do work. Let me know if you would like me to separate these out.

Right now I just put a note in the FETCH_MIGRATION file. If you have another idea to best handle this then let me know and I will update.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 9, 2023
@@ -1,12 +1,13 @@
const k8s = require('@kubernetes/client-node');
// in a real program use require('@kubernetes/client-node')
const k8s = require('../dist/index');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to match the previous PR.

@@ -64,28 +64,28 @@ Code will be on the `master` branch.
- [x] cache-example
- [x] example
- [x] follow-logs
- [ ] in-cluster-create-job-from-cronjob
- [ ] in-cluster-create-job-from-cronjob // done but unable to test with media type problems
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if there is a better or more preferred way to denote this.

examples/raw-example.js Outdated Show resolved Hide resolved
examples/raw-example.js Show resolved Hide resolved
// find the particular deployment
const res = await k8sApi.readNamespacedDeployment(name, namespace);
let deployment = res.body;
async function scale(deploymentNamespace, deploymentName, replicas) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we stick tonamespace and name here instead of deploymentNamespace and deploymentName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I did this was because as an example, I think it is easier to read the named parameters as { name: variableName, namespace: anotherName } rather than using object shorthand property names like { name, namespace }. In general I prefer what you are saying, but as an example I find this more easier to digest.

console.log('create', name);
};

const deletePod = async (name, namespace) => {
await k8sApi.deleteNamespacedPod(name, namespace);
const deletePod = async (podName: string, podNamespace: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

name, namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason above.

@clintonmedbery clintonmedbery force-pushed the clintonmedbery/chore/update-examples-node-fetch-part-2 branch from 1c432a7 to 655e45f Compare May 10, 2023 21:33
@brendandburns
Copy link
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, clintonmedbery, mstruebing

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 May 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit b7bfb18 into kubernetes-client:release-1.x May 12, 2023
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.

4 participants