ansible-collections / kubernetes.core

The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
Other
216 stars 135 forks source link

using for wait the watch parameter #633

Open genofire opened 1 year ago

genofire commented 1 year ago
SUMMARY

The Kubernetes API endpoint could be rate limited, so it is not a good pattern to send multiple requests in short time to check if the pod is ready. Therefore the API has the parameter wait which sends a stream of json results to detect changes and/or pod readiness: https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes

ISSUE TYPE
COMPONENT NAME

k8s_info

ACTUAL RESULTS
Failed to get client due to HTTPSConnectionPool(host='controll-plane.on.my.cluster', port=1337): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f93ebd186d8>: Failed to establish a new connection: [Errno 111] Connection refused',)

Here is the Denial of Service function: clock(timeout, sleep)

https://github.com/ansible-collections/kubernetes.core/blob/9e9962bc6cd74003fa4a8b01ad8eb5104bb063fb/plugins/module_utils/k8s/waiter.py#L175-L196

gravesm commented 1 year ago

@genofire Thank you for the suggestion.