-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Removed custom_object.py and created a new file namespaced_custom_object.py which is more specific to usage of namespaced custom resource #1440
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| a CronTab. This example use an example CRD from this tutorial: | ||
| https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ | ||
|
|
||
| The following yaml manifest has to be applied first: | ||
| The following yaml manifest has to be applied first for namespaced scoped CRD: | ||
|
|
||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
|
|
@@ -72,6 +72,11 @@ def main(): | |
| } | ||
| } | ||
|
|
||
| # patch to update the `spec.cronSpec` field | ||
| patch_body = { | ||
| "spec": {"cronSpec": "* * * * */10", "image": "my-awesome-cron-image"} | ||
| } | ||
|
|
||
| # create the resource | ||
| api.create_namespaced_custom_object( | ||
| group="stable.example.com", | ||
|
|
@@ -93,6 +98,18 @@ def main(): | |
| print("Resource details:") | ||
| pprint(resource) | ||
|
|
||
| # patch the namespaced custom object to update the `spec.cronSpec` field | ||
| patch_resource = api.patch_namespaced_custom_object( | ||
| group="stable.example.com", | ||
| version="v1", | ||
| name="my-new-cron-object", | ||
| namespace="default", | ||
| plural="crontabs", | ||
| body=patch_body, | ||
| ) | ||
| print("Resource details:") | ||
| pprint(patch_resource) | ||
|
|
||
| # delete it | ||
| api.delete_namespaced_custom_object( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we have a commit that reverse the order of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/kubernetes-client/python/pull/1444/commits is what I was asking for, if that makes sense
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept the order like this,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currently the two PRs have the same code change, but the commits are different Commits should represent meaningful milestones or units of work. Currently the commits in this PR are:
please take a look at https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md#squash-commits. The second commit is a "Work in progress" (it fixes a bug in the first commit during development), so please squash it. again, I think having two commits like the following will be most reasonable and readable:
at this point I'm also okay with having just one commit, which will be more reasonable than the current two commits in this PR
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am keeping the one commit and with proper commit message. |
||
| group="stable.example.com", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.