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-3251] KubernetesPodOperator does not use 'image_pull_secrets… #4188

Merged

Conversation

victornoel
Copy link
Contributor

…' argument

Make sure you have checked all steps below.

Jira

Description

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

I have chosen to not modify how image_pull_secrets were handled by KubernetesRequestFactory.extract_image_pull_secrets and so the pod operator takes a str and not a list str.

@ashb
Copy link
Member

ashb commented Nov 14, 2018

Would you be able to add some unit tests to ensure that the values are passed down appropriately?

@victornoel
Copy link
Contributor Author

@ashb yes, but I'm not familiar with the tests of airflow. Where should they reside? In test_kubernetes_pod_operator.py? This looks like integration tests so I'm not sure.

@victornoel
Copy link
Contributor Author

@ashb or I can test that a failure happen when an incorrect image_pull_secrets is used to create a pod (as with service_account_name).

@victornoel victornoel force-pushed the 3251-image-pull-secret-for-kube-operator branch from 9cd4279 to 5377e70 Compare November 14, 2018 17:44
@ashb
Copy link
Member

ashb commented Nov 14, 2018

@victornoel
Copy link
Contributor Author

@ashb for now I've implemented a test that checks that a failure happen if there is an incorrect image_pull_secret, because I have trouble finding what should be mocked exactly to test this.

Sorry I'm not very familiar with python unit testing framework :)

@codecov-io
Copy link

codecov-io commented Nov 14, 2018

Codecov Report

Merging #4188 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4188      +/-   ##
=========================================
+ Coverage   77.69%   77.7%   +<.01%     
=========================================
  Files         199     199              
  Lines       16309   16309              
=========================================
+ Hits        12672   12673       +1     
+ Misses       3637    3636       -1
Impacted Files Coverage Δ
airflow/models.py 92.37% <0%> (+0.04%) ⬆️

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 8668ef8...b7bd02d. Read the comment docs.

startup_timeout_seconds=5,
image_pull_secrets=bad_image_pull_secrets
)
with self.assertRaises(ApiException):
Copy link
Member

Choose a reason for hiding this comment

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

This test alone seems a little bit hard-to-reason about.

Could you do something like assertRaisesRegexp(ApiException, r'invalid pull secrets') (or what ever string indicates the pull secrets are the problem - try to make it not too specific.) And perhaps a comment too so we know what this test was trying to test if it fails in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, anyway this doesn't work apparently, if it is not needed, the pull secret is not used it seems, I will think of another way to test this

@victornoel victornoel force-pushed the 3251-image-pull-secret-for-kube-operator branch from 5377e70 to bbd6801 Compare November 16, 2018 08:07
@victornoel victornoel force-pushed the 3251-image-pull-secret-for-kube-operator branch from bbd6801 to b7bd02d Compare November 16, 2018 08:35
@victornoel
Copy link
Contributor Author

@ashb I have finally added a test using the mock to validate that the pod operator properly set the parameter on the pod.

@ashb ashb merged commit 2b707ab into apache:master Nov 16, 2018
tmiller-msft pushed a commit to cse-airflow/incubator-airflow that referenced this pull request Nov 27, 2018
douglasfraser-cloudreach pushed a commit to douglasfraser-cloudreach/incubator-airflow that referenced this pull request Nov 28, 2018
…gument when creating Pods (apache#4188)

(cherry picked from commit 2b707ab)
kaxil pushed a commit that referenced this pull request Nov 29, 2018
elizabethhalper pushed a commit to cse-airflow/incubator-airflow that referenced this pull request Dec 7, 2018
aliceabe pushed a commit to aliceabe/incubator-airflow that referenced this pull request Jan 3, 2019
kaxil pushed a commit that referenced this pull request Jan 9, 2019
ashb pushed a commit to ashb/airflow that referenced this pull request Jan 10, 2019
cfei18 pushed a commit to cfei18/incubator-airflow that referenced this pull request Jan 23, 2019
wmorris75 pushed a commit to modmed/incubator-airflow that referenced this pull request Jul 29, 2019
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.

None yet

3 participants