Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions tests/templates/kuttl/ca-cert/90-cleanup-executor-pods.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster --all -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
32 changes: 32 additions & 0 deletions tests/templates/kuttl/commons/cleanup-executor-pods.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env sh
# Shared teardown for KubernetesExecutor tests: force-deletes leftover DAG task pods so
# that kuttl can delete the namespace within its timeout. Their Vector sidecar ignores
# SIGTERM (it is not PID 1) and would linger for the full 300s grace period.
# The proper fix is in operator-rs (making Vector PID 1 via exec).

# With --skip-delete the namespace is kept for debugging, so this must not run. kuttl does
# not expose the flag to test steps, hence looking for it in the argv of the kuttl ancestor.
pid=$(ps -o ppid= -p "$$" 2>/dev/null | tr -d '[:space:]')
while [ "${pid:-0}" -ge 1 ]; do
args=$(ps -o args= -p "$pid" 2>/dev/null)
case "$args" in
*kuttl*)
case "$args" in
*--skip-delete*)
echo "kuttl was started with --skip-delete, keeping the AirflowCluster"
exit 0
;;
esac
;;
esac
pid=$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d '[:space:]')
done

# shellcheck disable=SC2154 # NAMESPACE is set by kuttl for test-step commands
kubectl delete airflowcluster --all -n "$NAMESPACE" --wait=false 2>/dev/null || true

if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n "$NAMESPACE" --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n "$NAMESPACE" --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n "$NAMESPACE" --timeout=300s
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
16 changes: 3 additions & 13 deletions tests/templates/kuttl/ldap/99-cleanup-executor-pods.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
16 changes: 3 additions & 13 deletions tests/templates/kuttl/logging/90-cleanup-executor-pods.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
16 changes: 3 additions & 13 deletions tests/templates/kuttl/oidc/90-cleanup-executor-pods.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
16 changes: 3 additions & 13 deletions tests/templates/kuttl/opa/90-cleanup-executor-pods.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
16 changes: 3 additions & 13 deletions tests/templates/kuttl/overrides/90-cleanup-executor-pods.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster --all -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
21 changes: 3 additions & 18 deletions tests/templates/kuttl/smoke/90-cleanup-executor-pods.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
#
# FIXME: This step also runs when kuttl is called with --skip-delete, so the
# AirflowCluster is torn down even though the namespace is kept for debugging.
# kuttl does not expose --skip-delete to test steps, so there is no clean way to
# guard against it from here.
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
16 changes: 3 additions & 13 deletions tests/templates/kuttl/triggerer/90-cleanup-executor-pods.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{% if test_scenario['values']['executor'] == 'kubernetes' %}
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
{% endif %}
16 changes: 3 additions & 13 deletions tests/templates/kuttl/versioning/90-cleanup-executor-pods.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
# Force-delete KubernetesExecutor DAG task pods before kuttl deletes the namespace.
# Their Vector sidecar does not respond to SIGTERM (it is not PID 1), so these pods
# sit in Terminating for the full terminationGracePeriodSeconds (300s), blocking
# namespace deletion past kuttl's timeout.
# The proper fix is in operator-rs (making Vector PID 1 via exec).
# Force-delete leftover KubernetesExecutor DAG task pods so that kuttl can delete the
# namespace within its timeout. See the script for the details.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 600
commands:
- script: |
kubectl delete airflowcluster airflow -n $NAMESPACE --wait=false 2>/dev/null || true
- script: |
if kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=120s 2>/dev/null; then
exit 0
fi
kubectl delete pods -l app.kubernetes.io/name=airflow -n $NAMESPACE --grace-period=0 --force 2>/dev/null || true
kubectl wait --for=delete pod -l app.kubernetes.io/name=airflow -n $NAMESPACE --timeout=300s
- script: sh ../../../../templates/kuttl/commons/cleanup-executor-pods.sh
Loading