fast2dev 1.0.0__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.
- f2dev/__init__.py +1 -0
- f2dev/__main__.py +5 -0
- f2dev/_bundle/platform/.dockerignore +80 -0
- f2dev/_bundle/platform/.gitignore +82 -0
- f2dev/_bundle/platform/LICENSE +202 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/template_values.yaml +1731 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/Chart.yaml +9 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-airflow-deploy.yaml +60 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-bi-sync.yaml +46 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-checkout.yaml +49 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-console-sync.yaml +41 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-e2e-label.yaml +48 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-e2e-run.yaml +43 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-e2e-teardown.yaml +47 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-governance.yaml +40 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-lint.yaml +37 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-notify.yaml +32 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-quality.yaml +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-refresh.yaml +36 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-supersede.yaml +30 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/block-tags.yaml +44 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/pipeline-branch.yaml +138 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/pipeline-main.yaml +150 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/files/pipeline-pr.yaml +184 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/templates/NOTES.txt +18 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/templates/settings-configmap.yaml +14 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/templates/workflowtemplates.yaml +31 -0
- f2dev/_bundle/platform/charts/data_services_charts/argo_workflows/workflow_templates/values.yaml +41 -0
- f2dev/_bundle/platform/charts/data_services_charts/cicd_workload_runner/github/template_github_values.yaml +436 -0
- f2dev/_bundle/platform/charts/data_services_charts/cicd_workload_runner/github/template_github_values_extra.yaml +49 -0
- f2dev/_bundle/platform/charts/data_services_charts/cicd_workload_runner/gitlab/template_gitlab_values.yaml +551 -0
- f2dev/_bundle/platform/charts/data_services_charts/cicd_workload_runner/gitlab/template_gitlab_values_extra.yaml +9 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_analysis/lightdash/template_values.yaml +359 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_analysis/metabase/template_values.yaml +384 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_analysis/superset/template_values.yaml +1562 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_analysis/template_values.yaml +269 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/.helmignore +15 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/Chart.yaml +20 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/template_values.yaml.j2 +175 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/NOTES.txt +19 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/_helpers.tpl +50 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/cicd-rbac.yaml +30 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/configmap.yaml +142 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/extras.yaml +14 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/ingress.yaml +69 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/promtail-configmap.yaml +68 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/secret.yaml +31 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/service.yaml +15 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/serviceaccount.yaml +12 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/statefulset.yaml +276 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/valkey.yaml +113 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/templates/warehouse-stats-cronjob.yaml +107 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_control_plane/values.yaml +828 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_dbt_server/template_values.yaml +385 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_governance/template_dh_prerequisites_values.yaml +118 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_governance/template_dh_values.yaml +1671 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_governance/template_kafka_values.yaml +112 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_governance/template_opensearch_values.yaml +662 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_governance/template_values.yaml +738 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/Chart.yaml +6 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/files/argo-openapi.json +681 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/templates/_helpers.tpl +17 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/templates/argo-rbac.yaml +35 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/templates/backends.yaml +327 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/templates/gateway.yaml +150 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/hub/values.yaml +91 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_mcp_hub/template_values.yaml +142 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_modeling/template_values.yaml +1167 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_modeling/template_values_extra.yaml +99 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/airflow-cleanup/Dockerfile +10 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/airflow-cleanup/build.sh +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/airflow-cleanup/cleanup.py +452 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/airflow-cleanup/requirements.txt +3 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/docs/keycloak-oidc-setup.md +106 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/template_values.yaml +5536 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/template_values_extra.yaml +379 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/webserver-config/configmap.yaml +459 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/webserver-config/fast2dev_auth.py +285 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/webserver-config/fast2dev_mcp_plugin.py +24 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_orchestration/webserver-config/webserver_config.py +130 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/Dockerfile +10 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/build.sh +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/cleanup.py +749 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/k8s/configmap.yaml +24 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/k8s/cronjob.yaml +137 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte-cleanup/requirements.txt +3 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/.helmignore +26 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/Chart.lock +3 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/Chart.yaml +15 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/README.md +243 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/NOTES.txt +31 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/_helpers.tpl +245 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/_images.tpl +17 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-auth-secret.yaml +35 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-bootloader/bootloader-secrets.yaml +19 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-bootloader/pod.yaml +126 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-connector-rollout-worker/deployment.yaml +171 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-cron/cron-secrets.yaml +19 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-cron/deployment.yaml +149 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-db.yaml +88 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/_helpers.tpl +111 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/deployment.yaml +169 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/hpa.yaml +23 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/pdb.yaml +17 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/service.yaml +25 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-direct-job-runner/serviceaccount.yaml +10 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-featureflag-server/deployment.yaml +161 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-featureflag-server/service.yaml +25 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-keycloak/service.yaml +62 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-keycloak/statefulset.yaml +182 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-manifest-server/_helpers.tpl +54 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-manifest-server/deployment.yaml +152 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-manifest-server/service.yaml +23 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-manifest-server/serviceaccount.yaml +10 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-metrics/deployment.yaml +124 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-server/deployment.yaml +227 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-server/service.yaml +29 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-stigg-sidecar/deployment.yaml +184 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-stigg-sidecar/service.yaml +21 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-temporal/configmap.yaml +55 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-temporal/deployment.yaml +220 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-temporal/service.yaml +21 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-temporal-ui/deployment.yaml +122 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-temporal-ui/service.yaml +23 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-webapp/deployment.yaml +146 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-webapp/ingress.yaml +63 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-webapp/service.yaml +32 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-worker/deployment.yaml +229 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-workload-api-server/deployment.yaml +191 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-workload-api-server/service.yaml +25 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-workload-launcher/deployment.yaml +232 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/airbyte-workload-launcher/jobs-secrets.yaml +21 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_auth.tpl +944 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_aws.tpl +109 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_cluster.tpl +82 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_common.tpl +370 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_connector.tpl +58 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_connectorRollout.tpl +141 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_connectorRolloutWorker.tpl +56 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_cron.tpl +62 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_customerio.tpl +56 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_database.tpl +375 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_dataplaneGroups.tpl +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_directJobRunner.tpl +122 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_featureFlags.tpl +126 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_java.tpl +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_jobs.tpl +422 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_keycloak.tpl +542 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_logging.tpl +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_metrics.tpl +214 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_micronaut.tpl +43 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_minio.tpl +64 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_secretsManager.tpl +628 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_server.tpl +533 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_shopify.tpl +83 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_stigg.tpl +157 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_storage.tpl +468 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_temporal.tpl +943 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_topology.tpl +98 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_tracking.tpl +82 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_webapp.tpl +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_worker.tpl +366 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_workloadApiServer.tpl +62 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_workloadLauncher.tpl +395 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/config/_workloads.tpl +770 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/env-configmap.yaml +62 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/gcs-log-creds-secret.yaml +19 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/ingress.yaml +69 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/minio.yaml +161 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/secret.yaml +31 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/serviceaccount.yaml +50 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/telemetry-configmap.yaml +32 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/templates/tests/test-webapp.yaml +34 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte/values.yaml +3158 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/.helmignore +12 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/Chart.yaml +16 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/README.md +172 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/templates/_helpers.tpl +42 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/templates/deployment.yaml +105 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/templates/externalsecret.yaml +23 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/templates/pdb.yaml +15 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/templates/service.yaml +18 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/airbyte_chart/airbyte-metrics-fast2dev-ddp/values.yaml +97 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/feature-flags-configmap.yaml +16 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/template_metrics_values.yaml +13 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/template_oauth2proxy_values.yaml +1200 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_replication/template_values.yaml +3255 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/Chart.yaml +7 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/hazelcast-client.yaml +27 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/hazelcast-master.yaml +38 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/hazelcast-worker.yaml +29 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/jvm_client_options +24 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/jvm_master_options +6 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/jvm_worker_options +6 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/log4j2.properties +109 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/conf/seatunnel.yaml +36 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/_helpers.tpl +70 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/configmap.yaml +11 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/deployment-master.yaml +120 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/deployment-worker.yaml +118 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/rbac.yaml +32 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/templates/services.yaml +33 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/seatunnel/values.yaml +101 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/template_oauth2proxy_values.yaml +196 -0
- f2dev/_bundle/platform/charts/data_services_charts/data_streaming/template_values.yaml +75 -0
- f2dev/_bundle/platform/charts/data_services_charts/object_storage_operator/template_values.yaml +506 -0
- f2dev/_bundle/platform/charts/infra_services_charts/cert_manager/csi_driver_values.yaml +193 -0
- f2dev/_bundle/platform/charts/infra_services_charts/cert_manager/template_pdns_webhook_values.yaml +91 -0
- f2dev/_bundle/platform/charts/infra_services_charts/cert_manager/template_values.yaml +1777 -0
- f2dev/_bundle/platform/charts/infra_services_charts/cert_manager/template_values_extra.yaml +253 -0
- f2dev/_bundle/platform/charts/infra_services_charts/cluster_cleaner/template_values.yaml +57 -0
- f2dev/_bundle/platform/charts/infra_services_charts/external_dns/template_values.yaml +476 -0
- f2dev/_bundle/platform/charts/infra_services_charts/external_dns/template_values_extra.yaml +131 -0
- f2dev/_bundle/platform/charts/infra_services_charts/idp_sso_manager/realm_template.json +4785 -0
- f2dev/_bundle/platform/charts/infra_services_charts/idp_sso_manager/template_values.yaml +657 -0
- f2dev/_bundle/platform/charts/infra_services_charts/pvc_autoscaller/template_values.yaml +36 -0
- f2dev/_bundle/platform/charts/infra_services_charts/pvc_autoscaller/template_values_extra.yaml +352 -0
- f2dev/_bundle/platform/charts/infra_services_charts/secret_manager/template_values.yaml +1218 -0
- f2dev/_bundle/platform/charts/infra_services_charts/secret_manager/template_values_extra.yaml +845 -0
- f2dev/_bundle/platform/charts/infra_services_charts/secret_manager_operator/template_values.yaml +561 -0
- f2dev/_bundle/platform/charts/infra_services_charts/secret_manager_operator/template_values_extra.yaml +23 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_logs/template_alloy_events_values.yaml +59 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_logs/template_alloy_values.yaml +185 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_logs/template_loki_values.yaml +108 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_metrics/template_values.yaml +1530 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/00-main/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/00-main/f2d-main.json +2871 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/01-platform/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/01-platform/f2d-k8s-cluster.json +1751 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/01-platform/f2d-microservices.json +1682 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/01-platform/f2d-pvc-storage.json +1320 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/01-platform/f2d-service.json +1193 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/f2d-cert-manager.json +755 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/f2d-keycloak.json +746 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/f2d-object-storage.json +881 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/f2d-postgresql.json +1590 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/02-infrastructure/f2d-traefik.json +1375 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-cicd-workflows-trends.json +1916 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-cicd-workflows.json +1330 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-analysis.json +631 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-freshness.json +1362 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-governance.json +1958 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-modeling.json +764 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-orchestration-trends.json +2352 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-orchestration.json +1506 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-quality.json +1549 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-replication-trends.json +2799 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-replication.json +2153 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-streaming-trends.json +1536 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/03-data-services/f2d-data-streaming.json +1209 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/04-data-warehouse/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/04-data-warehouse-bigquery/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/04-data-warehouse-bigquery/f2d-bigquery.json +990 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/05-logs/.gitkeep +0 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/05-logs/f2d-logs.json +630 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/folders.yaml +17 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/dashboards/requirements.yaml +8 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/template_alerts_cm.yaml +2031 -0
- f2dev/_bundle/platform/charts/infra_services_charts/services_monitoring/template_values.yaml +1315 -0
- f2dev/_bundle/platform/charts/infra_services_charts/stackgres_postgres_db/template_values.yaml +550 -0
- f2dev/_bundle/platform/charts/infra_services_charts/stackgres_postgres_db/template_values_extra.yaml +742 -0
- f2dev/_bundle/platform/charts/infra_services_charts/traefik_lb/template_values.yaml +1758 -0
- f2dev/_bundle/platform/cli/README.md +866 -0
- f2dev/_bundle/platform/cli/__init__.py +42 -0
- f2dev/_bundle/platform/cli/__main__.py +17 -0
- f2dev/_bundle/platform/cli/cert_providers.py +369 -0
- f2dev/_bundle/platform/cli/command_record.py +144 -0
- f2dev/_bundle/platform/cli/config/data_services_config.json +217 -0
- f2dev/_bundle/platform/cli/config/environment_profiles.yaml +183 -0
- f2dev/_bundle/platform/cli/config/images.json +129 -0
- f2dev/_bundle/platform/cli/config/infrastructure_services_config.json +141 -0
- f2dev/_bundle/platform/cli/config.py +252 -0
- f2dev/_bundle/platform/cli/deployment_configuration_aws_example.yaml +117 -0
- f2dev/_bundle/platform/cli/deployment_configuration_gcp_example.yaml +130 -0
- f2dev/_bundle/platform/cli/deployment_configuration_onprem_example.yaml +71 -0
- f2dev/_bundle/platform/cli/destroy.py +677 -0
- f2dev/_bundle/platform/cli/dns_check.py +27 -0
- f2dev/_bundle/platform/cli/dns_providers.py +405 -0
- f2dev/_bundle/platform/cli/exit_codes.py +32 -0
- f2dev/_bundle/platform/cli/fixers.py +56 -0
- f2dev/_bundle/platform/cli/generate_only.py +336 -0
- f2dev/_bundle/platform/cli/health_report.py +114 -0
- f2dev/_bundle/platform/cli/logging.py +206 -0
- f2dev/_bundle/platform/cli/main.py +5293 -0
- f2dev/_bundle/platform/cli/precheck.py +1523 -0
- f2dev/_bundle/platform/cli/prerequisites/README.md +208 -0
- f2dev/_bundle/platform/cli/prerequisites/install-prerequisites.bat +107 -0
- f2dev/_bundle/platform/cli/prerequisites/install-prerequisites.ps1 +343 -0
- f2dev/_bundle/platform/cli/prerequisites/install-prerequisites.sh +207 -0
- f2dev/_bundle/platform/cli/prerequisites/linux/install-linux.sh +775 -0
- f2dev/_bundle/platform/cli/prerequisites/macos/install-macos.sh +634 -0
- f2dev/_bundle/platform/cli/prerequisites/requirements.txt +41 -0
- f2dev/_bundle/platform/cli/prerequisites/verify-prerequisites.ps1 +150 -0
- f2dev/_bundle/platform/cli/prerequisites/verify-prerequisites.sh +418 -0
- f2dev/_bundle/platform/cli/prerequisites/versions.yaml +43 -0
- f2dev/_bundle/platform/cli/prerequisites/windows/install-windows.ps1 +1005 -0
- f2dev/_bundle/platform/cli/restore.py +179 -0
- f2dev/_bundle/platform/cli/service_gates.py +160 -0
- f2dev/_bundle/platform/cli/state.py +332 -0
- f2dev/_bundle/platform/cli/wizard.py +782 -0
- f2dev/_bundle/platform/cli.py +235 -0
- f2dev/_bundle/platform/deployers/__init__.py +4 -0
- f2dev/_bundle/platform/deployers/base_deployer.py +8 -0
- f2dev/_bundle/platform/deployers/clouds/__init__.py +0 -0
- f2dev/_bundle/platform/deployers/clouds/aws_cloud.py +619 -0
- f2dev/_bundle/platform/deployers/clouds/azure_cloud.py +0 -0
- f2dev/_bundle/platform/deployers/clouds/google_cloud.py +785 -0
- f2dev/_bundle/platform/deployers/clouds/terragrunt_progress.py +56 -0
- f2dev/_bundle/platform/deployers/services/data_services/1.0_cicd_workload_runner.py +644 -0
- f2dev/_bundle/platform/deployers/services/data_services/12.0_control_plane.py +321 -0
- f2dev/_bundle/platform/deployers/services/data_services/13.0_data_mcp_hub.py +362 -0
- f2dev/_bundle/platform/deployers/services/data_services/2.0_object_storage_operator.py +416 -0
- f2dev/_bundle/platform/deployers/services/data_services/2.5_services_logs.py +482 -0
- f2dev/_bundle/platform/deployers/services/data_services/3.0_data_cicd_workflows.py +361 -0
- f2dev/_bundle/platform/deployers/services/data_services/4.0_data_replication.py +534 -0
- f2dev/_bundle/platform/deployers/services/data_services/4.5_data_streaming.py +303 -0
- f2dev/_bundle/platform/deployers/services/data_services/5.0_data_orchestration.py +760 -0
- f2dev/_bundle/platform/deployers/services/data_services/6.0_data_modeling.py +753 -0
- f2dev/_bundle/platform/deployers/services/data_services/7.0_data_governance.py +795 -0
- f2dev/_bundle/platform/deployers/services/data_services/8.0_data_analysis.py +587 -0
- f2dev/_bundle/platform/deployers/services/infra_services/1.0_secret_operator.py +467 -0
- f2dev/_bundle/platform/deployers/services/infra_services/10.0_cluster_pvc_autoscaller.py +500 -0
- f2dev/_bundle/platform/deployers/services/infra_services/2.0_cert_manager.py +963 -0
- f2dev/_bundle/platform/deployers/services/infra_services/3.0_external_dns.py +823 -0
- f2dev/_bundle/platform/deployers/services/infra_services/4.0_traefik_lb.py +604 -0
- f2dev/_bundle/platform/deployers/services/infra_services/5.0_stackgres_postgresql.py +652 -0
- f2dev/_bundle/platform/deployers/services/infra_services/6.0_services_metrics.py +515 -0
- f2dev/_bundle/platform/deployers/services/infra_services/7.0_services_monitoring.py +787 -0
- f2dev/_bundle/platform/deployers/services/infra_services/8.0_cluster_cleaner.py +439 -0
- f2dev/_bundle/platform/deployers/services/infra_services/9.0_idp_sso_manager.py +790 -0
- f2dev/_bundle/platform/readme.md +47 -0
- f2dev/_bundle/platform/requirements.txt +14 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/backend.tf_template +10 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/defaults.yaml_template +11 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/env.yaml_template +2 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/root.hcl_advanced_template +134 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/root.hcl_basic_template +134 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/terragrunt.hcl_advanced_template +134 -0
- f2dev/_bundle/platform/terraform/aws_cloud/templates/terragrunt.hcl_basic_template +134 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/01-apps-vpc/terragrunt.hcl +26 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/02-create-dns-ns-record/terragrunt.hcl +16 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/03-eks-cluster/terragrunt.hcl +21 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/04-external_dns_sa/terragrunt.hcl +28 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/01-apps-vpc/terragrunt.hcl +25 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/02-eks-cluster/terragrunt.hcl +32 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/03-external-dns-irsa/terragrunt.hcl +34 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/04-cert-manager-irsa/terragrunt.hcl +34 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/05-create-dns-zone/terragrunt.hcl +22 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/06-create-dns-ns-record/terragrunt.hcl +44 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/bi-platform/empty.yaml +1 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/empty.yaml +1 -0
- f2dev/_bundle/platform/terraform/aws_cloud/terragrunt/env.hcl +2 -0
- f2dev/_bundle/platform/terraform/azure_cloud/README.md +3 -0
- f2dev/_bundle/platform/terraform/azure_cloud/templates/_keep_structure.txt +0 -0
- f2dev/_bundle/platform/terraform/google_cloud/README.md +20 -0
- f2dev/_bundle/platform/terraform/google_cloud/templates/backend.tf_template +7 -0
- f2dev/_bundle/platform/terraform/google_cloud/templates/defaults.yaml_template +12 -0
- f2dev/_bundle/platform/terraform/google_cloud/templates/env.yaml_template +2 -0
- f2dev/_bundle/platform/terraform/google_cloud/templates/root.hcl_advanced_template +114 -0
- f2dev/_bundle/platform/terraform/google_cloud/templates/root.hcl_basic_template +116 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/.gitignore +3 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/00-create-ou-folder/terragrunt.hcl +15 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/01-create-project/terragrunt.hcl +30 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/02-enable-apis/terragrunt.hcl +25 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/03-0-apps-vpc/terragrunt.hcl +134 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/04-external-ip-traefik/terragrunt.hcl +29 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/05-create-dns-zone/terragrunt.hcl +25 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/06-create-dns-ns-record/terragrunt.hcl +43 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/07-gke-cluster/terragrunt.hcl +103 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/08-dbt_deploy_sa/terragrunt.hcl +36 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/09-dbt_sa/terragrunt.hcl +40 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/10-cert_manager_sa/terragrunt.hcl +34 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/11-external_dns_sa/terragrunt.hcl +30 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/12-monitoring_sa/terragrunt.hcl +52 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/13-data_replication_sa/terragrunt.hcl +35 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/14-data_orchestration_sa/terragrunt.hcl +35 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/15-bi_data_sa/terragrunt.hcl +43 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/16-whitelist-external-ip-on-common/terragrunt.hcl +30 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/17-kubeconfig/terragrunt.hcl +23 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/bi-platform/18-data_streaming_sa/terragrunt.hcl +24 -0
- f2dev/_bundle/platform/terraform/google_cloud/terragrunt/empty.yaml +1 -0
- f2dev/_bundle/platform/utils/__init__.py +0 -0
- f2dev/_bundle/platform/utils/customer_data_platform_repository_operator.py +1098 -0
- f2dev/_bundle/platform/utils/customer_secret_manager_operations.py +1635 -0
- f2dev/_bundle/platform/utils/environment_profiles.py +58 -0
- f2dev/_bundle/platform/utils/helm_utils.py +215 -0
- f2dev/_bundle/platform/utils/infrastructure_deployment_operator.py +1532 -0
- f2dev/_bundle/platform/utils/keycloak_realm_reconcile.py +320 -0
- f2dev/_bundle/platform/utils/kubeconfig_fixer.py +265 -0
- f2dev/_bundle/platform/utils/raw_extras.py +34 -0
- f2dev/_bundle/platform/utils/readiness.py +330 -0
- f2dev/_bundle/platform/utils/secret_structure_upgrade.py +194 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/.gitignore +7 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/README.md +33 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/analyses/.gitkeep +0 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/dbt_project.yml +52 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/macros/.gitkeep +0 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/macros/fast2dev_bq_time_zones.sql +12 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/macros/fast2dev_monitoring_grain.sql +23 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_daily_spend.sql +19 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_daily_spend.yml +25 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_model_costs_daily.sql +16 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_model_costs_daily.yml +24 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_storage_by_dataset.sql +12 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_storage_by_dataset.yml +21 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_user_costs_daily.sql +14 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_user_costs_daily.yml +22 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_weekly_kpi.sql +52 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_weekly_kpi.yml +42 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_weekly_spend.sql +74 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/marts/fast2dev_bq_weekly_spend.yml +49 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/sources/billing_export.yml +9 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/staging/fast2dev_bq_billing_export.sql +9 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/models/staging/fast2dev_bq_billing_export.yml +4 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/packages.yml +5 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/profiles.yml +15 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/scripts/run_monitoring.py +201 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/seeds/.gitkeep +0 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/snapshots/.gitkeep +0 -0
- f2dev/_bundle/platform/utils/templates/control_plane_warehouse_stats_template/bigquery_usage/tests/.gitkeep +0 -0
- f2dev/_bundle/platform/utils/templates/dry_run/gcp_sa.json +12 -0
- f2dev/_bundle/platform/utils/templates/dry_run/kubeconfig.yaml +18 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/data_orchestrator/repository_structure/README.MD +50 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/data_orchestrator/repository_structure/dags/dbt/README.MD +47 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/data_orchestrator/repository_structure/dags/fast2dev_healthcheck.py_template_airflow_3.x +158 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/bitbucket/bitbucket-pipelines.yml_template +144 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitea/.gitea/PR_VALIDATION.md +52 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitea/.gitea/pull_request_template.md +48 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitea/.gitea/workflows/argo-workflows.yml_template +143 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitea/.gitea/workflows/pr-agent.yml +30 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitea/.gitea/workflows/validate-pr-description.yml +38 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/github/.github/PR_VALIDATION.md +52 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/github/.github/pull_request_template.md +48 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/github/.github/workflows/argo-workflows.yml_template +143 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/github/.github/workflows/pr-agent.yml +37 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/github/.github/workflows/validate-pr-description.yml +157 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitlab/.gitlab/PR_VALIDATION.md +43 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitlab/.gitlab/merge_request_templates/Default.md +48 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/gitlab/.gitlab-ci.yml_template +181 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/repository_structure/.gitignore +21 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/repository_structure/.pr_agent.toml +82 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/repository_structure/AGENTS.md +126 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/dbt_data_model/repository_structure/README.MD +101 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/infrastructure_deployment_files/DR.md +341 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/infrastructure_deployment_files/README.md.j2 +81 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/infrastructure_deployment_files/decrypt_files.py +331 -0
- f2dev/_bundle/platform/utils/templates/git_repo_templates/infrastructure_deployment_files/encrypt_files.py +321 -0
- f2dev/_bundle/platform/utils/templates/secret_structure_template/customer_vault_structure.json +502 -0
- f2dev/_bundle/platform/utils/vault_structure_sync.py +96 -0
- f2dev/_bundle/terraform-modules/README.md +12 -0
- f2dev/_bundle/terraform-modules/aws_cloud/README.md +7 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/addons-roles.tf +298 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/main.tf +313 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/outputs.tf +3 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/policies/lb-controller-policy.json +219 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/provider.tf +36 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/variables.tf +107 -0
- f2dev/_bundle/terraform-modules/aws_cloud/eks/versions.tf +10 -0
- f2dev/_bundle/terraform-modules/aws_cloud/gcp_aws_zone/main.tf +25 -0
- f2dev/_bundle/terraform-modules/aws_cloud/gcp_aws_zone/provider.tf +17 -0
- f2dev/_bundle/terraform-modules/aws_cloud/gcp_aws_zone/variables.tf +41 -0
- f2dev/_bundle/terraform-modules/aws_cloud/vpc/main.tf +34 -0
- f2dev/_bundle/terraform-modules/aws_cloud/vpc/outputs.tf +44 -0
- f2dev/_bundle/terraform-modules/aws_cloud/vpc/provider.tf +12 -0
- f2dev/_bundle/terraform-modules/aws_cloud/vpc/variables.tf +118 -0
- f2dev/_bundle/terraform-modules/aws_cloud/vpc/versions.tf +10 -0
- f2dev/_bundle/terraform-modules/azure_cloud/README.md +3 -0
- f2dev/_bundle/terraform-modules/google_cloud/README.md +17 -0
- f2dev/_bundle/terraform-modules/google_cloud/artifact-registry/main.tf +8 -0
- f2dev/_bundle/terraform-modules/google_cloud/artifact-registry/providers.tf +6 -0
- f2dev/_bundle/terraform-modules/google_cloud/artifact-registry/variables.tf +17 -0
- f2dev/_bundle/terraform-modules/google_cloud/artifact-registry/versions.tf +8 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns/main.tf +24 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns/outputs.tf +25 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns/providers.tf +7 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns/variables.tf +17 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns/versions.tf +9 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns-recordset/main.tf +38 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns-recordset/variables.tf +73 -0
- f2dev/_bundle/terraform-modules/google_cloud/cloud-dns-recordset/versions.tf +39 -0
- f2dev/_bundle/terraform-modules/google_cloud/composer/main.tf +213 -0
- f2dev/_bundle/terraform-modules/google_cloud/composer/outputs.tf +31 -0
- f2dev/_bundle/terraform-modules/google_cloud/composer/provider.tf +4 -0
- f2dev/_bundle/terraform-modules/google_cloud/composer/variables.tf +192 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-ou-folder/main.tf +29 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-ou-folder/output.tf +4 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-ou-folder/providers.tf +6 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-ou-folder/variables.tf +40 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-ou-folder/versions.tf +8 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-project/main.tf +18 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-project/output.tf +8 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-project/providers.tf +6 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-project/variables.tf +27 -0
- f2dev/_bundle/terraform-modules/google_cloud/create-project/versions.tf +9 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/README.md +188 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/main.tf +135 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/output.tf +16 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/providers.tf +6 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/variables.tf +54 -0
- f2dev/_bundle/terraform-modules/google_cloud/deploy_sa/versions.tf +17 -0
- f2dev/_bundle/terraform-modules/google_cloud/enable_apis/main.tf +14 -0
- f2dev/_bundle/terraform-modules/google_cloud/enable_apis/provider.tf +7 -0
- f2dev/_bundle/terraform-modules/google_cloud/enable_apis/variables.tf +13 -0
- f2dev/_bundle/terraform-modules/google_cloud/enable_apis/versions.tf +10 -0
- f2dev/_bundle/terraform-modules/google_cloud/external-ip/README.md +89 -0
- f2dev/_bundle/terraform-modules/google_cloud/external-ip/main.tf +17 -0
- f2dev/_bundle/terraform-modules/google_cloud/external-ip/outputs.tf +19 -0
- f2dev/_bundle/terraform-modules/google_cloud/external-ip/variables.tf +43 -0
- f2dev/_bundle/terraform-modules/google_cloud/fw-add/main.tf +24 -0
- f2dev/_bundle/terraform-modules/google_cloud/fw-add/providers.tf +6 -0
- f2dev/_bundle/terraform-modules/google_cloud/fw-add/variables.tf +37 -0
- f2dev/_bundle/terraform-modules/google_cloud/fw-add/versions.tf +9 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/README.md +10 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/main.tf +459 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/outputs.tf +44 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/provider.tf +19 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/variables.tf +354 -0
- f2dev/_bundle/terraform-modules/google_cloud/gke-cluster/versions.tf +22 -0
- f2dev/_bundle/terraform-modules/google_cloud/kubeconfig/README.md +40 -0
- f2dev/_bundle/terraform-modules/google_cloud/kubeconfig/main.tf +54 -0
- f2dev/_bundle/terraform-modules/google_cloud/kubeconfig/outputs.tf +10 -0
- f2dev/_bundle/terraform-modules/google_cloud/kubeconfig/variables.tf +24 -0
- f2dev/_bundle/terraform-modules/google_cloud/kubeconfig/versions.tf +10 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/README.md +47 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/main.tf +51 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/net-address/README.md +103 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/net-address/main.tf +71 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/net-address/outputs.tf +71 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/net-address/variables.tf +82 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/net-address/versions.tf +27 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/outputs.tf +35 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/provider.tf +4 -0
- f2dev/_bundle/terraform-modules/google_cloud/shared-vpc/variables.tf +237 -0
- f2dev/_bundle/terraform-modules/oracle_cloud/README.md +3 -0
- f2dev/launcher.py +153 -0
- fast2dev-1.0.0.dist-info/METADATA +201 -0
- fast2dev-1.0.0.dist-info/RECORD +543 -0
- fast2dev-1.0.0.dist-info/WHEEL +4 -0
- fast2dev-1.0.0.dist-info/entry_points.txt +2 -0
- fast2dev-1.0.0.dist-info/licenses/LICENSE +202 -0
- fast2dev-1.0.0.dist-info/licenses/NOTICE +6 -0
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import string
|
|
4
|
+
import subprocess
|
|
5
|
+
import json
|
|
6
|
+
import base64
|
|
7
|
+
import secrets
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from secrets import choice as secrets_choice
|
|
10
|
+
from cryptography.fernet import Fernet
|
|
11
|
+
import logging
|
|
12
|
+
import argparse
|
|
13
|
+
import re
|
|
14
|
+
|
|
15
|
+
_HERE = Path(__file__).resolve()
|
|
16
|
+
sys.path.insert(0, str(_HERE.parents[1]))
|
|
17
|
+
from cli.state import (
|
|
18
|
+
init_secrets_dir,
|
|
19
|
+
record as record_secret,
|
|
20
|
+
vault_structure_path as _vault_structure_path,
|
|
21
|
+
scratch_path as _scratch_path,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Configure logging
|
|
25
|
+
logging.basicConfig(
|
|
26
|
+
level=logging.INFO,
|
|
27
|
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
28
|
+
handlers=[
|
|
29
|
+
logging.StreamHandler(sys.stdout)
|
|
30
|
+
]
|
|
31
|
+
)
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
class CustomerSecretManagerError(Exception):
|
|
35
|
+
"""Base exception class for CustomerSecretManager errors"""
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
class ValidationError(CustomerSecretManagerError):
|
|
39
|
+
"""Raised when input validation fails"""
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
class SingletonBase:
|
|
43
|
+
_instances = {}
|
|
44
|
+
def __new__(cls, *args, **kwargs):
|
|
45
|
+
if cls not in cls._instances:
|
|
46
|
+
instance = super().__new__(cls)
|
|
47
|
+
cls._instances[cls] = instance
|
|
48
|
+
return cls._instances[cls]
|
|
49
|
+
|
|
50
|
+
class CustomerSecretManager(SingletonBase):
|
|
51
|
+
def __init__(self, *args, **kwargs):
|
|
52
|
+
if not hasattr(self, '_initialized'):
|
|
53
|
+
self._initialized = True
|
|
54
|
+
self.logger = logging.getLogger(__name__)
|
|
55
|
+
try:
|
|
56
|
+
self._initialize_parameters(**kwargs)
|
|
57
|
+
self._initialize_optional_parameters(kwargs)
|
|
58
|
+
self._initialize_caches()
|
|
59
|
+
self._setup_repositories()
|
|
60
|
+
self._setup_cloud_provider()
|
|
61
|
+
self._setup_data_warehouse()
|
|
62
|
+
self.logger.info("CustomerSecretManager initialized successfully")
|
|
63
|
+
except Exception as e:
|
|
64
|
+
self.logger.error(f"Failed to initialize CustomerSecretManager: {str(e)}", exc_info=True)
|
|
65
|
+
raise
|
|
66
|
+
|
|
67
|
+
def _initialize_parameters(self, **kwargs):
|
|
68
|
+
"""Initialize all class parameters with proper error handling"""
|
|
69
|
+
try:
|
|
70
|
+
self.user_email = kwargs.get('user_email')
|
|
71
|
+
self.customer = kwargs.get('customer')
|
|
72
|
+
self.domain_name = kwargs.get('domain_name')
|
|
73
|
+
self.data_analysis_platform = kwargs.get('data_analysis_platform')
|
|
74
|
+
self.data_warehouse_platform = kwargs.get('data_warehouse_platform')
|
|
75
|
+
self.git_provider = kwargs.get('git_provider')
|
|
76
|
+
self.dag_repo_url = kwargs.get('dag_repo_url')
|
|
77
|
+
self.data_repo_url = kwargs.get('data_repo_url')
|
|
78
|
+
self.data_repo_main_branch = kwargs.get('data_repo_main_branch', 'master')
|
|
79
|
+
self.repo_method = kwargs.get('repo_access_method', 'access_token')
|
|
80
|
+
self.git_provider_access_token = kwargs.get('git_provider_access_token')
|
|
81
|
+
self.project_id = kwargs.get('project_id')
|
|
82
|
+
self.region = kwargs.get('project_region')
|
|
83
|
+
self.aws_region = kwargs.get('aws_region')
|
|
84
|
+
self.aws_access_key_id = kwargs.get('aws_access_key_id')
|
|
85
|
+
self.aws_secret_access_key = kwargs.get('aws_secret_access_key')
|
|
86
|
+
self.cloud_provider = kwargs.get('cloud_provider')
|
|
87
|
+
self.orchestrator_platform = kwargs.get('orchestrator_platform', 'Airflow')
|
|
88
|
+
self.default_git_user_email = f"{self.customer}@{self.domain_name}"
|
|
89
|
+
self.bigquery_project_id = kwargs.get('bigquery_project_id')
|
|
90
|
+
self.bigquery_region = kwargs.get('bigquery_region')
|
|
91
|
+
self.dry_run = kwargs.get('dry_run', False)
|
|
92
|
+
|
|
93
|
+
# Process service account JSONs if provided and data warehouse is BigQuery
|
|
94
|
+
if self.data_warehouse_platform == 'bigquery':
|
|
95
|
+
if kwargs.get('data_platform_sa_json'):
|
|
96
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_platform_sa_json'])
|
|
97
|
+
if sa_json:
|
|
98
|
+
self.data_platform_gcp_sa_email = sa_json.get('client_email')
|
|
99
|
+
self.data_platform_gcp_sa_secret = kwargs['data_platform_sa_json']
|
|
100
|
+
else:
|
|
101
|
+
logger.warning("Failed to decode/parse data platform service account JSON")
|
|
102
|
+
|
|
103
|
+
if kwargs.get('data_analysis_sa_json'):
|
|
104
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_analysis_sa_json'])
|
|
105
|
+
if sa_json:
|
|
106
|
+
self.data_analysis_gcp_sa_email = sa_json.get('client_email')
|
|
107
|
+
self.data_analysis_gcp_sa_secret = kwargs['data_analysis_sa_json']
|
|
108
|
+
else:
|
|
109
|
+
logger.warning("Failed to decode/parse data analysis service account JSON")
|
|
110
|
+
|
|
111
|
+
if kwargs.get('data_streaming_sa_json'):
|
|
112
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_streaming_sa_json'])
|
|
113
|
+
if sa_json:
|
|
114
|
+
self.data_streaming_gcp_sa_email = sa_json.get('client_email')
|
|
115
|
+
self.data_streaming_gcp_sa_secret = kwargs['data_streaming_sa_json']
|
|
116
|
+
else:
|
|
117
|
+
logger.warning("Failed to decode/parse data streaming service account JSON")
|
|
118
|
+
|
|
119
|
+
# Initialize all optional parameters
|
|
120
|
+
self._initialize_optional_parameters(kwargs)
|
|
121
|
+
|
|
122
|
+
except Exception as e:
|
|
123
|
+
logger.error(f"Failed to initialize parameters: {str(e)}", exc_info=True)
|
|
124
|
+
raise CustomerSecretManagerError(f"Parameter initialization failed: {str(e)}")
|
|
125
|
+
|
|
126
|
+
def _decode_and_parse_sa_json(self, sa_json_str):
|
|
127
|
+
"""Decode and parse service account JSON from base64 string."""
|
|
128
|
+
try:
|
|
129
|
+
if self._is_base64(sa_json_str):
|
|
130
|
+
decoded_json = base64.b64decode(sa_json_str).decode('utf-8')
|
|
131
|
+
return json.loads(decoded_json)
|
|
132
|
+
else:
|
|
133
|
+
return json.loads(sa_json_str)
|
|
134
|
+
except Exception as e:
|
|
135
|
+
logger.error(f"Failed to decode/parse service account JSON: {str(e)}", exc_info=True)
|
|
136
|
+
return None
|
|
137
|
+
|
|
138
|
+
def _initialize_optional_parameters(self, kwargs):
|
|
139
|
+
"""Initialize all optional parameters"""
|
|
140
|
+
optional_params = {
|
|
141
|
+
'private_key_orchestrator': None,
|
|
142
|
+
'public_key_orchestrator': None,
|
|
143
|
+
'private_key_data_model': None,
|
|
144
|
+
'public_key_data_model': None,
|
|
145
|
+
'smtp_host': None,
|
|
146
|
+
'smtp_port': None,
|
|
147
|
+
'smtp_username': None,
|
|
148
|
+
'smtp_password': None,
|
|
149
|
+
'platform_admin_username': None,
|
|
150
|
+
'platform_admin_email': None,
|
|
151
|
+
'platform_admin_password': None,
|
|
152
|
+
'data_platform_sa_json': None,
|
|
153
|
+
'data_analysis_sa_json': None,
|
|
154
|
+
'bigquery_project_id': None,
|
|
155
|
+
'bigquery_region': None,
|
|
156
|
+
'aws_access_key_id': None,
|
|
157
|
+
'aws_secret_access_key': None,
|
|
158
|
+
'aws_region': None,
|
|
159
|
+
'azure_client_id': None,
|
|
160
|
+
'azure_client_secret': None,
|
|
161
|
+
'runner_registration_token': None,
|
|
162
|
+
'redshift_host': None,
|
|
163
|
+
'redshift_database': None,
|
|
164
|
+
'redshift_port': None,
|
|
165
|
+
'redshift_user': None,
|
|
166
|
+
'redshift_password': None,
|
|
167
|
+
'snowflake_account': None,
|
|
168
|
+
'snowflake_user': None,
|
|
169
|
+
'snowflake_password': None,
|
|
170
|
+
'snowflake_warehouse': None,
|
|
171
|
+
'snowflake_database': None,
|
|
172
|
+
'snowflake_private_key': None,
|
|
173
|
+
'snowflake_public_key': None,
|
|
174
|
+
'snowflake_passphrase': None,
|
|
175
|
+
'fabric_server': None,
|
|
176
|
+
'fabric_database': None,
|
|
177
|
+
'fabric_port': None,
|
|
178
|
+
'fabric_user': None,
|
|
179
|
+
'fabric_password': None,
|
|
180
|
+
'fabric_authentication': None,
|
|
181
|
+
'data_analysis_gcp_sa_email': None,
|
|
182
|
+
'data_analysis_gcp_sa_secret': None,
|
|
183
|
+
'data_platform_gcp_sa_email': None,
|
|
184
|
+
'data_platform_gcp_sa_secret': None,
|
|
185
|
+
'data_streaming_gcp_sa_email': None,
|
|
186
|
+
'data_streaming_gcp_sa_secret': None
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
for param, default in optional_params.items():
|
|
190
|
+
setattr(self, param, kwargs.get(param, default))
|
|
191
|
+
|
|
192
|
+
# Process service account JSONs if provided and data warehouse is BigQuery
|
|
193
|
+
if self.data_warehouse_platform == 'bigquery' and kwargs.get('data_platform_sa_json'):
|
|
194
|
+
try:
|
|
195
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_platform_sa_json'])
|
|
196
|
+
if sa_json and sa_json.get('client_email'):
|
|
197
|
+
self.data_platform_gcp_sa_email = sa_json['client_email']
|
|
198
|
+
self.data_platform_gcp_sa_secret = kwargs['data_platform_sa_json']
|
|
199
|
+
except Exception as e:
|
|
200
|
+
logger.warning(f"Failed to process data platform service account JSON: {str(e)}")
|
|
201
|
+
|
|
202
|
+
if self.data_warehouse_platform == 'bigquery' and kwargs.get('data_streaming_sa_json'):
|
|
203
|
+
try:
|
|
204
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_streaming_sa_json'])
|
|
205
|
+
if sa_json and sa_json.get('client_email'):
|
|
206
|
+
self.data_streaming_gcp_sa_email = sa_json['client_email']
|
|
207
|
+
self.data_streaming_gcp_sa_secret = kwargs['data_streaming_sa_json']
|
|
208
|
+
except Exception as e:
|
|
209
|
+
logger.warning(f"Failed to process data streaming service account JSON: {str(e)}")
|
|
210
|
+
|
|
211
|
+
if self.data_warehouse_platform == 'bigquery' and kwargs.get('data_analysis_sa_json'):
|
|
212
|
+
try:
|
|
213
|
+
sa_json = self._decode_and_parse_sa_json(kwargs['data_analysis_sa_json'])
|
|
214
|
+
if sa_json and sa_json.get('client_email'):
|
|
215
|
+
self.data_analysis_gcp_sa_email = sa_json['client_email']
|
|
216
|
+
self.data_analysis_gcp_sa_secret = kwargs['data_analysis_sa_json']
|
|
217
|
+
except Exception as e:
|
|
218
|
+
logger.warning(f"Failed to process data analysis service account JSON: {str(e)}")
|
|
219
|
+
|
|
220
|
+
def _initialize_caches(self):
|
|
221
|
+
"""Initialize caches"""
|
|
222
|
+
self.secrets_cache = {}
|
|
223
|
+
|
|
224
|
+
def _setup_repositories(self):
|
|
225
|
+
"""Setup repository URLs and access methods"""
|
|
226
|
+
try:
|
|
227
|
+
self.dag_repo_push_url = self.create_repo_push_url(self.dag_repo_url, self.git_provider_access_token, self.customer)
|
|
228
|
+
self.data_repo_push_url = self.create_repo_push_url(self.data_repo_url, self.git_provider_access_token, self.customer)
|
|
229
|
+
except Exception as e:
|
|
230
|
+
logger.error(f"Failed to setup repositories: {str(e)}", exc_info=True)
|
|
231
|
+
raise CustomerSecretManagerError(f"Repository setup failed: {str(e)}")
|
|
232
|
+
|
|
233
|
+
def _setup_cloud_provider(self):
|
|
234
|
+
"""Setup cloud provider specific configurations"""
|
|
235
|
+
if self.cloud_provider == 'gcp':
|
|
236
|
+
if not (self.project_id and self.region):
|
|
237
|
+
logger.warning("GCP cloud provider selected but project_id or region not provided")
|
|
238
|
+
elif self.cloud_provider == 'aws':
|
|
239
|
+
if not (self.aws_access_key_id and self.aws_secret_access_key and self.aws_region):
|
|
240
|
+
logger.warning("AWS cloud provider selected but credentials not provided")
|
|
241
|
+
elif self.cloud_provider == 'azure':
|
|
242
|
+
if not (self.azure_client_id and self.azure_client_secret):
|
|
243
|
+
logger.warning("Azure cloud provider selected but credentials not provided")
|
|
244
|
+
|
|
245
|
+
def _setup_data_warehouse(self):
|
|
246
|
+
"""Setup data warehouse specific configurations"""
|
|
247
|
+
if self.data_warehouse_platform == 'bigquery':
|
|
248
|
+
if not (self.bigquery_project_id and self.bigquery_region):
|
|
249
|
+
logger.warning("BigQuery selected but project_id or region not provided")
|
|
250
|
+
elif self.data_warehouse_platform == 'redshift':
|
|
251
|
+
if not all([self.redshift_host, self.redshift_database, self.redshift_port,
|
|
252
|
+
self.redshift_user, self.redshift_password]):
|
|
253
|
+
logger.warning("Redshift selected but some required parameters are missing")
|
|
254
|
+
elif self.data_warehouse_platform == 'snowflake':
|
|
255
|
+
if not all([self.snowflake_account, self.snowflake_user, self.snowflake_warehouse,
|
|
256
|
+
self.snowflake_database]):
|
|
257
|
+
logger.warning("Snowflake selected but some required parameters are missing")
|
|
258
|
+
elif self.data_warehouse_platform == 'fabric':
|
|
259
|
+
if not all([self.fabric_server, self.fabric_database, self.fabric_port,
|
|
260
|
+
self.fabric_user, self.fabric_password, self.fabric_authentication]):
|
|
261
|
+
logger.warning("MS Fabric selected but some required parameters are missing")
|
|
262
|
+
|
|
263
|
+
def create_repo_push_url(self, repo_url, git_provider_access_token, customer):
|
|
264
|
+
# Check the repository method and construct the URL accordingly
|
|
265
|
+
if self.repo_method == 'access_token':
|
|
266
|
+
# Convert SSH URL to HTTPS if needed
|
|
267
|
+
if repo_url.startswith('git@'):
|
|
268
|
+
# Convert git@github.com:owner/repo.git to https://github.com/owner/repo.git
|
|
269
|
+
at_split = repo_url.split('@', 1)
|
|
270
|
+
host_and_path = at_split[1]
|
|
271
|
+
host, sep, path = host_and_path.partition(':')
|
|
272
|
+
repo_url = f"https://{host}/{path}"
|
|
273
|
+
|
|
274
|
+
# Ensure the repo_url has https:// protocol
|
|
275
|
+
if not repo_url.startswith("https://"):
|
|
276
|
+
repo_url = f"https://{repo_url}"
|
|
277
|
+
|
|
278
|
+
# For GitHub, use the token directly as username, for others use oauth2
|
|
279
|
+
if 'github.com' in repo_url:
|
|
280
|
+
return repo_url.replace('https://', f'https://{git_provider_access_token}@')
|
|
281
|
+
else:
|
|
282
|
+
return repo_url.replace('https://', f'https://oauth2:{git_provider_access_token}@')
|
|
283
|
+
|
|
284
|
+
elif self.repo_method == 'deploy_keys':
|
|
285
|
+
# Convert HTTPS URL to SSH URL if needed
|
|
286
|
+
if repo_url.startswith('https://'):
|
|
287
|
+
# Properly convert https://github.com/owner/repo.git to git@github.com:owner/repo.git
|
|
288
|
+
url_without_protocol = repo_url.replace('https://', '')
|
|
289
|
+
if '/' in url_without_protocol:
|
|
290
|
+
domain, path = url_without_protocol.split('/', 1)
|
|
291
|
+
return f"git@{domain}:{path}"
|
|
292
|
+
|
|
293
|
+
# If already in SSH format, fix any malformed URLs
|
|
294
|
+
if repo_url.startswith('git@'):
|
|
295
|
+
# Fix incorrect SSH URLs that use / instead of : after the domain
|
|
296
|
+
# Pattern: git@domain/path -> git@domain:path
|
|
297
|
+
if 'git@' in repo_url and '/' in repo_url:
|
|
298
|
+
# Split at the first / after git@
|
|
299
|
+
git_part, rest = repo_url.split('/', 1)
|
|
300
|
+
if ':' not in git_part: # Only fix if : is not already present
|
|
301
|
+
return f"{git_part}:{rest}"
|
|
302
|
+
return repo_url
|
|
303
|
+
|
|
304
|
+
# Fallback: assume it's a domain and add git@ prefix
|
|
305
|
+
return f"git@{repo_url}"
|
|
306
|
+
else:
|
|
307
|
+
raise ValueError("Invalid repository method. Supported values are 'access_token' and 'deploy_keys'.")
|
|
308
|
+
|
|
309
|
+
def retriew_secret_from_terragrunt_output(self, cloud_provider, model_catalog):
|
|
310
|
+
project_root = os.getcwd() # assuming this method is run at project root
|
|
311
|
+
sa_key_file = os.path.join(project_root, 'terraform', cloud_provider, 'terragrunt', 'bi-platform', model_catalog, 'sa_key.txt')
|
|
312
|
+
sa_name_file = os.path.join(project_root, 'terraform', cloud_provider, 'terragrunt', 'bi-platform', model_catalog, 'sa_name.txt')
|
|
313
|
+
|
|
314
|
+
with open(sa_key_file, 'r') as file:
|
|
315
|
+
sa_key_content = file.read()
|
|
316
|
+
sa_key_based64 = sa_key_content
|
|
317
|
+
sa_key_decoded = base64.b64decode(sa_key_content)
|
|
318
|
+
sa_key_json = json.loads(sa_key_decoded)
|
|
319
|
+
|
|
320
|
+
with open(sa_name_file, 'r') as file:
|
|
321
|
+
sa_name_content = file.read()
|
|
322
|
+
prefix = '/serviceAccounts/'
|
|
323
|
+
start_index = sa_name_content.find(prefix) + len(prefix)
|
|
324
|
+
if start_index > len(prefix) - 1: # Ensure prefix was found
|
|
325
|
+
sa_name = sa_name_content[start_index:]
|
|
326
|
+
else:
|
|
327
|
+
raise ValueError("Service account name format is incorrect.")
|
|
328
|
+
|
|
329
|
+
return sa_key_based64, sa_key_json, sa_name
|
|
330
|
+
|
|
331
|
+
def resolve_secret_reference(self, ref_path):
|
|
332
|
+
"""Resolve a secret reference to its actual value."""
|
|
333
|
+
# First attempt to retrieve the secret from cache
|
|
334
|
+
if ref_path in self.secrets_cache:
|
|
335
|
+
return self.secrets_cache[ref_path]
|
|
336
|
+
|
|
337
|
+
# Special case during initial file creation
|
|
338
|
+
if not hasattr(self, '_processing_references'):
|
|
339
|
+
# Return the reference as is for now, we'll resolve it in post-processing
|
|
340
|
+
return f"ref:{ref_path}"
|
|
341
|
+
|
|
342
|
+
# Fetch the secret from storage if not in cache
|
|
343
|
+
secret_value = self.fetch_secret_by_path(ref_path)
|
|
344
|
+
if secret_value:
|
|
345
|
+
self.secrets_cache[ref_path] = secret_value
|
|
346
|
+
|
|
347
|
+
return secret_value
|
|
348
|
+
|
|
349
|
+
def parse_and_import_secrets(self, structure, sink, path=''):
|
|
350
|
+
all_created_secrets = [] # Collect all messages from secret creation attempts
|
|
351
|
+
|
|
352
|
+
if not isinstance(structure, dict):
|
|
353
|
+
raise ValueError(f"Expected a dictionary but got {type(structure).__name__}: {structure}")
|
|
354
|
+
|
|
355
|
+
for key, value in structure.items():
|
|
356
|
+
current_path = f"{path}{key}/" if path else f"{key}/"
|
|
357
|
+
if isinstance(value, dict) and all(isinstance(v, str) or v is None for v in value.values()): # This is a secrets directory
|
|
358
|
+
for secret_key, secret_value in value.items():
|
|
359
|
+
# Handle special cases or generate new secrets
|
|
360
|
+
if secret_value == "random":
|
|
361
|
+
secret_value = self.generate_secure_password()
|
|
362
|
+
elif secret_value == "fernet_random":
|
|
363
|
+
secret_value = self.generate_fernet_key()
|
|
364
|
+
elif secret_value == "private_key_orchestrator":
|
|
365
|
+
secret_value = self.private_key_orchestrator if self.private_key_orchestrator is not None else self.export_private_key(agent_name="fast2dev_orchestrator_agent")
|
|
366
|
+
elif secret_value == "public_key_orchestrator":
|
|
367
|
+
secret_value = self.public_key_orchestrator if self.public_key_orchestrator is not None else self.export_public_key(agent_name="fast2dev_orchestrator_agent")
|
|
368
|
+
elif secret_value == "private_key_data_model":
|
|
369
|
+
secret_value = self.private_key_data_model if self.private_key_data_model is not None else self.export_private_key(agent_name="fast2dev_data_model_agent")
|
|
370
|
+
elif secret_value == "public_key_data_model":
|
|
371
|
+
secret_value = self.public_key_data_model if self.public_key_data_model is not None else self.export_public_key(agent_name="fast2dev_data_model_agent")
|
|
372
|
+
elif secret_value == "data_repo_url":
|
|
373
|
+
secret_value = self.data_repo_url if self.data_repo_url is not None else 'EMPTY'
|
|
374
|
+
elif secret_value == "dag_repo_url":
|
|
375
|
+
secret_value = self.dag_repo_url if self.dag_repo_url is not None else 'EMPTY'
|
|
376
|
+
elif secret_value == "git_provider_access_token":
|
|
377
|
+
secret_value = self.git_provider_access_token if self.git_provider_access_token is not None else 'EMPTY'
|
|
378
|
+
elif secret_value == "git_provider_access_token_name":
|
|
379
|
+
secret_value = f"{self.customer}_fast2dev_agent_access_token"
|
|
380
|
+
elif secret_value == "data_streaming_gcp_sa_email":
|
|
381
|
+
secret_value = getattr(self, 'data_streaming_gcp_sa_email', None) or 'EMPTY'
|
|
382
|
+
elif secret_value == "data_streaming_gcp_sa_secret":
|
|
383
|
+
secret_value = getattr(self, 'data_streaming_gcp_sa_secret', None) or 'EMPTY'
|
|
384
|
+
elif secret_value == "data_analysis_gcp_sa_email":
|
|
385
|
+
secret_value = self.data_analysis_gcp_sa_email if self.data_analysis_gcp_sa_email is not None else 'EMPTY'
|
|
386
|
+
elif secret_value == "data_analysis_gcp_sa_secret":
|
|
387
|
+
secret_value = self.data_analysis_gcp_sa_secret if self.data_analysis_gcp_sa_secret is not None else 'EMPTY'
|
|
388
|
+
elif secret_value == "data_platform_gcp_sa_email":
|
|
389
|
+
secret_value = self.data_platform_gcp_sa_email if self.data_platform_gcp_sa_email is not None else 'EMPTY'
|
|
390
|
+
elif secret_value == "data_platform_gcp_sa_secret":
|
|
391
|
+
secret_value = self.data_platform_gcp_sa_secret if self.data_platform_gcp_sa_secret is not None else 'EMPTY'
|
|
392
|
+
elif secret_value == "random_10":
|
|
393
|
+
secret_value = self.generate_secure_password(length=10)
|
|
394
|
+
elif secret_value == "bigquery_project_id":
|
|
395
|
+
secret_value = self.bigquery_project_id if self.bigquery_project_id is not None else 'EMPTY'
|
|
396
|
+
elif secret_value == "bigquery_region":
|
|
397
|
+
secret_value = self.bigquery_region if self.bigquery_region is not None else 'EMPTY'
|
|
398
|
+
elif secret_value == "redshift_host":
|
|
399
|
+
secret_value = self.redshift_host if self.redshift_host is not None else 'EMPTY'
|
|
400
|
+
elif secret_value == "redshift_database":
|
|
401
|
+
secret_value = self.redshift_database if self.redshift_database is not None else 'EMPTY'
|
|
402
|
+
elif secret_value == "redshift_user":
|
|
403
|
+
secret_value = self.redshift_user if self.redshift_user is not None else 'EMPTY'
|
|
404
|
+
elif secret_value == "redshift_password":
|
|
405
|
+
secret_value = self.redshift_password if self.redshift_password is not None else 'EMPTY'
|
|
406
|
+
elif secret_value == "snowflake_account":
|
|
407
|
+
secret_value = self.snowflake_account if self.snowflake_account is not None else 'EMPTY'
|
|
408
|
+
elif secret_value == "snowflake_user":
|
|
409
|
+
secret_value = self.snowflake_user if self.snowflake_user is not None else 'EMPTY'
|
|
410
|
+
elif secret_value == "snowflake_password":
|
|
411
|
+
secret_value = self.snowflake_password if self.snowflake_password is not None else 'EMPTY'
|
|
412
|
+
elif secret_value == "snowflake_warehouse":
|
|
413
|
+
secret_value = self.snowflake_warehouse if self.snowflake_warehouse is not None else 'EMPTY'
|
|
414
|
+
elif secret_value == "snowflake_database":
|
|
415
|
+
secret_value = self.snowflake_database if self.snowflake_database is not None else 'EMPTY'
|
|
416
|
+
elif secret_value == "snowflake_private_key":
|
|
417
|
+
if not hasattr(self, 'snowflake_private_key') or self.snowflake_private_key in [None, 'EMPTY']:
|
|
418
|
+
self.logger.info("Generating Snowflake key pair")
|
|
419
|
+
private_key, public_key, passphrase = self.generate_snowflake_keys()
|
|
420
|
+
self.snowflake_private_key = private_key
|
|
421
|
+
self.snowflake_public_key = public_key
|
|
422
|
+
self.snowflake_passphrase = passphrase
|
|
423
|
+
secret_value = self.snowflake_private_key
|
|
424
|
+
elif secret_value == "snowflake_public_key":
|
|
425
|
+
if not hasattr(self, 'snowflake_public_key') or self.snowflake_public_key in [None, 'EMPTY']:
|
|
426
|
+
self.logger.info("Generating Snowflake key pair")
|
|
427
|
+
private_key, public_key, passphrase = self.generate_snowflake_keys()
|
|
428
|
+
self.snowflake_private_key = private_key
|
|
429
|
+
self.snowflake_public_key = public_key
|
|
430
|
+
self.snowflake_passphrase = passphrase
|
|
431
|
+
secret_value = self.snowflake_public_key
|
|
432
|
+
elif secret_value == "snowflake_passphrase":
|
|
433
|
+
if not hasattr(self, 'snowflake_passphrase') or self.snowflake_passphrase in [None, 'EMPTY']:
|
|
434
|
+
self.logger.info("Generating Snowflake key pair")
|
|
435
|
+
private_key, public_key, passphrase = self.generate_snowflake_keys()
|
|
436
|
+
self.snowflake_private_key = private_key
|
|
437
|
+
self.snowflake_public_key = public_key
|
|
438
|
+
self.snowflake_passphrase = passphrase
|
|
439
|
+
secret_value = self.snowflake_passphrase
|
|
440
|
+
elif secret_value == "fabric_server":
|
|
441
|
+
secret_value = self.fabric_server if self.fabric_server is not None else 'EMPTY'
|
|
442
|
+
elif secret_value == "fabric_database":
|
|
443
|
+
secret_value = self.fabric_database if self.fabric_database is not None else 'EMPTY'
|
|
444
|
+
elif secret_value == "fabric_user":
|
|
445
|
+
secret_value = self.fabric_user if self.fabric_user is not None else 'EMPTY'
|
|
446
|
+
elif secret_value == "fabric_password":
|
|
447
|
+
secret_value = self.fabric_password if self.fabric_password is not None else 'EMPTY'
|
|
448
|
+
elif secret_value == "fabric_authentication":
|
|
449
|
+
secret_value = "activeDirectory"
|
|
450
|
+
elif secret_value == "airflow_conn_aws":
|
|
451
|
+
access_key_path = "global-object-storage/root-buckets-secrets/airflow-fast2dev-bucket-admin/CONSOLE_ACCESS_KEY"
|
|
452
|
+
secret_key_path = "global-object-storage/root-buckets-secrets/airflow-fast2dev-bucket-admin/CONSOLE_SECRET_KEY"
|
|
453
|
+
airflow_access_key = self.resolve_secret_reference(access_key_path)
|
|
454
|
+
aiflow_secret_key = self.resolve_secret_reference(secret_key_path)
|
|
455
|
+
secret_value = f"aws://{airflow_access_key}:{aiflow_secret_key}@/?endpoint_url=http%3A%2F%2Fobject-storage-svc.global-object-storage.svc.cluster.local%3A9000"
|
|
456
|
+
elif secret_value == "smtp_host":
|
|
457
|
+
secret_value = self.smtp_host
|
|
458
|
+
elif secret_value == "smtp_port":
|
|
459
|
+
secret_value = f"{self.smtp_port}"
|
|
460
|
+
elif secret_value == "smtp_username":
|
|
461
|
+
secret_value = self.smtp_username
|
|
462
|
+
elif secret_value == "smtp_password":
|
|
463
|
+
secret_value = self.smtp_password
|
|
464
|
+
elif secret_value == "platform_admin_username":
|
|
465
|
+
secret_value = self.platform_admin_username
|
|
466
|
+
elif secret_value == "platform_admin_email":
|
|
467
|
+
secret_value = self.platform_admin_email if self.platform_admin_username else None
|
|
468
|
+
elif secret_value == "platform_admin_password":
|
|
469
|
+
if self.platform_admin_username:
|
|
470
|
+
secret_value = self.platform_admin_password or self.generate_secure_password()
|
|
471
|
+
else:
|
|
472
|
+
secret_value = None
|
|
473
|
+
elif secret_value == "datahub_neo4j_credentials":
|
|
474
|
+
datahub_neo4j_username_path = "data-governance/neo4j-secrets/username"
|
|
475
|
+
datahub_neo4j_password_path = "data-governance/neo4j-secrets/password"
|
|
476
|
+
datahub_neo4j_username = self.resolve_secret_reference(datahub_neo4j_username_path)
|
|
477
|
+
datahub_neo4j_password = self.resolve_secret_reference(datahub_neo4j_password_path)
|
|
478
|
+
secret_value = f"{datahub_neo4j_username}/{datahub_neo4j_password}"
|
|
479
|
+
elif secret_value == "datahub_kafka_client_password":
|
|
480
|
+
# Reuse the random adminPassword generated for the data-governance root account
|
|
481
|
+
admin_pw = self.resolve_secret_reference("data-governance/root-secrets/adminPassword")
|
|
482
|
+
secret_value = admin_pw if admin_pw else self.generate_secure_password()
|
|
483
|
+
elif secret_value == "datahub_kafka_jaas":
|
|
484
|
+
# Build the PLAIN JAAS config using the same shared password
|
|
485
|
+
admin_pw = self.resolve_secret_reference("data-governance/root-secrets/adminPassword")
|
|
486
|
+
secret_value = (
|
|
487
|
+
f'org.apache.kafka.common.security.plain.PlainLoginModule required '
|
|
488
|
+
f'username="datahub" password="{admin_pw}";'
|
|
489
|
+
)
|
|
490
|
+
elif secret_value == "customer":
|
|
491
|
+
secret_value = self.customer
|
|
492
|
+
elif secret_value == "domain":
|
|
493
|
+
secret_value = self.domain_name
|
|
494
|
+
elif secret_value == "project_id":
|
|
495
|
+
secret_value = self.project_id
|
|
496
|
+
elif secret_value == "region":
|
|
497
|
+
secret_value = self.region
|
|
498
|
+
elif secret_value == "aws_region":
|
|
499
|
+
secret_value = self.aws_region
|
|
500
|
+
elif secret_value == "aws_access_key_id":
|
|
501
|
+
secret_value = self.aws_access_key_id
|
|
502
|
+
elif secret_value == "aws_secret_access_key":
|
|
503
|
+
secret_value = self.aws_secret_access_key
|
|
504
|
+
elif secret_value == "dag_repo_push":
|
|
505
|
+
secret_value = self.dag_repo_push_url
|
|
506
|
+
elif secret_value == "data_analysis_platform":
|
|
507
|
+
secret_value = self.data_analysis_platform
|
|
508
|
+
elif secret_value == "data_warehouse_platform":
|
|
509
|
+
secret_value = self.data_warehouse_platform
|
|
510
|
+
elif secret_value == "data_repo_main_branch":
|
|
511
|
+
secret_value = self.data_repo_main_branch
|
|
512
|
+
elif secret_value == "git_provider":
|
|
513
|
+
secret_value = self.git_provider
|
|
514
|
+
elif secret_value == "data_repo_url":
|
|
515
|
+
secret_value = self.data_repo_url
|
|
516
|
+
elif secret_value == "default_git_user_email":
|
|
517
|
+
secret_value = self.default_git_user_email
|
|
518
|
+
elif secret_value == "orchestrator_platform":
|
|
519
|
+
secret_value = self.orchestrator_platform
|
|
520
|
+
elif secret_value == "access_token_name":
|
|
521
|
+
secret_value = f"{self.customer}_agent_access_token"
|
|
522
|
+
elif secret_value == "cookie_random":
|
|
523
|
+
secret_value = self.generate_hexadecimal_password()
|
|
524
|
+
elif secret_value == "runner_registration_token":
|
|
525
|
+
secret_value = self.runner_registration_token
|
|
526
|
+
|
|
527
|
+
created_secrets = sink(current_path, secret_key, secret_value)
|
|
528
|
+
all_created_secrets.extend(created_secrets)
|
|
529
|
+
else: # Recurse into subdirectories
|
|
530
|
+
subdirectory_secrets = self.parse_and_import_secrets(value, sink, current_path)
|
|
531
|
+
all_created_secrets.extend(subdirectory_secrets)
|
|
532
|
+
return all_created_secrets
|
|
533
|
+
|
|
534
|
+
def execute_command(self, command):
|
|
535
|
+
"""
|
|
536
|
+
Executes a given command through the shell, printing the output or errors directly.
|
|
537
|
+
|
|
538
|
+
Args:
|
|
539
|
+
- command (str): The command to execute.
|
|
540
|
+
"""
|
|
541
|
+
# Dry-run mode: show command without executing
|
|
542
|
+
if self.dry_run:
|
|
543
|
+
self.logger.info(f"[DRY-RUN] Would execute: {command}")
|
|
544
|
+
print(f"[DRY-RUN] Would execute: {command}")
|
|
545
|
+
return # Return without executing
|
|
546
|
+
|
|
547
|
+
try:
|
|
548
|
+
# Execute the command, capture output, and check for errors automatically
|
|
549
|
+
result = subprocess.run(command, shell=True, capture_output=True, text=True, check=True)
|
|
550
|
+
|
|
551
|
+
# If the command was successful, print the output
|
|
552
|
+
print("Command executed successfully.")
|
|
553
|
+
print("Output:", result.stdout)
|
|
554
|
+
except subprocess.CalledProcessError as e:
|
|
555
|
+
# If the command fails, print the error
|
|
556
|
+
print("Error executing command:")
|
|
557
|
+
print(e.stderr)
|
|
558
|
+
|
|
559
|
+
def generate_secure_password(self, length=32):
|
|
560
|
+
"""Generate a secure random password of a specified length, using only alphanumeric characters."""
|
|
561
|
+
alphabet = string.ascii_letters + string.digits # Use only letters and digits
|
|
562
|
+
password = ''.join(secrets_choice(alphabet) for _ in range(length))
|
|
563
|
+
return password
|
|
564
|
+
|
|
565
|
+
def generate_strong_secure_password(self, length=32):
|
|
566
|
+
"""Generate a strong Base64 Encoded secure random password of a specified length, using only alphanumeric characters."""
|
|
567
|
+
# Calculate the required length of the raw password to get the desired length after Base64 encoding
|
|
568
|
+
raw_length = (length * 3) // 4
|
|
569
|
+
password = self.generate_secure_password(raw_length)
|
|
570
|
+
# Encode the password and decode it to get a string
|
|
571
|
+
encoded_password = base64.b64encode(password.encode()).decode()
|
|
572
|
+
# Ensure the encoded password meets the length requirement, trim if necessary
|
|
573
|
+
return encoded_password[:length]
|
|
574
|
+
|
|
575
|
+
def generate_fernet_key(self):
|
|
576
|
+
"""Generate a URL-safe base64-encoded 32-byte key suitable for Fernet encryption."""
|
|
577
|
+
key = Fernet.generate_key()
|
|
578
|
+
return key.decode()
|
|
579
|
+
|
|
580
|
+
def generate_hexadecimal_password(self, length=32):
|
|
581
|
+
"""Generate a secure random hexadecimal password of a specified even length."""
|
|
582
|
+
if length % 2 != 0:
|
|
583
|
+
raise ValueError("Length must be an even number to ensure full bytes are represented.")
|
|
584
|
+
# Generate a random hexadecimal string
|
|
585
|
+
password = secrets.token_hex(length // 2) # Divide by 2 because each byte is two hex digits
|
|
586
|
+
return password
|
|
587
|
+
|
|
588
|
+
def generate_ssh_keys(self, comment, key_name):
|
|
589
|
+
"""Generate SSH keys for Git operations.
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
comment (str): Comment to add to the key
|
|
593
|
+
key_name (str): Name of the key file
|
|
594
|
+
|
|
595
|
+
Returns:
|
|
596
|
+
Tuple[str, str]: Private and public keys
|
|
597
|
+
"""
|
|
598
|
+
try:
|
|
599
|
+
logger.info(f"Generating SSH keys with comment: {comment}")
|
|
600
|
+
# Run ssh-keygen and redirect output to /dev/null
|
|
601
|
+
subprocess.run([
|
|
602
|
+
"ssh-keygen", "-t", "ed25519", "-C", comment, "-f", key_name, "-N", ""
|
|
603
|
+
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
604
|
+
|
|
605
|
+
logger.debug("SSH keys generated, reading files")
|
|
606
|
+
with open(f"{key_name}", "r") as file:
|
|
607
|
+
private_key = file.read()
|
|
608
|
+
with open(f"{key_name}.pub", "r") as file:
|
|
609
|
+
public_key = file.read()
|
|
610
|
+
|
|
611
|
+
logger.debug("Cleaning up temporary key files")
|
|
612
|
+
# Clean up files
|
|
613
|
+
os.remove(key_name)
|
|
614
|
+
os.remove(f"{key_name}.pub")
|
|
615
|
+
|
|
616
|
+
logger.info("SSH key pair generated successfully")
|
|
617
|
+
return private_key, public_key
|
|
618
|
+
except subprocess.CalledProcessError as e:
|
|
619
|
+
logger.error(f"Error generating SSH keys: {e}")
|
|
620
|
+
raise
|
|
621
|
+
except Exception as e:
|
|
622
|
+
logger.error(f"Unexpected error in generate_ssh_keys: {e}", exc_info=True)
|
|
623
|
+
raise
|
|
624
|
+
|
|
625
|
+
def generate_snowflake_keys(self):
|
|
626
|
+
"""Generate Snowflake key pair and passphrase following Snowflake's documentation."""
|
|
627
|
+
init_secrets_dir()
|
|
628
|
+
slug = f"{self.customer}_snowflake"
|
|
629
|
+
private_key_path = _scratch_path("snowflake_private_key.p8", customer=slug)
|
|
630
|
+
public_key_path = _scratch_path("snowflake_public_key.pub", customer=slug)
|
|
631
|
+
passphrase = self.generate_secure_password(32)
|
|
632
|
+
try:
|
|
633
|
+
private_key_cmd = (
|
|
634
|
+
f"openssl genrsa 2048 | "
|
|
635
|
+
f"openssl pkcs8 -topk8 -v2 des3 -inform PEM "
|
|
636
|
+
f"-out {private_key_path} -passout pass:{passphrase}"
|
|
637
|
+
)
|
|
638
|
+
self.execute_command(private_key_cmd)
|
|
639
|
+
public_key_cmd = (
|
|
640
|
+
f"openssl rsa -in {private_key_path} -pubout "
|
|
641
|
+
f"-out {public_key_path} -passin pass:{passphrase}"
|
|
642
|
+
)
|
|
643
|
+
self.execute_command(public_key_cmd)
|
|
644
|
+
with open(private_key_path, "r") as f:
|
|
645
|
+
private_key = f.read().strip()
|
|
646
|
+
with open(public_key_path, "r") as f:
|
|
647
|
+
public_key = f.read().strip()
|
|
648
|
+
self.logger.info("Snowflake key pair generated successfully")
|
|
649
|
+
return private_key, public_key, passphrase
|
|
650
|
+
except Exception as e:
|
|
651
|
+
self.logger.error(f"Failed to generate Snowflake keys: {str(e)}", exc_info=True)
|
|
652
|
+
raise CustomerSecretManagerError(f"Failed to generate Snowflake keys: {str(e)}")
|
|
653
|
+
finally:
|
|
654
|
+
for p in (private_key_path, public_key_path):
|
|
655
|
+
try:
|
|
656
|
+
Path(p).unlink(missing_ok=True)
|
|
657
|
+
except OSError:
|
|
658
|
+
pass
|
|
659
|
+
|
|
660
|
+
def export_private_key(self, agent_name):
|
|
661
|
+
key_name = f"{agent_name}_private_key" # Create a unique key name based on the agent
|
|
662
|
+
if key_name not in self.secrets_cache:
|
|
663
|
+
private_key, public_key = self.generate_ssh_keys(comment=agent_name, key_name=key_name)
|
|
664
|
+
self.secrets_cache[key_name] = private_key
|
|
665
|
+
self.secrets_cache[f"{agent_name}_public_key"] = public_key
|
|
666
|
+
return self.secrets_cache[key_name]
|
|
667
|
+
|
|
668
|
+
def export_public_key(self, agent_name):
|
|
669
|
+
key_name = f"{agent_name}_public_key" # Create a unique key name based on the agent
|
|
670
|
+
if key_name not in self.secrets_cache:
|
|
671
|
+
self.export_private_key(agent_name) # This will populate both private and public keys
|
|
672
|
+
return self.secrets_cache[key_name]
|
|
673
|
+
|
|
674
|
+
def fetch_secret_by_path(self, path):
|
|
675
|
+
"""
|
|
676
|
+
Fetch a secret value by its path.
|
|
677
|
+
|
|
678
|
+
Args:
|
|
679
|
+
- path (str): The path to the secret, e.g., "global-object-storage/root-buckets-secrets/access-key"
|
|
680
|
+
|
|
681
|
+
Returns:
|
|
682
|
+
- str: The secret value
|
|
683
|
+
"""
|
|
684
|
+
# First check if we already have it in cache
|
|
685
|
+
if path in self.secrets_cache:
|
|
686
|
+
return self.secrets_cache[path]
|
|
687
|
+
|
|
688
|
+
# For local vault during initialization, return a placeholder
|
|
689
|
+
# This will be replaced later when actually creating the secrets
|
|
690
|
+
logger.warning(f"Reference to path '{path}' not found in cache during local vault initialization.")
|
|
691
|
+
return f"REF_TO_{path}"
|
|
692
|
+
|
|
693
|
+
def create_temp_file(self, temp_file_path):
|
|
694
|
+
"""Create or merge the secrets file with previously generated values.
|
|
695
|
+
|
|
696
|
+
On the first run, the file does not exist yet — we generate every
|
|
697
|
+
secret from the template and write it out. On subsequent runs the
|
|
698
|
+
file already holds real generated values (random passwords,
|
|
699
|
+
Fernet keys, ...). We reload the template, generate as usual, but
|
|
700
|
+
the file-writer skips any leaf that already has a real value in
|
|
701
|
+
the existing on-disk structure. That preserves random secrets
|
|
702
|
+
across reboots of the deployer host without locking the customer
|
|
703
|
+
out of regenerated-key rotations.
|
|
704
|
+
"""
|
|
705
|
+
template_file_path = 'utils/templates/secret_structure_template/customer_vault_structure.json'
|
|
706
|
+
with open(template_file_path, 'r') as template_file:
|
|
707
|
+
template_data = json.load(template_file)
|
|
708
|
+
|
|
709
|
+
existing_structure: dict = {}
|
|
710
|
+
if os.path.exists(temp_file_path):
|
|
711
|
+
try:
|
|
712
|
+
with open(temp_file_path, "r") as f:
|
|
713
|
+
existing_structure = json.load(f)
|
|
714
|
+
except (OSError, json.JSONDecodeError):
|
|
715
|
+
existing_structure = {}
|
|
716
|
+
|
|
717
|
+
output_structure = json.loads(json.dumps(existing_structure)) if existing_structure else {}
|
|
718
|
+
|
|
719
|
+
def collect(path, secret_key, secret_value):
|
|
720
|
+
return self._collect_secret_for_file(
|
|
721
|
+
output_structure, path, secret_key, secret_value, existing=existing_structure,
|
|
722
|
+
)
|
|
723
|
+
|
|
724
|
+
self.parse_and_import_secrets(template_data, sink=collect)
|
|
725
|
+
|
|
726
|
+
Path(temp_file_path).parent.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
727
|
+
fd = os.open(
|
|
728
|
+
temp_file_path,
|
|
729
|
+
os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
|
|
730
|
+
0o600,
|
|
731
|
+
)
|
|
732
|
+
os.fchmod(fd, 0o600)
|
|
733
|
+
with os.fdopen(fd, "w") as temp_file:
|
|
734
|
+
json.dump(output_structure, temp_file, indent=4)
|
|
735
|
+
|
|
736
|
+
return output_structure
|
|
737
|
+
|
|
738
|
+
@staticmethod
|
|
739
|
+
def ensure_vault_secret(vault_path: str, secrets: dict, kube_config_path: str, namespace: str = "vault") -> bool:
|
|
740
|
+
"""Write ``secrets`` to ``secret/<vault_path>`` only when that path is absent.
|
|
741
|
+
|
|
742
|
+
Returns True when the secret was created, False when it already existed.
|
|
743
|
+
Existing values are never overwritten, so generated passwords stay stable.
|
|
744
|
+
"""
|
|
745
|
+
token_b64 = subprocess.run(
|
|
746
|
+
["kubectl", "get", "secret", "vault-init", "-n", namespace,
|
|
747
|
+
"-o", "jsonpath={.data.root-token}", "--kubeconfig", kube_config_path],
|
|
748
|
+
capture_output=True, text=True, check=True,
|
|
749
|
+
).stdout.strip()
|
|
750
|
+
root_token = base64.b64decode(token_b64).decode("utf-8").strip()
|
|
751
|
+
base = ["kubectl", "exec", "vault-0", "-n", namespace, "--kubeconfig", kube_config_path,
|
|
752
|
+
"--", "env", "VAULT_ADDR=http://127.0.0.1:8200", f"VAULT_TOKEN={root_token}", "vault", "kv"]
|
|
753
|
+
exists = subprocess.run(base + ["get", "-format=json", f"secret/{vault_path}"],
|
|
754
|
+
capture_output=True, text=True)
|
|
755
|
+
if exists.returncode == 0:
|
|
756
|
+
logger.info(f"ensure_vault_secret: secret/{vault_path} already present")
|
|
757
|
+
return False
|
|
758
|
+
subprocess.run(base + ["put", f"secret/{vault_path}", *[f"{k}={v}" for k, v in secrets.items()]],
|
|
759
|
+
capture_output=True, text=True, check=True)
|
|
760
|
+
logger.info(f"ensure_vault_secret: created secret/{vault_path} with {len(secrets)} keys")
|
|
761
|
+
return True
|
|
762
|
+
|
|
763
|
+
@staticmethod
|
|
764
|
+
def publish_extra_secrets(
|
|
765
|
+
service_name: str,
|
|
766
|
+
secrets: dict,
|
|
767
|
+
kube_config_path: str,
|
|
768
|
+
namespace: str = "vault",
|
|
769
|
+
secret_name: str = "vault-secrets", # noqa: ARG004 (kept for API compat)
|
|
770
|
+
customer: str | None = None,
|
|
771
|
+
) -> bool:
|
|
772
|
+
"""Push a service's secrets directly into the in-cluster
|
|
773
|
+
Vault so External Secrets Operator can read them.
|
|
774
|
+
|
|
775
|
+
Why a static method
|
|
776
|
+
-------------------
|
|
777
|
+
``CustomerSecretManager.__init__`` runs a heavy setup chain
|
|
778
|
+
(``_setup_repositories``, ``_setup_authentication``, ...) that
|
|
779
|
+
needs repo URLs, git tokens, etc. — none of which we have when
|
|
780
|
+
called from the cert-manager / external-dns deployer. Making
|
|
781
|
+
this a ``@staticmethod`` lets us reuse the Vault-writing logic
|
|
782
|
+
without triggering any of that initialization.
|
|
783
|
+
|
|
784
|
+
Why direct ``vault kv put`` instead of the file/Job route
|
|
785
|
+
---------------------------------------------------------
|
|
786
|
+
The vault-populator Job reads the K8s Secret
|
|
787
|
+
``vault/vault-secrets`` and writes its data into Vault, but it
|
|
788
|
+
only runs once (when the chart is first deployed). Re-applying
|
|
789
|
+
the K8s Secret later does NOT trigger a re-population. So for
|
|
790
|
+
any service that's added after the initial deploy — like
|
|
791
|
+
cert-manager / external-dns / future extras — we have to push
|
|
792
|
+
into Vault ourselves. We do that via ``kubectl exec`` into the
|
|
793
|
+
``vault-0`` pod using the root token from the
|
|
794
|
+
``vault-init`` Secret.
|
|
795
|
+
|
|
796
|
+
The path we write to is::
|
|
797
|
+
|
|
798
|
+
secret/data-infrastructure-service/<service_name>
|
|
799
|
+
|
|
800
|
+
which matches what the kube-core/raw ExternalSecret templates
|
|
801
|
+
read (e.g. ``data-infrastructure-service/cert-manager``).
|
|
802
|
+
|
|
803
|
+
Parameters
|
|
804
|
+
----------
|
|
805
|
+
service_name
|
|
806
|
+
Top-level key in the structure (e.g. ``cert-manager``,
|
|
807
|
+
``external-dns``).
|
|
808
|
+
secrets
|
|
809
|
+
``{key: value}`` dict; values are written verbatim as
|
|
810
|
+
Vault KV fields.
|
|
811
|
+
kube_config_path
|
|
812
|
+
Path to the kubeconfig used for kubectl exec.
|
|
813
|
+
namespace
|
|
814
|
+
Namespace where the Vault pod lives (default: ``vault``).
|
|
815
|
+
secret_name
|
|
816
|
+
Currently unused — kept for backwards compatibility with
|
|
817
|
+
earlier callers.
|
|
818
|
+
customer
|
|
819
|
+
Customer slug (kept for backwards compatibility — not used
|
|
820
|
+
in the Vault path any more).
|
|
821
|
+
|
|
822
|
+
Returns
|
|
823
|
+
-------
|
|
824
|
+
True on success, False otherwise.
|
|
825
|
+
"""
|
|
826
|
+
if not secrets:
|
|
827
|
+
logger.info(
|
|
828
|
+
f"publish_extra_secrets: no secrets to publish for "
|
|
829
|
+
f"{service_name}, skipping."
|
|
830
|
+
)
|
|
831
|
+
return True
|
|
832
|
+
|
|
833
|
+
if not customer:
|
|
834
|
+
# customer is no longer required for the path, but log a
|
|
835
|
+
# warning to surface any leftover callers passing None.
|
|
836
|
+
logger.warning(
|
|
837
|
+
"publish_extra_secrets: customer not provided — vault "
|
|
838
|
+
"path is now data-infrastructure-service/<svc>, customer "
|
|
839
|
+
"is unused."
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
# 1. Best-effort: also keep the local structure file in sync
|
|
843
|
+
# (for the next vault-populator run if the cluster is ever
|
|
844
|
+
# rebuilt from scratch). Failure here does not block the
|
|
845
|
+
# in-Vault write.
|
|
846
|
+
try:
|
|
847
|
+
init_secrets_dir()
|
|
848
|
+
vault_file = _vault_structure_path(customer) if customer else None
|
|
849
|
+
structure: dict = {}
|
|
850
|
+
if vault_file and vault_file.exists():
|
|
851
|
+
try:
|
|
852
|
+
with open(vault_file, "r") as f:
|
|
853
|
+
structure = json.load(f)
|
|
854
|
+
except json.JSONDecodeError:
|
|
855
|
+
structure = {}
|
|
856
|
+
if customer and vault_file:
|
|
857
|
+
existing = structure.get(service_name, {})
|
|
858
|
+
existing.update(secrets)
|
|
859
|
+
structure[service_name] = existing
|
|
860
|
+
fd = os.open(
|
|
861
|
+
str(vault_file),
|
|
862
|
+
os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
|
|
863
|
+
0o600,
|
|
864
|
+
)
|
|
865
|
+
os.fchmod(fd, 0o600)
|
|
866
|
+
with os.fdopen(fd, "w") as f:
|
|
867
|
+
json.dump(structure, f, indent=4)
|
|
868
|
+
logger.info(
|
|
869
|
+
f"publish_extra_secrets: wrote {len(secrets)} secrets for "
|
|
870
|
+
f"{service_name} into {vault_file}"
|
|
871
|
+
)
|
|
872
|
+
except Exception as exc:
|
|
873
|
+
logger.warning(
|
|
874
|
+
f"publish_extra_secrets: could not update vault file ({exc}) "
|
|
875
|
+
f"— proceeding with in-Vault write"
|
|
876
|
+
)
|
|
877
|
+
|
|
878
|
+
# 2. Push into Vault via kubectl exec + vault kv put.
|
|
879
|
+
try:
|
|
880
|
+
# 2a. Fetch the Vault root token from vault-init.
|
|
881
|
+
get_token_cmd = [
|
|
882
|
+
"kubectl", "get", "secret", "vault-init",
|
|
883
|
+
"-n", namespace,
|
|
884
|
+
"-o", "jsonpath={.data.root-token}",
|
|
885
|
+
"--kubeconfig", kube_config_path,
|
|
886
|
+
]
|
|
887
|
+
token_proc = subprocess.run(
|
|
888
|
+
get_token_cmd, capture_output=True, text=True, check=True
|
|
889
|
+
)
|
|
890
|
+
token_b64 = token_proc.stdout.strip()
|
|
891
|
+
root_token = base64.b64decode(token_b64).decode("utf-8").strip()
|
|
892
|
+
|
|
893
|
+
# 2b. Build `vault kv put secret/data-infrastructure-service/<svc> k=v ...`
|
|
894
|
+
# Hardcoded path — independent of customer name. Keeps the
|
|
895
|
+
# template ExternalSecret references stable across clusters.
|
|
896
|
+
vault_path = f"secret/data-infrastructure-service/{service_name}"
|
|
897
|
+
kv_args = [f"{k}={v}" for k, v in secrets.items()]
|
|
898
|
+
exec_cmd = [
|
|
899
|
+
"kubectl", "exec", "vault-0", "-n", namespace,
|
|
900
|
+
"--kubeconfig", kube_config_path,
|
|
901
|
+
"--", "env", f"VAULT_ADDR=http://127.0.0.1:8200",
|
|
902
|
+
f"VAULT_TOKEN={root_token}",
|
|
903
|
+
"vault", "kv", "put", vault_path, *kv_args,
|
|
904
|
+
]
|
|
905
|
+
put_proc = subprocess.run(
|
|
906
|
+
exec_cmd, capture_output=True, text=True, check=True
|
|
907
|
+
)
|
|
908
|
+
logger.info(
|
|
909
|
+
f"publish_extra_secrets: wrote {len(secrets)} keys into "
|
|
910
|
+
f"Vault at {vault_path}"
|
|
911
|
+
)
|
|
912
|
+
logger.debug(put_proc.stdout)
|
|
913
|
+
return True
|
|
914
|
+
except subprocess.CalledProcessError as exc:
|
|
915
|
+
logger.error(
|
|
916
|
+
f"publish_extra_secrets: kubectl/vault command failed "
|
|
917
|
+
f"(rc={exc.returncode}): {exc.stderr.strip()}"
|
|
918
|
+
)
|
|
919
|
+
return False
|
|
920
|
+
except Exception as exc:
|
|
921
|
+
logger.error(
|
|
922
|
+
f"publish_extra_secrets: failed to write into Vault: "
|
|
923
|
+
f"{exc}"
|
|
924
|
+
)
|
|
925
|
+
return False
|
|
926
|
+
|
|
927
|
+
def _collect_secret_for_file(self, structure, path, secret_key, secret_value, existing=None):
|
|
928
|
+
"""Helper that collects secrets into a structure instead of making API calls.
|
|
929
|
+
|
|
930
|
+
``existing`` is the on-disk structure from a previous run. When a
|
|
931
|
+
leaf already holds a real value there and the freshly-generated
|
|
932
|
+
value would otherwise overwrite it, we keep the on-disk value so
|
|
933
|
+
random passwords survive a deployer-host reboot.
|
|
934
|
+
"""
|
|
935
|
+
result = []
|
|
936
|
+
|
|
937
|
+
if secret_value is None or secret_value == "":
|
|
938
|
+
secret_value = "EMPTY"
|
|
939
|
+
|
|
940
|
+
if isinstance(secret_value, str) and secret_value.startswith("ref:"):
|
|
941
|
+
ref_path = secret_value[4:]
|
|
942
|
+
if ref_path in self.secrets_cache:
|
|
943
|
+
secret_value = self.secrets_cache[ref_path]
|
|
944
|
+
else:
|
|
945
|
+
parts = ref_path.split('/')
|
|
946
|
+
current = structure
|
|
947
|
+
found = True
|
|
948
|
+
for part in parts[:-1]:
|
|
949
|
+
if part in current:
|
|
950
|
+
current = current[part]
|
|
951
|
+
else:
|
|
952
|
+
found = False
|
|
953
|
+
break
|
|
954
|
+
if found and parts[-1] in current:
|
|
955
|
+
secret_value = current[parts[-1]]
|
|
956
|
+
else:
|
|
957
|
+
result.append(f"Reference '{ref_path}' not found in cache. Using placeholder.")
|
|
958
|
+
|
|
959
|
+
path_parts = [p for p in path.strip('/').split('/') if p]
|
|
960
|
+
cursor = structure
|
|
961
|
+
for part in path_parts:
|
|
962
|
+
if part not in cursor or not isinstance(cursor[part], dict):
|
|
963
|
+
cursor[part] = {}
|
|
964
|
+
cursor = cursor[part]
|
|
965
|
+
|
|
966
|
+
# Merge: if the on-disk file already has a real value at this
|
|
967
|
+
# leaf, keep it. EMPTY means "previous run said placeholder";
|
|
968
|
+
# we DO regenerate those. ``random``/``random_10``/etc. also
|
|
969
|
+
# regenerate because that's what the template asked for.
|
|
970
|
+
if existing is not None:
|
|
971
|
+
existing_cursor = existing
|
|
972
|
+
for part in path_parts:
|
|
973
|
+
if isinstance(existing_cursor, dict) and part in existing_cursor:
|
|
974
|
+
existing_cursor = existing_cursor[part]
|
|
975
|
+
else:
|
|
976
|
+
existing_cursor = None
|
|
977
|
+
break
|
|
978
|
+
if isinstance(existing_cursor, dict) and secret_key in existing_cursor:
|
|
979
|
+
prior = existing_cursor[secret_key]
|
|
980
|
+
if isinstance(prior, str) and prior not in ("", "EMPTY"):
|
|
981
|
+
secret_value = prior
|
|
982
|
+
|
|
983
|
+
full_path = path.rstrip('/') + '/' + secret_key
|
|
984
|
+
self.secrets_cache[full_path] = secret_value
|
|
985
|
+
cursor[secret_key] = secret_value
|
|
986
|
+
result.append(f"Collected '{secret_key}' for file structure at path '{path}'")
|
|
987
|
+
return result
|
|
988
|
+
|
|
989
|
+
def run(self):
|
|
990
|
+
messages = [] # List to collect operation messages
|
|
991
|
+
response_data = {} # Dictionary to hold response data
|
|
992
|
+
try:
|
|
993
|
+
messages.append("Using local HashiCorp Vault method.")
|
|
994
|
+
|
|
995
|
+
init_secrets_dir()
|
|
996
|
+
temp_file_path = str(_vault_structure_path(self.customer))
|
|
997
|
+
existed_before = Path(temp_file_path).exists()
|
|
998
|
+
self.create_temp_file(temp_file_path)
|
|
999
|
+
if existed_before:
|
|
1000
|
+
messages.append(
|
|
1001
|
+
f"Reused existing secrets file at {temp_file_path} "
|
|
1002
|
+
f"(preserved across restarts; no secrets regenerated)."
|
|
1003
|
+
)
|
|
1004
|
+
else:
|
|
1005
|
+
messages.append(f"Temporary secrets file created at {temp_file_path}")
|
|
1006
|
+
record_secret(
|
|
1007
|
+
self.customer,
|
|
1008
|
+
Path(temp_file_path),
|
|
1009
|
+
[
|
|
1010
|
+
"infrastructure_deployed",
|
|
1011
|
+
"secrets_generated",
|
|
1012
|
+
"repositories_configured",
|
|
1013
|
+
"infra_services_deployed",
|
|
1014
|
+
"data_services_deployed",
|
|
1015
|
+
"deployment_finalized",
|
|
1016
|
+
],
|
|
1017
|
+
)
|
|
1018
|
+
|
|
1019
|
+
messages.append("Secrets pushed to local HashiCorp Vault successfully.")
|
|
1020
|
+
|
|
1021
|
+
response_data.update({
|
|
1022
|
+
'temp_file_path': temp_file_path,
|
|
1023
|
+
'status': "success"
|
|
1024
|
+
})
|
|
1025
|
+
|
|
1026
|
+
response_data['status'] = "success"
|
|
1027
|
+
response_data['messages'] = messages
|
|
1028
|
+
return response_data
|
|
1029
|
+
|
|
1030
|
+
except Exception as e:
|
|
1031
|
+
logger.error(f"An error occurred: {e}")
|
|
1032
|
+
return {"status": "error", "error": str(e)}
|
|
1033
|
+
|
|
1034
|
+
@staticmethod
|
|
1035
|
+
def _is_base64(s):
|
|
1036
|
+
"""Check if a string is base64 encoded."""
|
|
1037
|
+
try:
|
|
1038
|
+
if not isinstance(s, str):
|
|
1039
|
+
return False
|
|
1040
|
+
# Check if the string contains only valid base64 characters
|
|
1041
|
+
if not all(c in string.ascii_letters + string.digits + '+/=' for c in s):
|
|
1042
|
+
return False
|
|
1043
|
+
# Try to decode
|
|
1044
|
+
base64.b64decode(s)
|
|
1045
|
+
return True
|
|
1046
|
+
except Exception:
|
|
1047
|
+
return False
|
|
1048
|
+
|
|
1049
|
+
@classmethod
|
|
1050
|
+
def validate_inputs(cls, **kwargs):
|
|
1051
|
+
errors = []
|
|
1052
|
+
data_warehouse_platform = kwargs.get('data_warehouse_platform')
|
|
1053
|
+
cloud_provider = kwargs.get('cloud_provider')
|
|
1054
|
+
|
|
1055
|
+
# Required fields
|
|
1056
|
+
required_fields = {
|
|
1057
|
+
'customer': 'Customer name',
|
|
1058
|
+
'user_email': 'User email',
|
|
1059
|
+
'data_analysis_platform': 'Data analysis platform',
|
|
1060
|
+
'data_warehouse_platform': 'Data warehouse platform',
|
|
1061
|
+
'git_provider': 'Git provider',
|
|
1062
|
+
'dag_repo_url': 'DAG repository URL',
|
|
1063
|
+
'data_repo_url': 'Data repository URL'
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
for field, description in required_fields.items():
|
|
1067
|
+
if not kwargs.get(field):
|
|
1068
|
+
errors.append(f"{description} is required")
|
|
1069
|
+
|
|
1070
|
+
# Cloud Provider Validation
|
|
1071
|
+
if cloud_provider:
|
|
1072
|
+
if cloud_provider not in ['gcp', 'aws', 'azure', 'self-managed']:
|
|
1073
|
+
errors.append("cloud_provider must be one of: gcp, aws, azure, self-managed")
|
|
1074
|
+
|
|
1075
|
+
# GCP specific validation
|
|
1076
|
+
if cloud_provider == 'gcp':
|
|
1077
|
+
if not kwargs.get('project_id'):
|
|
1078
|
+
errors.append("project_id is required when cloud_provider is gcp")
|
|
1079
|
+
if not kwargs.get('project_region'):
|
|
1080
|
+
errors.append("project_region is required when cloud_provider is gcp")
|
|
1081
|
+
|
|
1082
|
+
project_id = kwargs.get('project_id')
|
|
1083
|
+
if project_id and not re.match(r'^[a-z][-a-z0-9]{4,28}[a-z0-9]$', project_id):
|
|
1084
|
+
errors.append("GCP project_id must be 6-30 characters, lowercase letters, numbers, or hyphens")
|
|
1085
|
+
|
|
1086
|
+
# AWS specific validation
|
|
1087
|
+
elif cloud_provider == 'aws':
|
|
1088
|
+
if not kwargs.get('aws_access_key_id'):
|
|
1089
|
+
errors.append("aws_access_key_id is required when cloud_provider is aws")
|
|
1090
|
+
if not kwargs.get('aws_secret_access_key'):
|
|
1091
|
+
errors.append("aws_secret_access_key is required when cloud_provider is aws")
|
|
1092
|
+
if not kwargs.get('aws_region'):
|
|
1093
|
+
errors.append("aws_region is required when cloud_provider is aws")
|
|
1094
|
+
|
|
1095
|
+
# Azure specific validation
|
|
1096
|
+
elif cloud_provider == 'azure':
|
|
1097
|
+
if not kwargs.get('azure_client_id'):
|
|
1098
|
+
errors.append("azure_client_id is required when cloud_provider is azure")
|
|
1099
|
+
if not kwargs.get('azure_client_secret'):
|
|
1100
|
+
errors.append("azure_client_secret is required when cloud_provider is azure")
|
|
1101
|
+
|
|
1102
|
+
# Data Warehouse Platform Validation
|
|
1103
|
+
if data_warehouse_platform:
|
|
1104
|
+
# BigQuery specific validation
|
|
1105
|
+
if data_warehouse_platform == 'bigquery':
|
|
1106
|
+
if not kwargs.get('bigquery_project_id'):
|
|
1107
|
+
errors.append("bigquery_project_id is required when data_warehouse_platform is bigquery")
|
|
1108
|
+
if not kwargs.get('bigquery_region'):
|
|
1109
|
+
errors.append("bigquery_region is required when data_warehouse_platform is bigquery")
|
|
1110
|
+
if not kwargs.get('data_platform_sa_json'):
|
|
1111
|
+
errors.append("data_platform_sa_json (service account JSON) is required when using BigQuery")
|
|
1112
|
+
if not kwargs.get('data_analysis_sa_json'):
|
|
1113
|
+
errors.append("data_analysis_sa_json (service account JSON) is required when using BigQuery")
|
|
1114
|
+
|
|
1115
|
+
# Validate service account JSON format if provided
|
|
1116
|
+
for sa_field in ['data_platform_sa_json', 'data_analysis_sa_json']:
|
|
1117
|
+
sa_json = kwargs.get(sa_field)
|
|
1118
|
+
if sa_json:
|
|
1119
|
+
try:
|
|
1120
|
+
if cls._is_base64(sa_json):
|
|
1121
|
+
decoded_json = base64.b64decode(sa_json).decode('utf-8')
|
|
1122
|
+
json.loads(decoded_json)
|
|
1123
|
+
else:
|
|
1124
|
+
json.loads(sa_json)
|
|
1125
|
+
except Exception as e:
|
|
1126
|
+
errors.append(f"Invalid {sa_field} format: {str(e)}")
|
|
1127
|
+
|
|
1128
|
+
# Redshift specific validation
|
|
1129
|
+
elif data_warehouse_platform == 'redshift':
|
|
1130
|
+
required_fields = {
|
|
1131
|
+
'redshift_host': 'Redshift host',
|
|
1132
|
+
'redshift_database': 'Redshift database',
|
|
1133
|
+
'redshift_port': 'Redshift port',
|
|
1134
|
+
'redshift_user': 'Redshift user',
|
|
1135
|
+
'redshift_password': 'Redshift password'
|
|
1136
|
+
}
|
|
1137
|
+
for field, description in required_fields.items():
|
|
1138
|
+
if not kwargs.get(field):
|
|
1139
|
+
errors.append(f"{description} is required when using Redshift")
|
|
1140
|
+
|
|
1141
|
+
# Snowflake specific validation
|
|
1142
|
+
elif data_warehouse_platform == 'snowflake':
|
|
1143
|
+
required_fields = {
|
|
1144
|
+
'snowflake_account': 'Snowflake account',
|
|
1145
|
+
'snowflake_user': 'Snowflake user',
|
|
1146
|
+
'snowflake_warehouse': 'Snowflake warehouse',
|
|
1147
|
+
'snowflake_database': 'Snowflake database'
|
|
1148
|
+
}
|
|
1149
|
+
for field, description in required_fields.items():
|
|
1150
|
+
if not kwargs.get(field):
|
|
1151
|
+
errors.append(f"{description} is required when using Snowflake")
|
|
1152
|
+
|
|
1153
|
+
# Check if any authentication method is provided
|
|
1154
|
+
auth_methods = {
|
|
1155
|
+
'password': kwargs.get('snowflake_password'),
|
|
1156
|
+
'key_pair': all([kwargs.get('snowflake_private_key'), kwargs.get('snowflake_public_key')])
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
# If no authentication method is provided, generate keys and passphrase
|
|
1160
|
+
if not any(auth_methods.values()):
|
|
1161
|
+
logger.info("No Snowflake authentication method provided. Generating key pair and passphrase.")
|
|
1162
|
+
private_key, public_key = cls.generate_snowflake_keys()
|
|
1163
|
+
kwargs['snowflake_private_key'] = private_key
|
|
1164
|
+
kwargs['snowflake_public_key'] = public_key
|
|
1165
|
+
kwargs['snowflake_passphrase'] = cls.generate_secure_password(length=32)
|
|
1166
|
+
# If password is provided but key pair is not, that's fine
|
|
1167
|
+
elif auth_methods['password'] and not auth_methods['key_pair']:
|
|
1168
|
+
logger.info("Using password authentication for Snowflake.")
|
|
1169
|
+
# If key pair is provided but password is not, that's fine
|
|
1170
|
+
elif auth_methods['key_pair'] and not auth_methods['password']:
|
|
1171
|
+
logger.info("Using key pair authentication for Snowflake.")
|
|
1172
|
+
if not kwargs.get('snowflake_passphrase'):
|
|
1173
|
+
kwargs['snowflake_passphrase'] = cls.generate_secure_password(length=32)
|
|
1174
|
+
# If both are provided, prefer key pair
|
|
1175
|
+
elif all(auth_methods.values()):
|
|
1176
|
+
logger.info("Both password and key pair provided for Snowflake. Using key pair authentication.")
|
|
1177
|
+
if not kwargs.get('snowflake_passphrase'):
|
|
1178
|
+
kwargs['snowflake_passphrase'] = cls.generate_secure_password(length=32)
|
|
1179
|
+
|
|
1180
|
+
# MS Fabric specific validation
|
|
1181
|
+
elif data_warehouse_platform == 'fabric':
|
|
1182
|
+
required_fields = {
|
|
1183
|
+
'fabric_server': 'MS Fabric server',
|
|
1184
|
+
'fabric_database': 'MS Fabric database',
|
|
1185
|
+
'fabric_port': 'MS Fabric port',
|
|
1186
|
+
'fabric_user': 'MS Fabric user',
|
|
1187
|
+
'fabric_password': 'MS Fabric password',
|
|
1188
|
+
'fabric_authentication': 'MS Fabric authentication method'
|
|
1189
|
+
}
|
|
1190
|
+
for field, description in required_fields.items():
|
|
1191
|
+
if not kwargs.get(field):
|
|
1192
|
+
errors.append(f"{description} is required when using MS Fabric")
|
|
1193
|
+
|
|
1194
|
+
# Git provider validation
|
|
1195
|
+
git_provider = kwargs.get('git_provider')
|
|
1196
|
+
if git_provider:
|
|
1197
|
+
if git_provider not in ['github', 'gitlab', 'gitea', 'bitbucket']:
|
|
1198
|
+
errors.append("git_provider must be one of: github, gitlab, gitea, bitbucket")
|
|
1199
|
+
if not kwargs.get('git_provider_access_token') and kwargs.get('repo_access_method') != 'deploy_keys':
|
|
1200
|
+
errors.append("Either git_provider_access_token or deploy_keys repo_access_method is required")
|
|
1201
|
+
|
|
1202
|
+
# URL format validation
|
|
1203
|
+
for url_field in ['dag_repo_url', 'data_repo_url']:
|
|
1204
|
+
url = kwargs.get(url_field)
|
|
1205
|
+
if url:
|
|
1206
|
+
if not url.startswith(('http://', 'https://')):
|
|
1207
|
+
errors.append(f"{url_field} must start with http:// or https://")
|
|
1208
|
+
if git_provider == 'gitlab' and 'gitlab' not in url:
|
|
1209
|
+
errors.append(f"{url_field} must be a GitLab URL when git_provider is gitlab")
|
|
1210
|
+
|
|
1211
|
+
# SMTP validation - all or none
|
|
1212
|
+
smtp_fields = ['smtp_host', 'smtp_port', 'smtp_username', 'smtp_password']
|
|
1213
|
+
smtp_provided = any(kwargs.get(field) for field in smtp_fields)
|
|
1214
|
+
if smtp_provided:
|
|
1215
|
+
for field in smtp_fields:
|
|
1216
|
+
if not kwargs.get(field):
|
|
1217
|
+
errors.append(f"{field} is required when any SMTP setting is provided")
|
|
1218
|
+
try:
|
|
1219
|
+
smtp_port = int(kwargs.get('smtp_port', ''))
|
|
1220
|
+
if not (0 < smtp_port < 65536):
|
|
1221
|
+
errors.append("smtp_port must be between 1 and 65535")
|
|
1222
|
+
except ValueError:
|
|
1223
|
+
errors.append("smtp_port must be a valid number")
|
|
1224
|
+
|
|
1225
|
+
if errors:
|
|
1226
|
+
error_message = "Validation errors found:\n" + "\n".join(f"- {error}" for error in errors)
|
|
1227
|
+
raise ValueError(error_message)
|
|
1228
|
+
|
|
1229
|
+
@classmethod
|
|
1230
|
+
def from_cli_args(cls, args):
|
|
1231
|
+
"""Factory method to create instance from CLI arguments with validation"""
|
|
1232
|
+
params = {
|
|
1233
|
+
'customer': args.customer,
|
|
1234
|
+
'user_email': args.user_email,
|
|
1235
|
+
'domain_name': args.domain_name,
|
|
1236
|
+
'data_analysis_platform': args.data_analysis_platform,
|
|
1237
|
+
'data_warehouse_platform': args.data_warehouse_platform,
|
|
1238
|
+
'git_provider': args.git_provider,
|
|
1239
|
+
'dag_repo_url': args.dag_repo_url,
|
|
1240
|
+
'data_repo_url': args.data_repo_url,
|
|
1241
|
+
'data_repo_main_branch': args.data_repo_main_branch,
|
|
1242
|
+
'repo_access_method': args.repo_access_method,
|
|
1243
|
+
'project_id': args.project_id,
|
|
1244
|
+
'project_region': args.project_region,
|
|
1245
|
+
'cloud_provider': args.cloud_provider,
|
|
1246
|
+
'git_provider_access_token': args.git_provider_access_token,
|
|
1247
|
+
'private_key_orchestrator': args.private_key_orchestrator,
|
|
1248
|
+
'public_key_orchestrator': args.public_key_orchestrator,
|
|
1249
|
+
'private_key_data_model': args.private_key_data_model,
|
|
1250
|
+
'public_key_data_model': args.public_key_data_model,
|
|
1251
|
+
'smtp_host': args.smtp_host,
|
|
1252
|
+
'smtp_port': args.smtp_port,
|
|
1253
|
+
'smtp_username': args.smtp_username,
|
|
1254
|
+
'smtp_password': args.smtp_password,
|
|
1255
|
+
'orchestrator_platform': args.orchestrator_platform,
|
|
1256
|
+
# Bigquery parameters
|
|
1257
|
+
'data_platform_sa_json': args.data_platform_sa_json,
|
|
1258
|
+
'data_analysis_sa_json': args.data_analysis_sa_json,
|
|
1259
|
+
'bigquery_project_id': args.bigquery_project_id,
|
|
1260
|
+
'bigquery_region': args.bigquery_region,
|
|
1261
|
+
# Redshift parameters
|
|
1262
|
+
'redshift_host': args.redshift_host,
|
|
1263
|
+
'redshift_database': args.redshift_database,
|
|
1264
|
+
'redshift_port': args.redshift_port,
|
|
1265
|
+
'redshift_user': args.redshift_user,
|
|
1266
|
+
'redshift_password': args.redshift_password,
|
|
1267
|
+
# Snowflake parameters
|
|
1268
|
+
'snowflake_account': args.snowflake_account,
|
|
1269
|
+
'snowflake_user': args.snowflake_user,
|
|
1270
|
+
'snowflake_warehouse': args.snowflake_warehouse,
|
|
1271
|
+
'snowflake_database': args.snowflake_database,
|
|
1272
|
+
'snowflake_password': args.snowflake_password,
|
|
1273
|
+
'snowflake_private_key': args.snowflake_private_key,
|
|
1274
|
+
'snowflake_public_key': args.snowflake_public_key,
|
|
1275
|
+
'snowflake_passphrase': args.snowflake_passphrase,
|
|
1276
|
+
# MS Fabric parameters
|
|
1277
|
+
'fabric_server': args.fabric_server,
|
|
1278
|
+
'fabric_database': args.fabric_database,
|
|
1279
|
+
'fabric_port': args.fabric_port,
|
|
1280
|
+
'fabric_user': args.fabric_user,
|
|
1281
|
+
'fabric_password': args.fabric_password,
|
|
1282
|
+
'fabric_authentication': args.fabric_authentication,
|
|
1283
|
+
#Platform Auth
|
|
1284
|
+
'aws_access_key_id': args.aws_access_key_id,
|
|
1285
|
+
'aws_secret_access_key': args.aws_secret_access_key,
|
|
1286
|
+
'aws_region': args.aws_region,
|
|
1287
|
+
'azure_client_id': args.azure_client_id,
|
|
1288
|
+
'azure_client_secret': args.azure_client_secret,
|
|
1289
|
+
'runner_registration_token': args.runner_registration_token
|
|
1290
|
+
}
|
|
1291
|
+
# Validate parameters before creating instance
|
|
1292
|
+
cls.validate_inputs(**params)
|
|
1293
|
+
return cls(**params)
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
# Main execution of the script if this file is run as a script
|
|
1297
|
+
if __name__ == "__main__":
|
|
1298
|
+
parser = argparse.ArgumentParser(
|
|
1299
|
+
description="Customer Secret Manager - Tool for managing customer vault secrets",
|
|
1300
|
+
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
# Required core arguments
|
|
1304
|
+
required_args = parser.add_argument_group('required core arguments')
|
|
1305
|
+
required_args.add_argument(
|
|
1306
|
+
'--customer',
|
|
1307
|
+
required=True,
|
|
1308
|
+
help='Customer tenant name (lowercase letters, numbers, and hyphens only)'
|
|
1309
|
+
)
|
|
1310
|
+
required_args.add_argument(
|
|
1311
|
+
'--domain_name',
|
|
1312
|
+
required=True,
|
|
1313
|
+
help='Domain name for the customer'
|
|
1314
|
+
)
|
|
1315
|
+
required_args.add_argument(
|
|
1316
|
+
'--user_email',
|
|
1317
|
+
required=True,
|
|
1318
|
+
help='Fast2.Dev Support Admin email for workspace access'
|
|
1319
|
+
)
|
|
1320
|
+
required_args.add_argument(
|
|
1321
|
+
'--data_analysis_platform',
|
|
1322
|
+
required=True,
|
|
1323
|
+
choices=['lightdash', 'metabase', 'superset'],
|
|
1324
|
+
help='Data analysis platform to be used'
|
|
1325
|
+
)
|
|
1326
|
+
required_args.add_argument(
|
|
1327
|
+
'--data_warehouse_platform',
|
|
1328
|
+
choices=['bigquery', 'snowflake', 'redshift', 'fabric'],
|
|
1329
|
+
required=True,
|
|
1330
|
+
help='Data warehouse platform to use'
|
|
1331
|
+
)
|
|
1332
|
+
|
|
1333
|
+
# Git configuration group
|
|
1334
|
+
git_group = parser.add_argument_group('git configuration')
|
|
1335
|
+
git_group.add_argument(
|
|
1336
|
+
'--git_provider',
|
|
1337
|
+
required=True,
|
|
1338
|
+
choices=['fast2dev', 'github', 'gitlab', 'gitea', 'bitbucket'],
|
|
1339
|
+
help='Git provider for repositories'
|
|
1340
|
+
)
|
|
1341
|
+
git_group.add_argument(
|
|
1342
|
+
'--dag_repo_url',
|
|
1343
|
+
required=True,
|
|
1344
|
+
help='URL of the DAG repository for orchestration code (must match git provider)'
|
|
1345
|
+
)
|
|
1346
|
+
git_group.add_argument(
|
|
1347
|
+
'--data_repo_url',
|
|
1348
|
+
required=True,
|
|
1349
|
+
help='URL of the data repository for data models (must match git provider)'
|
|
1350
|
+
)
|
|
1351
|
+
git_group.add_argument(
|
|
1352
|
+
'--data_repo_main_branch',
|
|
1353
|
+
default='master',
|
|
1354
|
+
help='Main branch of the data repository (default: master)'
|
|
1355
|
+
)
|
|
1356
|
+
git_group.add_argument(
|
|
1357
|
+
'--repo_access_method',
|
|
1358
|
+
choices=['access_token', 'deploy_keys'],
|
|
1359
|
+
default='access_token',
|
|
1360
|
+
help='Method for repository access (default: access_token)'
|
|
1361
|
+
)
|
|
1362
|
+
git_group.add_argument(
|
|
1363
|
+
'--git_provider_access_token',
|
|
1364
|
+
help='Access token for Git provider (required if repo_access_method is access_token)'
|
|
1365
|
+
)
|
|
1366
|
+
git_group.add_argument(
|
|
1367
|
+
'--runner_registration_token',
|
|
1368
|
+
help='GitLab runner registration token (optional)'
|
|
1369
|
+
)
|
|
1370
|
+
|
|
1371
|
+
# Cloud provider configuration
|
|
1372
|
+
cloud_group = parser.add_argument_group('cloud provider configuration')
|
|
1373
|
+
cloud_group.add_argument(
|
|
1374
|
+
'--cloud_provider',
|
|
1375
|
+
choices=['gcp', 'aws', 'azure', 'self-managed'],
|
|
1376
|
+
help='Cloud provider for infrastructure'
|
|
1377
|
+
)
|
|
1378
|
+
cloud_group.add_argument(
|
|
1379
|
+
'--project_id',
|
|
1380
|
+
help='Cloud project identifier (required if cloud_provider is specified)'
|
|
1381
|
+
)
|
|
1382
|
+
cloud_group.add_argument(
|
|
1383
|
+
'--project_region',
|
|
1384
|
+
help='Cloud project region (required if cloud_provider is specified)'
|
|
1385
|
+
)
|
|
1386
|
+
|
|
1387
|
+
# SSH Keys configuration
|
|
1388
|
+
ssh_group = parser.add_argument_group('ssh keys configuration')
|
|
1389
|
+
ssh_group.add_argument(
|
|
1390
|
+
'--private_key_orchestrator',
|
|
1391
|
+
help='Private key for orchestrator (required if repo_access_method is deploy_keys)'
|
|
1392
|
+
)
|
|
1393
|
+
ssh_group.add_argument(
|
|
1394
|
+
'--public_key_orchestrator',
|
|
1395
|
+
help='Public key for orchestrator (required if repo_access_method is deploy_keys)'
|
|
1396
|
+
)
|
|
1397
|
+
ssh_group.add_argument(
|
|
1398
|
+
'--private_key_data_model',
|
|
1399
|
+
help='Private key for data model (required if repo_access_method is deploy_keys)'
|
|
1400
|
+
)
|
|
1401
|
+
ssh_group.add_argument(
|
|
1402
|
+
'--public_key_data_model',
|
|
1403
|
+
help='Public key for data model (required if repo_access_method is deploy_keys)'
|
|
1404
|
+
)
|
|
1405
|
+
|
|
1406
|
+
# SMTP configuration
|
|
1407
|
+
smtp_group = parser.add_argument_group('smtp configuration (all required if any is provided)')
|
|
1408
|
+
smtp_group.add_argument(
|
|
1409
|
+
'--smtp_host',
|
|
1410
|
+
help='SMTP server hostname'
|
|
1411
|
+
)
|
|
1412
|
+
smtp_group.add_argument(
|
|
1413
|
+
'--smtp_port',
|
|
1414
|
+
type=int,
|
|
1415
|
+
help='SMTP server port (1-65535)'
|
|
1416
|
+
)
|
|
1417
|
+
smtp_group.add_argument(
|
|
1418
|
+
'--smtp_username',
|
|
1419
|
+
help='SMTP authentication username'
|
|
1420
|
+
)
|
|
1421
|
+
smtp_group.add_argument(
|
|
1422
|
+
'--smtp_password',
|
|
1423
|
+
help='SMTP authentication password'
|
|
1424
|
+
)
|
|
1425
|
+
|
|
1426
|
+
# Additional configuration
|
|
1427
|
+
additional_group = parser.add_argument_group('additional configuration')
|
|
1428
|
+
additional_group.add_argument(
|
|
1429
|
+
'--orchestrator_platform',
|
|
1430
|
+
default='Airflow',
|
|
1431
|
+
help='Orchestration platform (default: Airflow)'
|
|
1432
|
+
)
|
|
1433
|
+
|
|
1434
|
+
# BigQuery configuration
|
|
1435
|
+
bigquery_group = parser.add_argument_group('bigquery configuration')
|
|
1436
|
+
bigquery_group.add_argument(
|
|
1437
|
+
'--bigquery_project_id',
|
|
1438
|
+
help='BigQuery project ID (required if data_warehouse_platform is bigquery)'
|
|
1439
|
+
)
|
|
1440
|
+
bigquery_group.add_argument(
|
|
1441
|
+
'--bigquery_region',
|
|
1442
|
+
help='BigQuery region (required if data_warehouse_platform is bigquery)'
|
|
1443
|
+
)
|
|
1444
|
+
bigquery_group.add_argument(
|
|
1445
|
+
'--data_platform_sa_json',
|
|
1446
|
+
help='Base64 encoded or raw JSON service account key for data platform (required if data_warehouse_platform is bigquery)'
|
|
1447
|
+
)
|
|
1448
|
+
bigquery_group.add_argument(
|
|
1449
|
+
'--data_analysis_sa_json',
|
|
1450
|
+
help='Base64 encoded or raw JSON service account key for data analysis (required if data_warehouse_platform is bigquery)'
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
# Redshift configuration
|
|
1454
|
+
redshift_group = parser.add_argument_group('redshift configuration')
|
|
1455
|
+
redshift_group.add_argument(
|
|
1456
|
+
'--redshift_host',
|
|
1457
|
+
help='Redshift cluster hostname (required if data_warehouse_platform is redshift)'
|
|
1458
|
+
)
|
|
1459
|
+
redshift_group.add_argument(
|
|
1460
|
+
'--redshift_database',
|
|
1461
|
+
help='Redshift database name (required if data_warehouse_platform is redshift)'
|
|
1462
|
+
)
|
|
1463
|
+
redshift_group.add_argument(
|
|
1464
|
+
'--redshift_port',
|
|
1465
|
+
help='Redshift port (default: 5439)'
|
|
1466
|
+
)
|
|
1467
|
+
redshift_group.add_argument(
|
|
1468
|
+
'--redshift_user',
|
|
1469
|
+
help='Redshift username (required if data_warehouse_platform is redshift)'
|
|
1470
|
+
)
|
|
1471
|
+
redshift_group.add_argument(
|
|
1472
|
+
'--redshift_password',
|
|
1473
|
+
help='Redshift password (required if data_warehouse_platform is redshift)'
|
|
1474
|
+
)
|
|
1475
|
+
|
|
1476
|
+
# Snowflake configuration
|
|
1477
|
+
snowflake_group = parser.add_argument_group('snowflake configuration')
|
|
1478
|
+
snowflake_group.add_argument(
|
|
1479
|
+
'--snowflake_account',
|
|
1480
|
+
help='Snowflake account identifier (required if data_warehouse_platform is snowflake)'
|
|
1481
|
+
)
|
|
1482
|
+
snowflake_group.add_argument(
|
|
1483
|
+
'--snowflake_user',
|
|
1484
|
+
help='Snowflake username (required if data_warehouse_platform is snowflake)'
|
|
1485
|
+
)
|
|
1486
|
+
snowflake_group.add_argument(
|
|
1487
|
+
'--snowflake_warehouse',
|
|
1488
|
+
help='Snowflake warehouse name (required if data_warehouse_platform is snowflake)'
|
|
1489
|
+
)
|
|
1490
|
+
snowflake_group.add_argument(
|
|
1491
|
+
'--snowflake_database',
|
|
1492
|
+
help='Snowflake database name (required if data_warehouse_platform is snowflake)'
|
|
1493
|
+
)
|
|
1494
|
+
snowflake_group.add_argument(
|
|
1495
|
+
'--snowflake_password',
|
|
1496
|
+
help='Snowflake password (optional if using key pair authentication)'
|
|
1497
|
+
)
|
|
1498
|
+
snowflake_group.add_argument(
|
|
1499
|
+
'--snowflake_private_key',
|
|
1500
|
+
help='Snowflake private key (optional if using password authentication)'
|
|
1501
|
+
)
|
|
1502
|
+
snowflake_group.add_argument(
|
|
1503
|
+
'--snowflake_public_key',
|
|
1504
|
+
help='Snowflake public key (optional if using password authentication)'
|
|
1505
|
+
)
|
|
1506
|
+
snowflake_group.add_argument(
|
|
1507
|
+
'--snowflake_passphrase',
|
|
1508
|
+
help='Snowflake passphrase for private key (optional if using password authentication)'
|
|
1509
|
+
)
|
|
1510
|
+
|
|
1511
|
+
# MS Fabric configuration
|
|
1512
|
+
fabric_group = parser.add_argument_group('ms fabric configuration')
|
|
1513
|
+
fabric_group.add_argument(
|
|
1514
|
+
'--fabric_server',
|
|
1515
|
+
help='MS Fabric server hostname (required if data_warehouse_platform is fabric)'
|
|
1516
|
+
)
|
|
1517
|
+
fabric_group.add_argument(
|
|
1518
|
+
'--fabric_database',
|
|
1519
|
+
help='MS Fabric database name (required if data_warehouse_platform is fabric)'
|
|
1520
|
+
)
|
|
1521
|
+
fabric_group.add_argument(
|
|
1522
|
+
'--fabric_port',
|
|
1523
|
+
help='MS Fabric port (default: 1433)'
|
|
1524
|
+
)
|
|
1525
|
+
fabric_group.add_argument(
|
|
1526
|
+
'--fabric_user',
|
|
1527
|
+
help='MS Fabric username (required if data_warehouse_platform is fabric)'
|
|
1528
|
+
)
|
|
1529
|
+
fabric_group.add_argument(
|
|
1530
|
+
'--fabric_password',
|
|
1531
|
+
help='MS Fabric password (required if data_warehouse_platform is fabric)'
|
|
1532
|
+
)
|
|
1533
|
+
fabric_group.add_argument(
|
|
1534
|
+
'--fabric_authentication',
|
|
1535
|
+
help='MS Fabric authentication method (required if data_warehouse_platform is fabric)'
|
|
1536
|
+
)
|
|
1537
|
+
|
|
1538
|
+
# AWS configuration
|
|
1539
|
+
aws_group = parser.add_argument_group('aws configuration')
|
|
1540
|
+
aws_group.add_argument(
|
|
1541
|
+
'--aws_access_key_id',
|
|
1542
|
+
help='AWS access key ID (required if cloud_provider is aws)'
|
|
1543
|
+
)
|
|
1544
|
+
aws_group.add_argument(
|
|
1545
|
+
'--aws_secret_access_key',
|
|
1546
|
+
help='AWS secret access key (required if cloud_provider is aws)'
|
|
1547
|
+
)
|
|
1548
|
+
aws_group.add_argument(
|
|
1549
|
+
'--aws_region',
|
|
1550
|
+
help='AWS region (required if cloud_provider is aws)'
|
|
1551
|
+
)
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
# Azure configuration
|
|
1555
|
+
azure_group = parser.add_argument_group('azure configuration')
|
|
1556
|
+
azure_group.add_argument(
|
|
1557
|
+
'--azure_client_id',
|
|
1558
|
+
help='Azure client ID (required if cloud_provider is azure)'
|
|
1559
|
+
)
|
|
1560
|
+
azure_group.add_argument(
|
|
1561
|
+
'--azure_client_secret',
|
|
1562
|
+
help='Azure client secret (required if cloud_provider is azure)'
|
|
1563
|
+
)
|
|
1564
|
+
|
|
1565
|
+
# Parse arguments
|
|
1566
|
+
args = parser.parse_args()
|
|
1567
|
+
|
|
1568
|
+
# Additional validation
|
|
1569
|
+
errors = []
|
|
1570
|
+
|
|
1571
|
+
# Validate git provider access
|
|
1572
|
+
if args.repo_access_method == 'access_token' and not args.git_provider_access_token:
|
|
1573
|
+
errors.append("--git_provider_access_token is required when repo_access_method is access_token")
|
|
1574
|
+
elif args.repo_access_method == 'deploy_keys':
|
|
1575
|
+
if not all([args.private_key_orchestrator, args.public_key_orchestrator,
|
|
1576
|
+
args.private_key_data_model, args.public_key_data_model]):
|
|
1577
|
+
errors.append("All SSH keys are required when repo_access_method is deploy_keys")
|
|
1578
|
+
|
|
1579
|
+
# Validate cloud provider requirements
|
|
1580
|
+
if args.cloud_provider:
|
|
1581
|
+
if args.cloud_provider not in ['gcp', 'aws', 'azure', 'self-managed']:
|
|
1582
|
+
errors.append("cloud_provider must be one of: gcp, aws, azure, self-managed")
|
|
1583
|
+
|
|
1584
|
+
# GCP specific validation
|
|
1585
|
+
if args.cloud_provider == 'gcp':
|
|
1586
|
+
if not args.project_id:
|
|
1587
|
+
errors.append("project_id is required when cloud_provider is gcp")
|
|
1588
|
+
if not args.project_region:
|
|
1589
|
+
errors.append("project_region is required when cloud_provider is gcp")
|
|
1590
|
+
|
|
1591
|
+
project_id = args.project_id
|
|
1592
|
+
if project_id and not re.match(r'^[a-z][-a-z0-9]{4,28}[a-z0-9]$', project_id):
|
|
1593
|
+
errors.append("GCP project_id must be 6-30 characters, lowercase letters, numbers, or hyphens")
|
|
1594
|
+
|
|
1595
|
+
# AWS specific validation
|
|
1596
|
+
elif args.cloud_provider == 'aws':
|
|
1597
|
+
if not args.aws_access_key_id:
|
|
1598
|
+
errors.append("aws_access_key_id is required when cloud_provider is aws")
|
|
1599
|
+
if not args.aws_secret_access_key:
|
|
1600
|
+
errors.append("aws_secret_access_key is required when cloud_provider is aws")
|
|
1601
|
+
if not args.aws_region:
|
|
1602
|
+
errors.append("aws_region is required when cloud_provider is aws")
|
|
1603
|
+
|
|
1604
|
+
# Azure specific validation
|
|
1605
|
+
elif args.cloud_provider == 'azure':
|
|
1606
|
+
if not args.azure_client_id:
|
|
1607
|
+
errors.append("azure_client_id is required when cloud_provider is azure")
|
|
1608
|
+
if not args.azure_client_secret:
|
|
1609
|
+
errors.append("azure_client_secret is required when cloud_provider is azure")
|
|
1610
|
+
|
|
1611
|
+
# Validate SMTP configuration
|
|
1612
|
+
smtp_fields = [args.smtp_host, args.smtp_port, args.smtp_username, args.smtp_password]
|
|
1613
|
+
if any(smtp_fields) and not all(smtp_fields):
|
|
1614
|
+
errors.append("All SMTP fields (host, port, username, password) are required when any SMTP field is provided")
|
|
1615
|
+
|
|
1616
|
+
# Validate BigQuery configuration
|
|
1617
|
+
if args.data_warehouse_platform == 'bigquery':
|
|
1618
|
+
if not args.data_platform_sa_json:
|
|
1619
|
+
errors.append("--data_platform_sa_json is required when data_warehouse_platform is bigquery")
|
|
1620
|
+
if not args.data_analysis_sa_json:
|
|
1621
|
+
errors.append("--data_analysis_sa_json is required when data_warehouse_platform is bigquery")
|
|
1622
|
+
|
|
1623
|
+
if errors:
|
|
1624
|
+
parser.error("\n".join(errors))
|
|
1625
|
+
|
|
1626
|
+
try:
|
|
1627
|
+
# Create manager instance using the CLI factory method
|
|
1628
|
+
manager = CustomerSecretManager.from_cli_args(args)
|
|
1629
|
+
results = manager.run()
|
|
1630
|
+
print("Execution Results:")
|
|
1631
|
+
print(json.dumps(results, indent=2))
|
|
1632
|
+
except Exception as e:
|
|
1633
|
+
print("An error occurred during execution:")
|
|
1634
|
+
print(str(e))
|
|
1635
|
+
sys.exit(1)
|