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

Function forgeops_dependencies

lib/python/forgeops_dependencies.py:67–115  ·  view source on GitHub ↗

Check for and install dependencies in the kubernetes cluster if they are not found. If dependencies are found in K8s, this function does not modify or reinstall the components.

(legacy)

Source from the content-addressed store, hash-verified

65
66
67def forgeops_dependencies(legacy):
68 """
69 Check for and install dependencies in the kubernetes cluster if they are not found.
70 If dependencies are found in K8s, this function does not modify or reinstall the components.
71 """
72 check_base_toolset()
73
74 print('Checking cert-manager and related CRDs:', end=' ')
75 try:
76 run('kubectl', 'get crd certificaterequests.cert-manager.io',
77 cstderr=True, cstdout=True)
78 run('kubectl', 'get crd certificates.cert-manager.io',
79 cstderr=True, cstdout=True)
80 run('kubectl', 'get crd clusterissuers.cert-manager.io',
81 cstderr=True, cstdout=True)
82 except Exception:
83 warning('cert-manager CRD not found. Installing cert-manager.')
84 certmanager('apply', tag=REQ_VERSIONS['cert-manager']['DEFAULT'])
85 else:
86 message('cert-manager CRD found in cluster.')
87
88 _, img, _= run('kubectl', f'-n cert-manager get deployment cert-manager -o jsonpath={{.spec.template.spec.containers[0].image}}',
89 cstderr=True, cstdout=True)
90 check_component_version('cert-manager', img.decode('ascii').split(':')[1])
91
92 print('Checking secret-agent operator and related CRDs:', end=' ')
93 try:
94 run('kubectl', 'get crd secretagentconfigurations.secret-agent.secrets.forgerock.io',
95 cstderr=True, cstdout=True)
96 except Exception as _e:
97 warning('secret-agent CRD not found. Installing secret-agent.')
98 secretagent('apply', tag=REQ_VERSIONS['secret-agent']['DEFAULT'])
99 else:
100 message('secret-agent CRD found in cluster.')
101 message('\nChecking secret-agent operator is running...')
102 run('kubectl', 'wait --for=condition=Established crd secretagentconfigurations.secret-agent.secrets.forgerock.io --timeout=30s')
103 run('kubectl', '-n secret-agent-system wait --for=condition=available deployment --all --timeout=120s')
104 try:
105 run('kubectl', '-n secret-agent-system get pod -l app.kubernetes.io/name=secret-agent-manager --field-selector=status.phase==Running')
106 except Exception as e:
107 error(f'Could not find a running secret-agent pod. See the following error: {e}')
108 sys.exit(1)
109 message('secret-agent operator is running')
110
111 _, img, _ = run('kubectl', f'-n secret-agent-system get deployment secret-agent-controller-manager -o jsonpath={{.spec.template.spec.containers[0].image}}',
112 cstderr=True, cstdout=True)
113 check_component_version('secret-agent', img.decode('ascii').split(':')[1])
114
115 print()

Callers

nothing calls this directly

Calls 8

runFunction · 0.90
warningFunction · 0.90
certmanagerFunction · 0.90
messageFunction · 0.90
secretagentFunction · 0.90
errorFunction · 0.90
check_base_toolsetFunction · 0.85
check_component_versionFunction · 0.85

Tested by

no test coverage detected