Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: improve in-cluster-config example #610

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

Merged

Conversation

tomplus
Copy link
Member

@tomplus tomplus commented Aug 25, 2018

I've updated an example - in_cluster_config.py.

Changes:

Thanks.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 25, 2018
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 25, 2018
@@ -14,18 +14,65 @@

# Simple example to show loading config from the cluster

#
# If you get 403 errors from API server you will have to configure
# RBAC to add necessary permissions.
Copy link
Contributor

Choose a reason for hiding this comment

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

"necessary permissions"
maybe more specific about the permission added is "the permission to list pods"

print("%s\t%s\t%s" %
(i.status.pod_ip, i.metadata.namespace, i.metadata.name))

while True:
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure about putting it in a loop, i guess most people would just run it once, see if the pods are listed correctly.

one way to run it in cluster is to start a pod that runs say ubuntu, exec into the pod, install this client library, then try out this example.

Copy link
Member Author

Choose a reason for hiding this comment

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

I run tests in different way. I prepared a docker image with the installed library and this example as a command. If the pod works forever I can check logs easily, tune RBAC etc.

Your scenario is simpler, I'll remove the loop and I'll add comments about suggested scenario.

Thanks for reviewing it.

@yliaog
Copy link
Contributor

yliaog commented Aug 27, 2018

thanks for the pr. could you please sqash the commits? it looks good otherwise.

@tomplus tomplus force-pushed the feat/in-cluster-example branch from 5a5424e to f9d5c93 Compare August 27, 2018 22:08
@yliaog
Copy link
Contributor

yliaog commented Aug 30, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 30, 2018
@yliaog
Copy link
Contributor

yliaog commented Aug 30, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tomplus, 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2018
@k8s-ci-robot k8s-ci-robot merged commit 1edf499 into kubernetes-client:master Aug 30, 2018
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants