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

simplify & enhance the node_labels.py example #1435

Conversation

Priyankasaggu11929
Copy link
Contributor

What type of PR is this?

/kind cleanup
/kind documentation

What this PR does / why we need it:

This PR enhances the existing node_labels.py example, with the following:

  • make the script more generic to any kind of Kubernetes cluster, removing the hardcoded node name.
  • along with previously demonstrating the use of patch_node function, it now also covers the basic concepts like listing cluster nodes using list_node() function.
  • demonstrate how to get specific node object characteristics field's values, like <node_item>.metadata.name, <node_item>.metadata.labels.
  • print a cleaner output (list of cluster node name & the updated labels)
❯ python3 examples/node_labels.py 
NAME		LABELS
127.0.0.1	{'beta.kubernetes.io/arch': 'amd64', 'beta.kubernetes.io/os': 'linux', 'foo': 'bar', 'kubernetes.io/arch': 'amd64', 'kubernetes.io/hostname': '127.0.0.1', 'kubernetes.io/os': 'linux'}

Which issue(s) this PR fixes:

Fixes #1434

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. labels Apr 27, 2021
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 27, 2021
examples/node_labels.py Outdated Show resolved Hide resolved
@yliaog
Copy link
Contributor

yliaog commented Apr 27, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 27, 2021
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 28, 2021
@Priyankasaggu11929
Copy link
Contributor Author

/retest

@k8s-ci-robot
Copy link
Contributor

@Priyankasaggu11929: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Priyankasaggu11929
Copy link
Contributor Author

Priyankasaggu11929 commented Apr 28, 2021

@yliaog @roycaihw,

In order to fix the travis-ci failing jobs, I've added more commits for removing white-spaces. The new commits removed the \lgtm label. All tests are successfully passing now.

Could you please add the label again. Thank you!

@yliaog
Copy link
Contributor

yliaog commented Apr 28, 2021

/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 Apr 28, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Priyankasaggu11929, yliaog

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 merged commit c3f1a1c into kubernetes-client:master Apr 28, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

simplify & enhance the node_labels.py example
3 participants