Skip to content

Commit 466c231

Browse files
committed
removed custom_object.py
1 parent 68aeb30 commit 466c231

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/custom_object.py renamed to examples/namespaced_custom_object.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ def main():
7272
}
7373
}
7474

75+
# patch to update the `spec.cronSpec` field
76+
patch_body = {
77+
"spec": {"cronSpec": "* * * * */10", "image": "my-awesome-cron-image"}
78+
}
79+
7580
# create the resource
7681
api.create_namespaced_custom_object(
7782
group="stable.example.com",
@@ -82,6 +87,7 @@ def main():
8287
)
8388
print("Resource created")
8489

90+
8591
# get the resource and print out data
8692
resource = api.get_namespaced_custom_object(
8793
group="stable.example.com",
@@ -93,6 +99,7 @@ def main():
9399
print("Resource details:")
94100
pprint(resource)
95101

102+
96103
# delete it
97104
api.delete_namespaced_custom_object(
98105
group="stable.example.com",
@@ -105,5 +112,18 @@ def main():
105112
print("Resource deleted")
106113

107114

115+
# patch the namespaced custom object to update the `spec.cronSpec` field
116+
patch_resource = api.patch_namespaced_custom_object(
117+
group="stable.example.com",
118+
version="v1",
119+
name="my-new-cron-object",
120+
namespace="default",
121+
plural="crontabs",
122+
body=patch_body,
123+
)
124+
print("Resource details:")
125+
pprint(patch_resource)
126+
127+
108128
if __name__ == "__main__":
109129
main()

0 commit comments

Comments
 (0)