Skip to content

Commit 47f7520

Browse files
authored
Merge pull request #2548 from yliaog/master
updated README, CHANGELOG, and release.sh for asyncio.
2 parents 32db472 + 218d331 commit 47f7520

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Basic asyncio support
2+
3+
- Basic asyncio with kube config, and in_cluster_config is added.
4+
5+
- Dynamic client, watch, stream, shared informer, leader election are not yet supported in asyncio.
6+
17
# Breaking Change from upgrading openapi generator to v6.6.0
28

39
- Legacy dict(str, str) syntax is no longer supported in ApiClient deserializer. Only modern dict[str, str] syntax is supported.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,35 @@ for i in ret.items:
4242
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
4343
```
4444

45+
list all pods using asyncio:
46+
47+
```python
48+
import asyncio
49+
from kubernetes_asyncio import client, config
50+
from kubernetes_asyncio.client.api_client import ApiClient
51+
52+
53+
async def main():
54+
# Configs can be set in Configuration class directly or using helper
55+
# utility. If no argument provided, the config will be loaded from
56+
# default location.
57+
await config.load_kube_config()
58+
59+
# use the context manager to close http sessions automatically
60+
async with ApiClient() as api:
61+
62+
v1 = client.CoreV1Api(api)
63+
print("Listing pods with their IPs:")
64+
ret = await v1.list_pod_for_all_namespaces()
65+
66+
for i in ret.items:
67+
print(i.status.pod_ip, i.metadata.namespace, i.metadata.name)
68+
69+
70+
if __name__ == '__main__':
71+
asyncio.run(main())
72+
```
73+
4574
watch on namespace object:
4675

4776
```python

scripts/release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,15 @@ if [[ -n "$(git diff kubernetes/client/api/custom_objects_api.py)" ]]; then
222222
git add kubernetes/client/api/custom_objects_api.py
223223
git commit -m "generated client change for custom_objects"
224224
fi
225+
226+
# Re-generate the asyncio client
227+
scripts/update-client-asyncio.sh
228+
225229
# Check if there is any API change, then commit
226230
git add kubernetes/docs kubernetes/client/api/ kubernetes/client/models/ kubernetes/swagger.json.unprocessed scripts/swagger.json
231+
git add kubernetes_asyncio/docs kubernetes_asyncio/client/api/ kubernetes_asyncio/client/models/ kubernetes_asyncio/swagger.json.unprocessed
227232
git diff-index --quiet --cached HEAD || git commit -m "generated API change"
233+
228234
# Commit everything else
229235
git add .
230236
git commit -m "generated client change"

0 commit comments

Comments
 (0)