KubernetesExecutor: Use user-provided namespace from executor_config arg#24342
Conversation
|
Hi, I also encountered this bug. For now, I overcome it with pod_hook. From what I see, at the start of the construct_pod (line 339) we check for the image in pod_override_object and use it in kube_image. I see the problem that after this PR users of airflow can overwrite some important annotations/labels which airflow use to operate and this will break executor work. My suggestion is:
After this change, we will have two dynamic pods: one with values that we allow users to overwrite and another with values that should not be overwritten by users. |
@vanchaxy can you clarify your concern, perhaps with an example? This approach seems reasonable to me. |
@dstandish after this change the task like this will never work: It's now only about Also, regardless of implementation, this part of the function should be removed as it's no longer needed. |
|
OK thanks for that @vanchaxy So I see the issue is we want to protect users from overriding something with |
|
@dstandish no concerns with that, I wrote about this in the first message:
For me personally, solution with two pods just looks prettier/easier to understand than try/except with |
|
great let's see what @lostkamp has to say. given that pretty much everything else in "dynamic_pod" needs to be there, or can be additively merged, i don't really see the need to construct two pods; we can just have these two special case carveouts, which to me seems the simpler approach. though i'm not super strongly opinionated either way. |
|
Hi, |
|
looks like you might've had a rebase mishap @lostkamp |
huh.. i'm not sure what happened, but clicking on "fetch upstream" in this branch resolved it apparently. |
76b7318 to
71412e4
Compare
71412e4 to
0017c7c
Compare
malthe
left a comment
There was a problem hiding this comment.
I agree with @dstandish that this is an easy to understand solution which seems to do the trick just fine.
XD-DENG
left a comment
There was a problem hiding this comment.
Was permission considered? Say if the scheduler pod would have the permission to launch pods in the namespace provided by user? If not, how will this be handled properly?
I did not consider this, because I think it is the user's responsibility to set the correct permissions. Does Airflow do permission checks in case the namespace is not overridden? |
Agreed that it's the user's responsibility to set the correct permissions. But if the user forgot to do that or has made any human error (say typo in namespace name, etc.), how will the error be handled in a way so that it's obvious/friendly to the users? |
|
I don't know, I guess at the moment it won't? But this is a larger issue that also applies to the default configured namespace in airflow.cfg right? So isn't this rather a separate issue / PR? |
dstandish
left a comment
There was a problem hiding this comment.
I'm good with this. It changes behavior, but I think of it as a bug fix not breaking change. cc @ashb @jedcunningham
jedcunningham
left a comment
There was a problem hiding this comment.
I agree, bugfix.
@XD-DENG, we shouldn't need to do anything special for permissions, as it's just another error from the k8s api.
…_config arg (apache#24342)" This reverts commit 1fe07e5.
|
Hello @lostkamp - I needed to revert this one because it caused main failure on Kubernetes tests. Can you please re-opoen this one (re-apply it again on main so that: a) we can see why it did not trigger the tests before (our tests might be a bit too selective and I want to get it fixed) Sorry for that but we needed to unblock other failing PRs |
closes: #22298
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragement file, named
{pr_number}.significant.rst, in newsfragments.