-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Add config and context params to KubernetesHook #19695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
13d72de to
5c79084
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that merger and loader were backwards in some of these tests
f6ddbd0 to
4898392
Compare
This is mainly needed in order to enable use KubernetesHook with KubernetesPodOperator while maintaining backw ard compatibility.
4898392 to
0c9da50
Compare
|
Do you stll need feedback on it @dstandish ? |
Yes please, it's ready for review if you have the time. It's a stepping stone towards adding k8s hook to k8s pod op |
|
Tomorrow morning :) |
Do any other hooks have this behavior? I wonder if KPO should handle backwards compat instead? |
Well, SubprocessHook doesn't even take a connection id, and postgres and mysql will allow you to not supply a connection id but supply an actual Connection object instead. To me it seems pretty reasonable because it's a situation where it would be very normal to not need a connection (cus you're in the cluster e.g.) but want to use the hook methods etc. It's not really about backwards compat in my view but making it flexible to use the hook without having defined a connection. |
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
|
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
This refactor has the following goals:
* a simpler, easier-to-follow execute method; less logic and more readable method calls
* remove reliance on mutation of pod and namespace instance attributes
- the `self.pod` attribute is no longer referenced or mutated anywhere outside of `execute`
- the only reason we need the `pod` attribute at all is for `on_kill`
* reduce code duplication
* improve method names for greater transparency
allow usage of kubernetes hook (waiting on Add config and context params to KubernetesHook apache#19695 before implementing)
Here we add a few params to KubernetesHook
We also make it optional to use an airflow connection. In order to use k8s hook with k8s pod op, we need connection to be optional because up to now k8s pod operator does not use airflow connection.
For the new hook params, I parameterized the relevant tests and added a lot of cases in order to verify search path (hook param beats conn extra)
The principal motivator here is enabling the use of KubernetesHook with KubernetesPodOperator while maintaining backward compatibility.