MCPcopy Create free account
hub / github.com/ForgeRock/forgeops / _waitforresource

Function _waitforresource

lib/python/utils.py:211–229  ·  view source on GitHub ↗

Wait for a resource to exist in the k8s api. This is a blocking call with no timeout. resource_type: k8s resource type. e.a. pod, secret, deployment. resource_name: k8s resource name.

(ns, resource_type, resource_name)

Source from the content-addressed store, hash-verified

209 raise(e)
210
211def _waitforresource(ns, resource_type, resource_name):
212 """
213 Wait for a resource to exist in the k8s api. This is a blocking call with no timeout.
214 resource_type: k8s resource type. e.a. pod, secret, deployment.
215 resource_name: k8s resource name.
216 """
217 print(f'Waiting for {resource_type} "{resource_name}" to exist in the cluster: ', end='')
218 sys.stdout.flush()
219 while True:
220 try:
221 run('kubectl', f'-n {ns} get {resource_type} {resource_name}',
222 cstderr=True, cstdout=True)
223 print('done')
224 break
225 except Exception as _:
226 print('.', end='')
227 sys.stdout.flush()
228 time.sleep(1)
229 continue
230
231def _runwithtimeout(target, args, secs):
232 """

Callers

nothing calls this directly

Calls 1

runFunction · 0.70

Tested by

no test coverage detected