domino-py-iisas 1.0.6__py3-none-any.whl → 1.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
domino/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
domino/cli/cli.py CHANGED
@@ -48,6 +48,14 @@ def get_cluster_name_from_env():
48
48
  return cluster_name
49
49
 
50
50
 
51
+ def get_cluster_http_port_from_env():
52
+ return os.environ.get("DOMINO_KIND_CLUSTER_HTTP_PORT", 80)
53
+
54
+
55
+ def get_cluster_https_port_from_env():
56
+ return int(os.environ.get("DOMINO_KIND_CLUSTER_HTTPS_PORT", 443))
57
+
58
+
51
59
  def get_github_workflows_ssh_private_key_from_env():
52
60
  return os.environ.get("DOMINO_GITHUB_WORKFLOWS_SSH_PRIVATE_KEY", "")
53
61
 
@@ -83,6 +91,18 @@ def get_github_token_pieces_from_config_or_env():
83
91
  default=get_cluster_name_from_env,
84
92
  help='Define the name for the local k8s cluster.'
85
93
  )
94
+ @click.option(
95
+ '--http-port',
96
+ prompt='Local cluster HTTP port',
97
+ default=get_cluster_http_port_from_env,
98
+ help='Define the HTTP port for the local k8s cluster.'
99
+ )
100
+ @click.option(
101
+ '--https-port',
102
+ prompt='Local cluster HTTPS port',
103
+ default=get_cluster_https_port_from_env,
104
+ help='Define the HTTPS port for the local k8s cluster.'
105
+ )
86
106
  @click.option(
87
107
  '--workflows-repository',
88
108
  prompt='Workflows repository',
@@ -145,6 +165,8 @@ def get_github_token_pieces_from_config_or_env():
145
165
  )
146
166
  def cli_prepare_platform(
147
167
  cluster_name,
168
+ http_port,
169
+ https_port,
148
170
  workflows_repository,
149
171
  github_workflows_ssh_private_key,
150
172
  github_default_pieces_repository_token,
@@ -160,6 +182,8 @@ def cli_prepare_platform(
160
182
  """Prepare local folder for running a Domino platform."""
161
183
  platform.prepare_platform(
162
184
  cluster_name=cluster_name,
185
+ http_port=int(http_port),
186
+ https_port=int(https_port),
163
187
  workflows_repository=workflows_repository,
164
188
  github_workflows_ssh_private_key=github_workflows_ssh_private_key,
165
189
  github_default_pieces_repository_token=github_default_pieces_repository_token,
@@ -1,15 +1,20 @@
1
1
  # Configuration file for running Domino platform locally
2
-
3
- [airflow]
4
- AIRFLOW_API_SERVER_PORT_HOST = 8080
2
+ [airflow_db]
3
+ AIRFLOW_DB_IMAGE = "ghcr.io/cloudnative-pg/postgresql"
4
+ AIRFLOW_DB_IMAGE_TAG = "13"
5
+ AIRFLOW_DB_HOST = "airflow-postgresql"
6
+ AIRFLOW_DB_PORT = 5432
7
+ AIRFLOW_DB_USER = "airflow"
8
+ AIRFLOW_DB_PASSWORD = "airflow"
9
+ AIRFLOW_DB_NAME = "postgres"
5
10
 
6
11
  [path]
7
12
  DOMINO_LOCAL_RUNNING_PATH = ""
8
13
 
9
14
  [kind]
10
15
  DOMINO_KIND_CLUSTER_NAME = "domino-cluster"
11
- HTTP_PORT_HOST = 80
12
- HTTPS_PORT_HOST = 443
16
+ DOMINO_KIND_CLUSTER_HTTP_PORT = 80
17
+ DOMINO_KIND_CLUSTER_HTTPS_PORT = 443
13
18
 
14
19
  [github]
15
20
  DOMINO_GITHUB_WORKFLOWS_REPOSITORY = ""
@@ -9,6 +9,7 @@ import requests
9
9
  import time
10
10
  from concurrent.futures import ThreadPoolExecutor
11
11
  import base64
12
+ import sys
12
13
  from pathlib import Path
13
14
  from rich.console import Console
14
15
  from yaml.resolver import BaseResolver
@@ -58,6 +59,8 @@ def create_ssh_pair_key() -> None:
58
59
 
59
60
  def prepare_platform(
60
61
  cluster_name: str,
62
+ http_port: int,
63
+ https_port: int,
61
64
  workflows_repository: str,
62
65
  github_workflows_ssh_private_key: str,
63
66
  github_default_pieces_repository_token: str,
@@ -78,6 +81,10 @@ def prepare_platform(
78
81
  config_dict["path"]["DOMINO_LOCAL_RUNNING_PATH"] = running_path
79
82
  config_dict["kind"]["DOMINO_KIND_CLUSTER_NAME"] = cluster_name
80
83
  config_dict['kind']['DOMINO_DEPLOY_MODE'] = deploy_mode
84
+ config_dict["kind"]["DOMINO_KIND_CLUSTER_HTTP_PORT"] = http_port
85
+ config_dict["kind"]["DOMINO_KIND_CLUSTER_HTTPS_PORT"] = https_port
86
+
87
+ config_dict["domino_frontend"]["API_URL"] = "http://localhost{}/api".format(f":{http_port}")
81
88
 
82
89
  if deploy_mode == 'local-k8s-dev':
83
90
  config_dict['dev']['DOMINO_AIRFLOW_IMAGE'] = local_airflow_image
@@ -171,19 +178,13 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
171
178
  extraPortMappings=[
172
179
  dict(
173
180
  containerPort=80,
174
- hostPort=platform_config['kind'].get('HTTP_PORT_HOST', 80),
181
+ hostPort=platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTP_PORT', 80),
175
182
  listenAddress="0.0.0.0",
176
183
  protocol="TCP"
177
184
  ),
178
185
  dict(
179
186
  containerPort=443,
180
- hostPort=platform_config['kind'].get('HTTPS_PORT_HOST', 443),
181
- listenAddress="0.0.0.0",
182
- protocol="TCP"
183
- ),
184
- dict(
185
- containerPort=8080,
186
- hostPort=platform_config['airflow'].get('AIRFLOW_API_SERVER_PORT_HOST', 8080),
187
+ hostPort=platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTPS_PORT', 443),
187
188
  listenAddress="0.0.0.0",
188
189
  protocol="TCP"
189
190
  )
@@ -263,7 +264,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
263
264
 
264
265
  if local_domino_rest_image:
265
266
  console.print(f"Loading local REST image {local_domino_rest_image} to Kind cluster...")
266
- subprocess.run(["kind", "load", "docker-image", local_domino_rest_image , "--name", cluster_name, "--nodes", f"{cluster_name}-worker"])
267
+ subprocess.run(["kind", "load", "docker-image", local_domino_rest_image, "--name", cluster_name, "--nodes", f"{cluster_name}-worker"])
267
268
  domino_rest_image = f'docker.io/library/{local_domino_rest_image}'
268
269
  elif platform_config['kind']["DOMINO_DEPLOY_MODE"] == 'local-k8s-dev':
269
270
  domino_rest_image = "ghcr.io/iisas/domino-rest:latest-dev"
@@ -301,7 +302,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
301
302
  "image": domino_frontend_image,
302
303
  "apiEnv": "dev" if platform_config['kind']["DOMINO_DEPLOY_MODE"] in ['local-k8s-dev', 'local-k8s'] else 'prod',
303
304
  "deployMode": platform_config['kind']["DOMINO_DEPLOY_MODE"],
304
- "apiUrl": platform_config['domino_frontend'].get('API_URL', 'http://localhost:{}/api'.format(platform_config['kind'].get('HTTP_PORT_HOST', 80))),
305
+ "apiUrl": platform_config['domino_frontend'].get('API_URL', 'http://localhost:{}/api'.format(platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTP_PORT', 80))),
305
306
  "baseName": platform_config['domino_frontend'].get('BASE_NAME', '/')
306
307
  },
307
308
  "rest": {
@@ -309,14 +310,6 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
309
310
  "image": domino_rest_image,
310
311
  "workflowsRepository": platform_config['github']['DOMINO_GITHUB_WORKFLOWS_REPOSITORY'],
311
312
  "createDefaultUser": platform_config['domino_db'].get('DOMINO_CREATE_DEFAULT_USER', True)
312
- },
313
- "database": {
314
- "enabled": db_enabled,
315
- "image": "postgres:13",
316
- "name": "postgres",
317
- "user": "postgres",
318
- "password": "postgres",
319
- "port": "5432",
320
313
  }
321
314
  }
322
315
 
@@ -326,7 +319,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
326
319
  domino_values_override_config['database'] = {
327
320
  **domino_values_override_config['database'],
328
321
  "host": platform_config['domino_db']["DOMINO_DB_HOST"],
329
- "name": platform_config['domino_db']["DOMINO_DB_NAME"],
322
+ "name": platform_config['domino_db']["DOMINO_DB_NAME"],
330
323
  "user": platform_config['domino_db']["DOMINO_DB_USER"],
331
324
  "password": platform_config['domino_db']["DOMINO_DB_PASSWORD"],
332
325
  "port": str(platform_config['domino_db'].get("DOMINO_DB_PORT", 5432))
@@ -430,6 +423,12 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
430
423
  "sidecar.istio.io/inject": "false"
431
424
  },
432
425
  },
426
+ "postgresql": {
427
+ "enabled": False,
428
+ },
429
+ "data": {
430
+ "metadataSecretName": 'airflow-metadata-secret'
431
+ },
433
432
  **workers,
434
433
  **scheduler,
435
434
  }
@@ -442,6 +441,116 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
442
441
  # Install Airflow Helm Chart
443
442
  if install_airflow:
444
443
  console.print('Installing Apache Airflow...')
444
+
445
+ # External database for the Airflow metastore (due to [changes](https://github.com/bitnami/containers/issues/83267) related to bitnami images since [v1.12.0](https://airflow.apache.org/docs/helm-chart/1.12.0/release_notes.html#the-helm-chart-is-now-using-a-newer-version-of-bitnami-postgresql-dependency-34817))
446
+ if not airflow_values_override_config['postgresql']['enabled']:
447
+ console.print('Installing external database for the Apache Airflow metastore...')
448
+
449
+ # create secret for the Airflow metastore
450
+ airflow_db_host = platform_config['airflow_db'].get('AIRFLOW_DB_HOST', 'airflow-postgres')
451
+ airflow_db_port = platform_config['airflow_db'].get('AIRFLOW_DB_PORT', 5432)
452
+ airflow_db_user = platform_config['airflow_db'].get('AIRFLOW_DB_USER', 'airflow')
453
+ airflow_db_password = platform_config['airflow_db'].get('AIRFLOW_DB_PASSWORD', 'airflow')
454
+ airflow_db_name = platform_config['airflow_db'].get('AIRFLOW_DB_NAME', 'postgres')
455
+ result = subprocess.run(["kubectl", "create", "secret", "generic",
456
+ f"{airflow_values_override_config['data']['metadataSecretName']}",
457
+ f"--from-literal=connection=postgresql://{airflow_db_user}:{airflow_db_password}@{airflow_db_host}:{airflow_db_port}/{airflow_db_name}"])
458
+ if result.returncode != 0:
459
+ error_message = result.stderr.strip() if result.stderr else result.stdout.strip()
460
+
461
+ # deploy Airflow metastore database
462
+ airflow_db_image = platform_config['airflow_db'].get('AIRFLOW_DB_IMAGE',
463
+ 'ghcr.io/cloudnative-pg/postgresql')
464
+ airflow_db_image_tag = platform_config['airflow_db'].get('AIRFLOW_DB_IMAGE_TAG', '13')
465
+ cnpg_operator_add_repo_command = [
466
+ "helm", "repo", "add", "cnpg", "https://cloudnative-pg.github.io/charts"
467
+ ]
468
+ console.print("Adding CloudNativePG repository...")
469
+ subprocess.run(cnpg_operator_add_repo_command)
470
+ helm_update_command = ["helm", "repo", "update", "cnpg"]
471
+ console.print("Updating helm repositories...")
472
+ subprocess.run(helm_update_command)
473
+ cnpg_operator_install_command = [
474
+ "helm", "install", "cnpg",
475
+ "--namespace", "cnpg-system",
476
+ "--create-namespace",
477
+ "--set", "config.clusterWide=false",
478
+ "cnpg/cloudnative-pg",
479
+ "--hide-notes"
480
+ ]
481
+ console.print("Installing CloudNativePG operator...")
482
+ subprocess.run(cnpg_operator_install_command)
483
+
484
+ airflow_db_manifest = [
485
+ {
486
+ "apiVersion": "postgresql.cnpg.io/v1",
487
+ "kind": "Cluster",
488
+ "metadata": {
489
+ "name": "airflow-postgres",
490
+ "namespace": "default"
491
+ },
492
+ "spec": {
493
+ "instances": 1,
494
+ "imageName": f"{airflow_db_image}:{airflow_db_image_tag}",
495
+ "storage": {
496
+ "size": "1Gi"
497
+ },
498
+ "bootstrap": {
499
+ "initdb": {
500
+ "database": f"{airflow_db_name}",
501
+ "owner": f"{airflow_db_user}",
502
+ "secret": {
503
+ "name": f"{airflow_values_override_config['data']['metadataSecretName']}"
504
+ }
505
+ }
506
+ }
507
+ }
508
+ },
509
+ {
510
+ "apiVersion": "v1",
511
+ "kind": "Service",
512
+ "metadata": {
513
+ "name": "airflow-postgres-service",
514
+ "namespace": "default"
515
+ },
516
+ "spec": {
517
+ "type": "ClusterIP",
518
+ "selector": {
519
+ "app": "airflow-postgres"
520
+ },
521
+ "ports": [
522
+ {
523
+ "protocol": "TCP",
524
+ "port": 5432,
525
+ "targetPort": 5432
526
+ }
527
+ ]
528
+ }
529
+ }
530
+ ]
531
+
532
+ with NamedTemporaryFile(suffix='.yaml', mode="w", delete_on_close=False) as fp:
533
+ # Dump as separate YAML documents
534
+ yaml_output = "\n---\n".join(
535
+ yaml.safe_dump(doc, sort_keys=False) for doc in airflow_db_manifest
536
+ )
537
+ fp.write(yaml_output)
538
+ fp.close()
539
+ commands = [
540
+ "kubectl", "apply", "-f", str(fp.name), "--validate=false"
541
+ ]
542
+ subprocess.run(commands, stdout=subprocess.DEVNULL)
543
+ commands = [
544
+ "kubectl", "wait", "--namespace", "default", "--for", "condition=Ready", "cluster/airflow-postgres", "--timeout=60s"
545
+ ]
546
+ result = subprocess.run(commands)
547
+ if result.returncode != 0:
548
+ error_message = result.stderr.strip() if result.stderr else result.stdout.strip() if result.stdout else 'no details given'
549
+ raise Exception(f"An error occurred while installing database for Apache Airflow metastore: {error_message}")
550
+
551
+ console.print("database for the Apache Airflow metastore installed successfully!", style=f"bold {COLOR_PALETTE.get('success')}")
552
+ console.print("")
553
+
445
554
  # Create temporary file with airflow values
446
555
  with NamedTemporaryFile(suffix='.yaml', mode="w") as fp:
447
556
  yaml.dump(airflow_values_override_config, fp)
@@ -464,7 +573,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
464
573
  commands = [
465
574
  "helm", "install",
466
575
  "-f", str(fp.name),
467
- "domino-iisas",
576
+ "domino",
468
577
  helm_domino_path
469
578
  ]
470
579
  subprocess.run(commands)
@@ -653,9 +762,9 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
653
762
 
654
763
  console.print("")
655
764
  console.print("K8s resources created successfully!", style=f"bold {COLOR_PALETTE.get('success')}")
656
- console.print("You can now access the Domino frontend at: http://localhost:{}/".format(platform_config['kind'].get('HTTP_PORT_HOST')))
657
- console.print("Domino's REST API: http://localhost:{}/api/".format(platform_config['kind'].get('HTTP_PORT_HOST')))
658
- console.print("Domino's REST API Swagger: http://localhost:{}/api/docs".format(platform_config['kind'].get('HTTP_PORT_HOST')))
765
+ console.print("You can now access the Domino frontend at: http://localhost:{}/".format(platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTP_PORT')))
766
+ console.print("Domino's REST API: http://localhost:{}/api/".format(platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTP_PORT')))
767
+ console.print("Domino's REST API Swagger: http://localhost:{}/api/docs".format(platform_config['kind'].get('DOMINO_KIND_CLUSTER_HTTP_PORT')))
659
768
  console.print("")
660
769
 
661
770
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: domino-py-iisas
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: Fork of the original Python package for Domino.
5
5
  Author-email: Stefan Dlugolinsky <stefan.dlugolinsky@savba.sk>, Luiz Tauffer <luiz@taufferconsulting.com>, Vinicius Vaz <vinicius@taufferconsulting.com>
6
6
  License:
@@ -1,18 +1,18 @@
1
- domino/VERSION,sha256=UcGNyGlIYb60emeJTmEESGQhRDU4n206J0cE2VZv-Ww,6
1
+ domino/VERSION,sha256=bWuSMN2LiqxSf4kpt8L8H6A2XezMqFYhbel51vXGpv4,6
2
2
  domino/__init__.py,sha256=I3dmIBqKnlYjo-VFCDdA_7YUqsNT-i9QtQqXnV9pW4U,233
3
3
  domino/base_piece.py,sha256=LZE08XqU63Zq_W7G9DuFk8ZEjKNhgSE7pumXBctW9BE,17610
4
4
  domino/logger.py,sha256=08Km3_NmgYH3HrxJjZJWGSmOv7dE5E5xvo9_ZnKut_o,889
5
5
  domino/task.py,sha256=VNGo969ZOvevuDCexp8U3IN4lN1iX3vf5hs7rvnKd2o,6774
6
6
  domino/actions/github_actions.py,sha256=XvfeDgCiTVOc1twLN1ahdqBhPC9oYtpTtkmPGjN77x4,2273
7
7
  domino/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- domino/cli/cli.py,sha256=efdDEFw08ieb4gcVTMMkaAyo7e-6OpLq34q5ExUM8vI,14372
8
+ domino/cli/cli.py,sha256=lP-ApzSVT1rSF2BvxG3PD7zvOgAvrMsPyvpafgLs7_Y,15045
9
9
  domino/cli/tests/test_create_piece.py,sha256=DQuJDG8kVEtDHxQjh4uttbkp21vtsmsBPvZhAV8vvjs,3305
10
10
  domino/cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- domino/cli/utils/config-domino-local.toml,sha256=0VaOJij0eQdRVHmpUi_Ee8pid_N0NnZF8y79u-Q63bo,853
11
+ domino/cli/utils/config-domino-local.toml,sha256=9Mu2GBHeYNLxt9o3be_7Hzl-li2USNCM3mZ0BwiAnyw,1083
12
12
  domino/cli/utils/constants.py,sha256=8CbuNpXqCFCFjtcRt1X3_2i0udPerdUbIs4Z35AFRhc,252
13
13
  domino/cli/utils/docker-compose.yaml,sha256=r2M5-Unp5MXvkCYLVy9Z4qXVN1onYlncTqlHHJaKJQc,12667
14
14
  domino/cli/utils/pieces_repository.py,sha256=5lkUZtY3PH5pSwenNDi2kGfxWLL4v2uWLNYI62Sd16Q,22760
15
- domino/cli/utils/platform.py,sha256=GhKT86xDYIMUJ5Xwo16spR_5wCq4HHN_Ki3EgjKLmD0,42817
15
+ domino/cli/utils/platform.py,sha256=oV1a60A7KW8fZRFii-Osvt8WVxayaQXBA_2rb-D9dvc,48697
16
16
  domino/cli/utils/templates.py,sha256=b7YhxqblrWeFhxmYiFh_iqRcJxIUZgPiaWhOHeb0shY,1982
17
17
  domino/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  domino/client/domino_backend_client.py,sha256=GuE4nZYt7Ke8vrnSa7o2VRAUYvy19RdyYwJD6WpoAik,2861
@@ -63,9 +63,9 @@ domino/utils/__init__.py,sha256=7CET-zz6y1EBuBJQLgF3rXNhKOSj32Z3X_3mKUAirII,231
63
63
  domino/utils/metadata_default.py,sha256=4tbmWoVuoRMxd2c2vkwKYLkTTDf1I0OooXB_P5DGWXM,455
64
64
  domino/utils/piece_generator.py,sha256=Yww5PwH-EDLqNrnWAinCgpG5-uQSVi_3UbMw4HZCE-E,514
65
65
  domino/utils/workflow_shared_storage.py,sha256=USt_Q6nRGrtbcgrWHjtEvBDMSGSDd3BwUrZVe0RItH0,272
66
- domino_py_iisas-1.0.6.dist-info/licenses/LICENSE,sha256=ZOzivsSTOmVUr23IVL-IMv2nDRhWBp4hVxwYTNe4fBc,11353
67
- domino_py_iisas-1.0.6.dist-info/METADATA,sha256=kks2Ta-i8LO3eBNZ93VhDKRAFSLGqGcjlGoR0V-96-o,17095
68
- domino_py_iisas-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
- domino_py_iisas-1.0.6.dist-info/entry_points.txt,sha256=EBX10akoWncqaYPjad7nTNFpge2bbooLSZJGPT-Ivzk,46
70
- domino_py_iisas-1.0.6.dist-info/top_level.txt,sha256=Mo0jr96Ke1GnB5Qa_U9nSu_7yRSWsu5dvPJk8RFiwRw,7
71
- domino_py_iisas-1.0.6.dist-info/RECORD,,
66
+ domino_py_iisas-1.0.7.dist-info/licenses/LICENSE,sha256=ZOzivsSTOmVUr23IVL-IMv2nDRhWBp4hVxwYTNe4fBc,11353
67
+ domino_py_iisas-1.0.7.dist-info/METADATA,sha256=VqYHIyFJkilcGYSiX13hhUtsR2gMwDZfSOCzfmj8S_E,17095
68
+ domino_py_iisas-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
+ domino_py_iisas-1.0.7.dist-info/entry_points.txt,sha256=EBX10akoWncqaYPjad7nTNFpge2bbooLSZJGPT-Ivzk,46
70
+ domino_py_iisas-1.0.7.dist-info/top_level.txt,sha256=Mo0jr96Ke1GnB5Qa_U9nSu_7yRSWsu5dvPJk8RFiwRw,7
71
+ domino_py_iisas-1.0.7.dist-info/RECORD,,