MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / environment

Function environment

misc/python/materialize/cli/orchestratord.py:189–327  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

187
188
189def environment(args: argparse.Namespace):
190 env_kubectl = make_env_kubectl(args)
191
192 if args.environmentd_version:
193 image_tag = args.environmentd_version
194 else:
195 for image in ["environmentd", "clusterd", "balancerd", "console"]:
196 acquire(
197 image,
198 dev=args.dev,
199 cluster=args.kind_cluster_name,
200 )
201 image_tag = DEV_IMAGE_TAG
202 environmentd_image_ref = f"{image_registry()}/environmentd:{image_tag}"
203
204 try:
205 kubectl(
206 "get",
207 "namespace",
208 args.namespace,
209 cluster=args.kind_cluster_name,
210 )
211 except subprocess.CalledProcessError:
212 kubectl(
213 "create",
214 "namespace",
215 args.namespace,
216 cluster=args.kind_cluster_name,
217 )
218
219 if args.environment_id is None:
220 environment_id = str(uuid4())
221 else:
222 environment_id = args.environment_id
223
224 def root_psql(cmd: str):
225 env_kubectl(
226 "run",
227 "psql-setup",
228 "--labels=app=environmentd",
229 "--image=postgres",
230 "--command=true",
231 "--restart=Never",
232 "--attach=true",
233 "--rm=true",
234 "--",
235 "psql",
236 args.postgres_url,
237 "-c",
238 cmd,
239 )
240 env_kubectl("wait", "--for=delete", "pod/psql-setup")
241
242 pg_user = f"materialize_{environment_id}"
243 pg_pass = "password"
244 pg_db = f"materialize_{environment_id}"
245
246 try:

Callers

nothing calls this directly

Calls 10

image_registryFunction · 0.90
make_env_kubectlFunction · 0.85
acquireFunction · 0.85
kubectlFunction · 0.85
root_psqlFunction · 0.85
env_kubectlFunction · 0.85
get_resource_idFunction · 0.85
retryFunction · 0.70
readMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected