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

Function certmanager

lib/python/utils.py:339–366  ·  view source on GitHub ↗

Check if cert-manager is present in the cluster. If not, installs it.

(k8s_op, tag='latest')

Source from the content-addressed store, hash-verified

337 continue
338
339def certmanager(k8s_op, tag='latest'):
340 """Check if cert-manager is present in the cluster. If not, installs it."""
341 opts = ''
342 if k8s_op == 'delete':
343 opts = '--ignore-not-found=true'
344 if tag == 'latest':
345 component_url = 'https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml'
346 run('kubectl',
347 f'{k8s_op} -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.crds.yaml {opts}')
348 else:
349 component_url = f'https://github.com/jetstack/cert-manager/releases/download/{tag}/cert-manager.yaml'
350 run('kubectl',
351 f'{k8s_op} -f https://github.com/jetstack/cert-manager/releases/download/{tag}/cert-manager.crds.yaml {opts}')
352
353 if k8s_op == 'apply':
354 message('\nWaiting for cert-manager CRD registration...')
355 time.sleep(5)
356 run('kubectl', 'wait --for=condition=Established crd certificaterequests.cert-manager.io --timeout=60s')
357 run('kubectl', 'wait --for=condition=Established crd certificates.cert-manager.io --timeout=60s')
358 run('kubectl', 'wait --for=condition=Established crd clusterissuers.cert-manager.io --timeout=60s')
359
360 run('kubectl', f'{k8s_op} -f {component_url} {opts}')
361
362 if k8s_op == 'apply':
363 message('\nWaiting for cert-manager pods...')
364 run('kubectl', '-n cert-manager wait --for=condition=available deployment --all --timeout=300s')
365 run('kubectl', '-n cert-manager wait --for=condition=ready pod --all --timeout=300s')
366 _runwithtimeout(_install_certmanager_issuer, [], 180)
367
368def configure_platform_images(clone_path,
369 ref='',

Callers 1

forgeops_dependenciesFunction · 0.90

Calls 3

messageFunction · 0.85
_runwithtimeoutFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected