Skip to content

Google Cloud + CNCF Kubernetes OnFinishAction equality test #47601

@miloszszymczak

Description

@miloszszymczak

Apache Airflow Provider(s)

cncf-kubernetes, google

Versions of Apache Airflow Providers

I guess you can take the latest ones, should be reproducible there, but definitely those included in official Docker image for 2.10.5.

Apache Airflow version

2.10.5

Operating System

Linux

Deployment

Other Docker-based deployment

Deployment details

Using official Docker image in k8s (issue is related to usage of GKEStartPodOperator)

What happened

Starting at this line

a new approach to pod deletion is utilized so we are on par with CNCF k8s package enum OnFinishAction. Unfortunately the values set there don't compare with the values withing CNCF k8s package (maybe it's because differences in imports) resulting in failing equality tests here
should_delete_pod = (self.on_finish_action == OnFinishAction.DELETE_POD) or (

What you think should happen instead

I guess another way to compare the enums could be used here so the pods are deleted if operator is properly configured.

How to reproduce

Use GKEStartPodOperator to run a job in k8s environment with on_finish_action='DELETE_POD' - the pod will be kept with message "Skipping deleting pod" instead of deletion.

Anything else

I changed the equality test to (str(self.on_finish_action) == str(OnFinishAction.DELETE_POD)) and it worked properly although it's not the best way to fix it. Looks like the property self.on_finish_action is of type str and cannot be directly compared to enum.

Skipping deleting pod

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:providerskind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yetprovider:cncf-kubernetesKubernetes (k8s) provider related issuesprovider:googleGoogle (including GCP) related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions