Skip to content
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

[AIRFLOW-4008] add envFrom for Kubernetes Executor #4952

Merged

Conversation

davlum
Copy link
Contributor

@davlum davlum commented Mar 20, 2019

Make sure you have checked all steps below.

Jira

Description

  • Here are some details about my PR, including screenshots of any UI changes:

This PR enables workers brought up by the KubernetesExecutor to use the envFrom feature to set environment variables.

Tests

  • My PR adds the following unit tests.

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Code Quality

  • Passes flake8

@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch 3 times, most recently from 678fbd1 to cdbf418 Compare March 20, 2019 18:56
@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch from cdbf418 to 3e7caf1 Compare March 20, 2019 19:46
Copy link
Contributor

@dimberman dimberman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on this feature. Could you please add an integration test?

@ashb ashb added the k8s label Mar 21, 2019
@ashb
Copy link
Member

ashb commented Mar 21, 2019

Please prefix your commits with [AIRFLOW-4008]

There is some overlap between this PR and #4772 - can you and @galuszkak work out how do get both these in without duplicating code/what makes sense where etc.

Copy link
Contributor

@galuszkak galuszkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback to align this with #4772 . I'm working on my PR for 3 weeks already, there was a lot of code reviews there, so hopefully, this can help catch changes that I made because of different requests in CR.

airflow/contrib/kubernetes/worker_configuration.py Outdated Show resolved Hide resolved
self.kube_env_from_configmap_ref = configuration.get(self.kubernetes_section,
'env_from_configmap_ref')
self.kube_env_from_secret_ref = configuration.get(self.kubernetes_section,
'env_from_secret_ref')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with #4772 I would suggest using self.kube_secrets and add self.kube_configmaps .

@davlum davlum changed the title feat/AIRFLOW-4008/k8s-executor-env-from [AIRFLOW-4008] add envFrom for Kubernetes Executor Mar 21, 2019
@davlum
Copy link
Contributor Author

davlum commented Mar 21, 2019

I think the simplest move here would be to get @galuszkak's PR merged first, and I can just work off the changes that make it into master. It's true that the PodRequestFactory was previously entirely untested, so I can see why @galuszkak is reluctant to have that responsibility dumped onto #4772. However, unittesting PodRequestFactory is something I've started doing in this PR and could make more comprehensive. If #4772 gets merged I can add the unittests, timeline being ideally before the end of the week. @ashb Would it be possible to get this in before 1.10.3?

Copy link
Member

@XD-DENG XD-DENG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring style change is needed.

airflow/contrib/kubernetes/pod.py Outdated Show resolved Hide resolved
@galuszkak
Copy link
Contributor

@davlum my changes were merged, so I believe You can start working back on this PR.

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review (on mobile)

Nice improvement to the tests.

I wonder if we can reduce code in tests some how - want to look at that on a bigger screen

@davlum
Copy link
Contributor Author

davlum commented Mar 28, 2019

Let me know if you think some of the tests are redundant. I just refactored the Secrets object to be a bit more intuitive. I find optionally setting attributes of an object to be very difficult to reason about.

@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch 2 times, most recently from ac451a5 to 665bbc0 Compare March 28, 2019 19:36
@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch from 665bbc0 to 93384db Compare March 29, 2019 15:35
@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch 2 times, most recently from 1026bac to 4c590ba Compare March 29, 2019 19:43
@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch 7 times, most recently from b6b10e4 to 9191d80 Compare March 31, 2019 02:28
@codecov-io
Copy link

codecov-io commented Mar 31, 2019

Codecov Report

Merging #4952 into master will increase coverage by 0.11%.
The diff coverage is 95.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4952      +/-   ##
==========================================
+ Coverage   75.99%   76.11%   +0.11%     
==========================================
  Files         461      461              
  Lines       29968    29979      +11     
==========================================
+ Hits        22774    22818      +44     
+ Misses       7194     7161      -33
Impacted Files Coverage Δ
airflow/contrib/kubernetes/pod.py 100% <ø> (ø) ⬆️
...etes_request_factory/kubernetes_request_factory.py 99.03% <100%> (+26.92%) ⬆️
airflow/contrib/kubernetes/worker_configuration.py 95.72% <100%> (+2.09%) ⬆️
airflow/contrib/executors/kubernetes_executor.py 63.17% <100%> (+0.2%) ⬆️
airflow/contrib/kubernetes/secret.py 93.33% <88.88%> (+24.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8751133...6e0068f. Read the comment docs.

@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch from 9191d80 to 5a7b0aa Compare March 31, 2019 14:21
@davlum davlum force-pushed the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch from 5a7b0aa to 6e0068f Compare April 1, 2019 18:13
@dimberman
Copy link
Contributor

@ashb @XD-DENG this LGTM, do you guys have any remaining issues? If not I can merge.

@XD-DENG
Copy link
Member

XD-DENG commented Apr 2, 2019

Thanks @dimberman . No other comment/issue to me.

@ashb ashb merged commit e72ff0a into apache:master Apr 3, 2019
cthenderson pushed a commit to cthenderson/apache-airflow that referenced this pull request Apr 16, 2019
andriisoldatenko pushed a commit to andriisoldatenko/airflow that referenced this pull request Jul 26, 2019
wmorris75 pushed a commit to modmed/incubator-airflow that referenced this pull request Jul 29, 2019
@davlum davlum deleted the feat/AIRFLOW-4008/k8s-exec-envfrom-configmap branch October 3, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants