hussein-awala commented on code in PR #35185:
URL: https://github.com/apache/airflow/pull/35185#discussion_r1403682530
##########
dev/breeze/src/airflow_breeze/commands/kubernetes_commands.py:
##########
@@ -1036,8 +1047,47 @@ def _deploy_airflow(
executor=executor,
use_standard_naming=use_standard_naming,
extra_options=extra_options,
+ multi_namespace_mode=multi_namespace_mode,
)
if result.returncode == 0:
+ if multi_namespace_mode:
+ # duplicate Airflow configmaps, secrets and service accounts to
test namespace
+ run_command_with_k8s_env(
+ f"kubectl get secret -n {HELM_AIRFLOW_NAMESPACE} "
+ "--field-selector type!=helm.sh/release.v1 -o yaml "
+ f"| sed 's/namespace: {HELM_AIRFLOW_NAMESPACE}/namespace:
{TEST_NAMESPACE}/' "
+ f"| kubectl apply -n {TEST_NAMESPACE} -f -",
+ python=python,
+ kubernetes_version=kubernetes_version,
+ output=output,
+ check=False,
+ shell=True,
+ )
+
+ run_command_with_k8s_env(
+ f"kubectl get configmap -n {HELM_AIRFLOW_NAMESPACE} "
+ "--field-selector metadata.name!=kube-root-ca.crt -o yaml "
+ f"| sed 's/namespace: {HELM_AIRFLOW_NAMESPACE}/namespace:
{TEST_NAMESPACE}/' "
+ f"| kubectl apply -n {TEST_NAMESPACE} -f -",
+ python=python,
+ kubernetes_version=kubernetes_version,
+ output=output,
+ check=False,
+ shell=True,
+ )
+
+ run_command_with_k8s_env(
+ f"kubectl get serviceaccount -n {HELM_AIRFLOW_NAMESPACE} "
+ "--field-selector metadata.name!=default -o yaml "
+ f"| sed 's/namespace: {HELM_AIRFLOW_NAMESPACE}/namespace:
{TEST_NAMESPACE}/' "
+ f"| kubectl apply -n {TEST_NAMESPACE} -f -",
+ python=python,
+ kubernetes_version=kubernetes_version,
+ output=output,
+ check=False,
+ shell=True,
+ )
Review Comment:
These commands will duplicate the resources used in pod_template to
test-namespace:
```
secret/airflow-broker-url created
secret/airflow-fernet-key created
secret/airflow-metadata created
secret/airflow-postgresql created
secret/airflow-redis-password created
secret/airflow-webserver-secret-key created
configmap/airflow-config created
configmap/airflow-statsd created
serviceaccount/airflow-create-user-job created
serviceaccount/airflow-migrate-database-job created
serviceaccount/airflow-scheduler created
serviceaccount/airflow-statsd created
serviceaccount/airflow-triggerer created
serviceaccount/airflow-webserver created
serviceaccount/airflow-worker created
```
I excluded the helm secrets/configmaps and the default service account from
the duplication operation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]