From 5dcc5661096b259641131c001c39ad24566e94f3 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Mon, 23 Feb 2026 17:34:07 +0000 Subject: [PATCH 1/7] added ingressClassName support --- .gitignore | 5 +++ .python-version | 1 + pyproject.toml | 7 ++++ templates/ingress.yaml | 9 +++++ tests/chart/test_ingress.py | 77 +++++++++++++++++++++++++++++++++++++ values.yaml | 3 ++ 6 files changed, 102 insertions(+) create mode 100644 .python-version diff --git a/.gitignore b/.gitignore index 0bdda296e..43bd9402c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,8 @@ letsencrypt* repo_state.log repository test*.yaml + +# Python packaging metadata +*.egg-info/ +build/ +dist/ diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..95ed564f8 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.14.2 diff --git a/pyproject.toml b/pyproject.toml index 2109a49b5..bfacb3d7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,8 @@ # https://www.python.org/dev/peps/pep-0518/#file-format +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + [project] name = "airflow-chart-dev-env" description = "astronomer airflow-chart development environment" @@ -26,6 +30,9 @@ dependencies = [ "yamllint>=1.37.1", ] +[tool.setuptools] +packages = [] + # https://docs.astral.sh/ruff/settings/ [tool.ruff] line-length = 132 diff --git a/templates/ingress.yaml b/templates/ingress.yaml index c8b3f1df6..bb89fb12d 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -31,6 +31,9 @@ metadata: {{- end }} {{- end }} spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} tls: - secretName: {{ .Values.ingress.tlsSecretName | default "~" }} hosts: @@ -117,6 +120,9 @@ metadata: {{- end }} {{- end }} spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} tls: - secretName: {{ .Values.ingress.tlsSecretName | default "~" }} hosts: @@ -189,6 +195,9 @@ metadata: {{- end }} {{- end }} spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} tls: - secretName: {{ .Values.ingress.tlsSecretName | default "~" }} hosts: diff --git a/tests/chart/test_ingress.py b/tests/chart/test_ingress.py index b5bf517b0..0020bcd87 100644 --- a/tests/chart/test_ingress.py +++ b/tests/chart/test_ingress.py @@ -131,3 +131,80 @@ def test_airflow_ingress_with_dag_server_ingress_annotation_and_tls_secret(self, assert ingressAnnotations == docs[1]["metadata"]["annotations"] assert docs[1]["spec"]["tls"][0]["secretName"] == tls_secret_name + + def test_airflow_ingress_class_name(self, kube_version): + """Test airflow ingress with ingressClassName.""" + docs = render_chart( + kube_version=kube_version, + show_only="templates/ingress.yaml", + values={ + "ingress": { + "enabled": True, + "baseDomain": "example.com", + "ingressClassName": "nginx", + } + }, + ) + assert len(docs) == 1 + doc = docs[0] + assert "Ingress" == doc["kind"] + assert "nginx" == doc["spec"]["ingressClassName"] + + def test_airflow_ingress_class_name_with_celery_executor(self, kube_version): + """Test airflow and flower ingress with ingressClassName and CeleryExecutor.""" + docs = render_chart( + kube_version=kube_version, + show_only="templates/ingress.yaml", + values={ + "airflow": {"executor": "CeleryExecutor"}, + "ingress": { + "enabled": True, + "baseDomain": "example.com", + "ingressClassName": "nginx-internal", + }, + }, + ) + assert len(docs) == 2 + + # Airflow ingress + assert "Ingress" == docs[0]["kind"] + assert "nginx-internal" == docs[0]["spec"]["ingressClassName"] + + # Flower ingress + assert "Ingress" == docs[1]["kind"] + assert "nginx-internal" == docs[1]["spec"]["ingressClassName"] + + def test_airflow_ingress_class_name_with_dag_server(self, kube_version): + """Test dag server ingress with ingressClassName.""" + docs = render_chart( + kube_version=kube_version, + show_only="templates/ingress.yaml", + values={ + "ingress": { + "baseDomain": "example.com", + "ingressClassName": "custom-ingress", + }, + "dagDeploy": {"enabled": True}, + }, + ) + + assert len(docs) == 1 + assert docs[0]["metadata"]["name"] == "release-name-dag-server-ingress" + assert "custom-ingress" == docs[0]["spec"]["ingressClassName"] + + def test_airflow_ingress_class_name_not_set(self, kube_version): + """Test airflow ingress without ingressClassName (default behavior).""" + docs = render_chart( + kube_version=kube_version, + show_only="templates/ingress.yaml", + values={ + "ingress": { + "enabled": True, + "baseDomain": "example.com", + } + }, + ) + assert len(docs) == 1 + doc = docs[0] + assert "Ingress" == doc["kind"] + assert "ingressClassName" not in doc["spec"] diff --git a/values.yaml b/values.yaml index f3faaecf5..d9d50bd6e 100644 --- a/values.yaml +++ b/values.yaml @@ -590,6 +590,9 @@ ingress: # Enable ingress resource enabled: false + # Enables using a specific ingress class for the deployment. If not set, will default to the cluster default. + ingressClassName: ~ + # Enable for cert-manager or kube-lego acme: false From 2d1fb673a7a15f035271956b7972126f52048613 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Mon, 23 Feb 2026 18:26:12 +0000 Subject: [PATCH 2/7] formatting --- tests/chart/test_ingress.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/chart/test_ingress.py b/tests/chart/test_ingress.py index 0020bcd87..710917fac 100644 --- a/tests/chart/test_ingress.py +++ b/tests/chart/test_ingress.py @@ -165,11 +165,11 @@ def test_airflow_ingress_class_name_with_celery_executor(self, kube_version): }, ) assert len(docs) == 2 - + # Airflow ingress assert "Ingress" == docs[0]["kind"] assert "nginx-internal" == docs[0]["spec"]["ingressClassName"] - + # Flower ingress assert "Ingress" == docs[1]["kind"] assert "nginx-internal" == docs[1]["spec"]["ingressClassName"] @@ -187,7 +187,7 @@ def test_airflow_ingress_class_name_with_dag_server(self, kube_version): "dagDeploy": {"enabled": True}, }, ) - + assert len(docs) == 1 assert docs[0]["metadata"]["name"] == "release-name-dag-server-ingress" assert "custom-ingress" == docs[0]["spec"]["ingressClassName"] From 56e12c9570d1a79a2eeab4ae831f5e74d68bbebb Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Mon, 23 Feb 2026 19:07:02 +0000 Subject: [PATCH 3/7] formatting --- .circleci/config.yml | 10 +++++----- .gitignore | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac473a913..bb7d223a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -172,7 +172,7 @@ jobs: run_pre_commit: resource_class: small docker: - - image: quay.io/astronomer/ci-pre-commit:2026-02 + - image: quay.io/astronomer/ci-pre-commit:2026-03 steps: - checkout - run: @@ -207,7 +207,7 @@ jobs: unittest-charts: docker: - - image: quay.io/astronomer/ci-helm-release:2026-02 + - image: quay.io/astronomer/ci-helm-release:2026-03 parallelism: 8 steps: - setup_remote_docker: @@ -226,7 +226,7 @@ jobs: build-and-release-internal: docker: - - image: quay.io/astronomer/ci-helm-release:2026-02 + - image: quay.io/astronomer/ci-helm-release:2026-03 steps: - checkout - run: @@ -267,7 +267,7 @@ jobs: path: test-results release-internal: docker: - - image: quay.io/astronomer/ci-helm-release:2026-02 + - image: quay.io/astronomer/ci-helm-release:2026-03 steps: - checkout - run: @@ -276,7 +276,7 @@ jobs: release-public: docker: - - image: quay.io/astronomer/ci-helm-release:2026-02 + - image: quay.io/astronomer/ci-helm-release:2026-03 steps: - checkout - publish-github-release diff --git a/.gitignore b/.gitignore index 43bd9402c..b32c22ca0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ **kubeconfig** **pycache** +*.egg-info/ *.swp *.tgz .DS_Store @@ -10,16 +11,13 @@ /secrets /test-results backup +build/ certs charts dev-account.json +dist/ kubeconfig letsencrypt* repo_state.log repository test*.yaml - -# Python packaging metadata -*.egg-info/ -build/ -dist/ From d80fc8314b2dd81162e5bfcda87e3d6f86ba3720 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Tue, 3 Mar 2026 15:14:01 +0000 Subject: [PATCH 4/7] install uv to fix airflow-test failing --- bin/install-ci-tools | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/install-ci-tools b/bin/install-ci-tools index f8b89bb3a..211b1425c 100755 --- a/bin/install-ci-tools +++ b/bin/install-ci-tools @@ -3,6 +3,7 @@ set -e KIND_VERSION="0.31.0" # https://github.com/kubernetes-sigs/kind/releases HELM_VERSION="3.20.0" # https://github.com/helm/helm/releases +UV_VERSION="0.10.7" # https://github.com/astral-sh/uv/releases # Determine the platform we are running on OS=$(uname | tr '[:upper:]' '[:lower:]') @@ -46,4 +47,11 @@ else chmod +x ./kubectl fi +echo "Installing uv version ${UV_VERSION}..." +if [[ -f /tmp/bin/uv ]]; then + echo "Already installed in /tmp/bin. Skipping!" +else + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh +fi + cd "$CURRENT_DIR" From 1f2e0919bec65f3bad0926f31f497c6147064c89 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Tue, 3 Mar 2026 15:27:34 +0000 Subject: [PATCH 5/7] move uv to the right path --- bin/install-ci-tools | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/install-ci-tools b/bin/install-ci-tools index 211b1425c..0a3b3ebca 100755 --- a/bin/install-ci-tools +++ b/bin/install-ci-tools @@ -52,6 +52,7 @@ if [[ -f /tmp/bin/uv ]]; then echo "Already installed in /tmp/bin. Skipping!" else curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh + mv "$HOME/.local/bin/uv" /tmp/bin/ fi cd "$CURRENT_DIR" From 89614f893307883b8a6f6f133eabc6faf1df8bf4 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Wed, 4 Mar 2026 13:48:11 +0000 Subject: [PATCH 6/7] revert pyproject.toml changes and added local development workflow howto --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 7 ----- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 23720b60a..3dc906baa 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,76 @@ extraObjects: restartPolicy: OnFailure ``` +## Local Development + +### Prerequisites + +- **[uv](https://docs.astral.sh/uv/)**: Fast Python package installer and resolver +- **Docker**: Required for running Kubernetes in Docker (kind) during local testing +- **helm**: Required for chart dependencies and templating + +### Setting Up Your Development Environment + +1. Install uv and python + +```bash +# Install uv (if not already installed) +curl -LsSf https://astral.sh/uv/install.sh | sh + +# Install the Python version specified in .python-version +uv python install +``` + +2. Create and activate a virtual environment: + +```bash +uv venv +source .venv/bin/activate +``` + +3. Install dependencies: + +```bash +uv sync +``` + +4. Install pre-commit hooks: + +```bash +pre-commit install +``` + +5. Update Helm chart dependencies: + +```bash +helm dep update +``` + +### Running Tests + +The project uses `pytest` for testing the Helm chart. Tests are located in the `tests/` directory. + +#### Run pytests: + +```bash + +# Run specific test file +pytest tests/chart/test_ingress.py + +# Run tests matching a pattern +pytest "tests/chart/test_ingress.py::TestIngress::test_airflow_ingress_class_name_with_dag_server[1.31.0]" +``` + +#### Run pre-commit hooks manually: + +```bash +# Run on all files +pre-commit run --all-files + +# Run specific hook +pre-commit run ruff-check --all-files +``` + ## Contributing Check out [our contributing guide!](CONTRIBUTING.md) diff --git a/pyproject.toml b/pyproject.toml index bfacb3d7e..2109a49b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,4 @@ # https://www.python.org/dev/peps/pep-0518/#file-format -[build-system] -requires = ["setuptools>=61.0", "wheel"] -build-backend = "setuptools.build_meta" - [project] name = "airflow-chart-dev-env" description = "astronomer airflow-chart development environment" @@ -30,9 +26,6 @@ dependencies = [ "yamllint>=1.37.1", ] -[tool.setuptools] -packages = [] - # https://docs.astral.sh/ruff/settings/ [tool.ruff] line-length = 132 From 5bc20e0f07698d697db48f54cdb6f7561b605915 Mon Sep 17 00:00:00 2001 From: Stefan Raducan Date: Wed, 4 Mar 2026 13:49:53 +0000 Subject: [PATCH 7/7] revert gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index b32c22ca0..0bdda296e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ **kubeconfig** **pycache** -*.egg-info/ *.swp *.tgz .DS_Store @@ -11,11 +10,9 @@ /secrets /test-results backup -build/ certs charts dev-account.json -dist/ kubeconfig letsencrypt* repo_state.log