Repository: apache/airflow
File: dev/breeze/src/airflow_breeze/commands/kubernetes_commands.py (Python)

Code before:
            "local": {"push": False},
        },
        "deploy": {
            "helm": {
                "releases": [
                    {
                        "name": "airflow",
                        "chartPath": CHART_PATH.as_posix(),
                        "namespace": HELM_AIRFLOW_NAMESPACE,
                        "createNamespace": True,
                        "skipBuildDependencies": True,
                        # Let Skaffold inject the resolved image instead of hardcoding as `latest` here
                        "setValueTemplates": {
                            "defaultAirflowRepository": f"{{{{.IMAGE_REPO_{image_var_suffix}}}}}",
                            "defaultAirflowTag": f"{{{{.IMAGE_TAG_{image_var_suffix}}}}}",
                            "images.airflow.repository": f"{{{{.IMAGE_REPO_{image_var_suffix}}}}}",
                            "images.airflow.tag": f"{{{{.IMAGE_TAG_{image_var_suffix}}}}}",
                        },
                        "setValues": set_values,
                    }
                ],
                # include test sources (the `breeze k8s configure-cluster` command ) like nodeport for apiServer, volume for Dag, etc
                # https://skaffold.dev/docs/references/yaml/?version=v4beta13#deploy-kubectl
                "hooks": {
                    "before": [
                        {
                            "host": {
                                "command": [
                                    "kubectl",
                                    "apply",
                                    "-f",
                                    "volumes.yaml",
                                    "--namespace",
                                    HELM_DEFAULT_NAMESPACE,
                                ],
                                "dir": (AIRFLOW_ROOT_PATH / "scripts" / "ci" / "kubernetes").as_posix(),
                            }
                        },
                        {
                            "host": {
                                "command": [
                                    "kubectl",
                                    "apply",
                                    "-f",
                                    "nodeport.yaml",
                                    "--namespace",
                                    HELM_AIRFLOW_NAMESPACE,
                                ],
                                "dir": (AIRFLOW_ROOT_PATH / "scripts" / "ci" / "kubernetes").as_posix(),
                            }
                        },

Review comment (suggestion):
The hooks for deploying test resource (`nodeport.yaml`, `volume.yaml` in `scripts/ci/kubernetes` should be placed under `after` rather than `beforce`. Since the `airflow` namespace might not be exist before running `helm install`.

Code after:
            ],
            "local": {"push": False},
        },
        "deploy": {
            "helm": {
                "releases": [
                    {
                        "name": "airflow",
                        "chartPath": CHART_PATH.as_posix(),
                        "namespace": HELM_AIRFLOW_NAMESPACE,
                        "createNamespace": True,
                        "skipBuildDependencies": True,
                        # Let Skaffold inject the resolved image instead of hardcoding as `latest` here
                        "setValueTemplates": {
                            "defaultAirflowRepository": f"{{{{.IMAGE_REPO_{image_var_suffix}}}}}",
                            "defaultAirflowTag": f"{{{{.IMAGE_TAG_{image_var_suffix}}}}}",
                            "images.airflow.repository": f"{{{{.IMAGE_REPO_{image_var_suffix}}}}}",
                            "images.airflow.tag": f"{{{{.IMAGE_TAG_{image_var_suffix}}}}}",
                        },
                        "setValues": set_values,
                    }
                ],
                # include test sources (the `breeze k8s configure-cluster` command ) like nodeport for apiServer, volume for Dag, etc
                # https://skaffold.dev/docs/references/yaml/?version=v4beta13#deploy-kubectl
                "hooks": {
                    "after": [
                        {
                            "host": {
                                "command": [
                                    "kubectl",
                                    "apply",
                                    "-f",
                                    "volumes.yaml",
                                    "--namespace",
                                    HELM_DEFAULT_NAMESPACE,
                                ],
                                "dir": (AIRFLOW_ROOT_PATH / "scripts" / "ci" / "kubernetes").as_posix(),
                            }
                        },
                        {
                            "host": {
                                "command": [
                                    "kubectl",
                                    "apply",
                                    "-f",
                                    "nodeport.yaml",
                                    "--namespace",
                                    HELM_AIRFLOW_NAMESPACE,
                                ],
                                "dir": (AIRFLOW_ROOT_PATH / "scripts" / "ci" / "kubernetes").as_posix(),
                            }