Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Basic asyncio support

- Basic asyncio with kube config, and in_cluster_config is added.

- Dynamic client, watch, stream, shared informer, leader election are not yet supported in asyncio.

# Breaking Change from upgrading openapi generator to v6.6.0

- Legacy dict(str, str) syntax is no longer supported in ApiClient deserializer. Only modern dict[str, str] syntax is supported.
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@ for i in ret.items:
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
```

list all pods using asyncio:

```python
import asyncio
from kubernetes_asyncio import client, config
from kubernetes_asyncio.client.api_client import ApiClient


async def main():
# Configs can be set in Configuration class directly or using helper
# utility. If no argument provided, the config will be loaded from
# default location.
await config.load_kube_config()

# use the context manager to close http sessions automatically
async with ApiClient() as api:

v1 = client.CoreV1Api(api)
print("Listing pods with their IPs:")
ret = await v1.list_pod_for_all_namespaces()

for i in ret.items:
print(i.status.pod_ip, i.metadata.namespace, i.metadata.name)


if __name__ == '__main__':
asyncio.run(main())
```

watch on namespace object:

```python
Expand Down
6 changes: 6 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,15 @@ if [[ -n "$(git diff kubernetes/client/api/custom_objects_api.py)" ]]; then
git add kubernetes/client/api/custom_objects_api.py
git commit -m "generated client change for custom_objects"
fi

# Re-generate the asyncio client
scripts/update-client-asyncio.sh

# Check if there is any API change, then commit
git add kubernetes/docs kubernetes/client/api/ kubernetes/client/models/ kubernetes/swagger.json.unprocessed scripts/swagger.json
git add kubernetes_asyncio/docs kubernetes_asyncio/client/api/ kubernetes_asyncio/client/models/ kubernetes_asyncio/swagger.json.unprocessed
git diff-index --quiet --cached HEAD || git commit -m "generated API change"

# Commit everything else
git add .
git commit -m "generated client change"
Expand Down