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-6585] Fixed Timestamp bug in RefreshKubeConfigLoader #7153

Closed
wants to merge 4 commits into from
Closed

[AIRFLOW-6585] Fixed Timestamp bug in RefreshKubeConfigLoader #7153

wants to merge 4 commits into from

Conversation

Bruschkov
Copy link

@Bruschkov Bruschkov commented Jan 13, 2020

JIRA

https://issues.apache.org/jira/browse/AIRFLOW-6585

Description

When using the KubernetesPodOperator on an aws kubernetes cluster, the aws-iam-authenticator is used to obtain kubernetes authentication tokens. The aws tokens contain ISO-8601 formatted timestamps, which couldn't be parsed in case of a "Z" (Zulu Time) timezone. This PR fixes this problem by converting the "Z" timezone into a regular "+0000" format.

Upon further review this is only a problem with python version <= 3.6. But that should not keep the issue from being fixed.

@boring-cyborg boring-cyborg bot added the k8s label Jan 13, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 13, 2020

Congratulations on your first Pull Request and welcome to the Apache Airflow community!
If you have any issues or are unsure about any anything please check our
Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)

Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits
    will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory).
    Adding a new operator? Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing
    locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from
    Committers.

Apache Airflow is a community-driven project and together we are making it better 🚀.

In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://apache-airflow-slack.herokuapp.com/

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

I'd still prefer to have a test for that one. This should b e rather easy to add such test.

There is already the tests/kubernetes/test_client.py with two tests and adding a test there would be just great (we need to improve coverage on Kubernetes part and even really small tests like that gradually added help a lot)

Would you be so nice to add it please?

@codecov-io
Copy link

codecov-io commented Jan 13, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@e7bf8ec). Click here to learn what that means.
The diff coverage is 83.33%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #7153   +/-   ##
========================================
  Coverage          ?   85.4%           
========================================
  Files             ?     710           
  Lines             ?   39484           
  Branches          ?       0           
========================================
  Hits              ?   33723           
  Misses            ?    5761           
  Partials          ?       0
Impacted Files Coverage Δ
airflow/kubernetes/refresh_config.py 76.78% <83.33%> (ø)

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 e7bf8ec...ce626e1. Read the comment docs.

@mik-laj mik-laj changed the title [AIRFLOW-5117] Fixed Bug with ISO-8601 Timestamps [AIRFLOW-5117] Fixed Timestamp bug in RefreshKubeConfigLoader Jan 13, 2020
@Bruschkov
Copy link
Author

I'd still prefer to have a test for that one. This should b e rather easy to add such test.

There is already the tests/kubernetes/test_client.py with two tests and adding a test there would be just great (we need to improve coverage on Kubernetes part and even really small tests like that gradually added help a lot)

Would you be so nice to add it please?

Hi, thanks for your quick feedback. Added the test and amended the PR.

@Bruschkov
Copy link
Author

@potiuk

Everything solved and build passes now.

Best regards

@ashb
Copy link
Member

ashb commented Jan 16, 2020

Change looks good now, but as this JIRA was already released we need a new JIRA please. (We use the Fix Version to know what to pull back to our releases, and as AIRFLOW-5117 is already released we would otherwise miss this change when building 1.10.8)

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.

Please create new Jira ticket for this.

@Bruschkov Bruschkov changed the title [AIRFLOW-5117] Fixed Timestamp bug in RefreshKubeConfigLoader [AIRFLOW-6585] Fixed Timestamp bug in RefreshKubeConfigLoader Jan 17, 2020
@Bruschkov Bruschkov requested a review from ashb January 17, 2020 08:12
@Bruschkov
Copy link
Author

@ashb New JIRA created and linked to this PR.

@mik-laj
Copy link
Member

mik-laj commented Feb 2, 2020

Why are these changes being made in this project and not in the Kubernetes library? I can't find the ticket in the library repository.

@Bruschkov
Copy link
Author

Why are these changes being made in this project and not in the Kubernetes library? I can't find the ticket in the library repository.

#5731 (comment)

@kaxil kaxil requested a review from dimberman February 22, 2020 01:10
@stale
Copy link

stale bot commented Apr 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Apr 7, 2020
@@ -32,6 +32,15 @@
from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION, KubeConfigLoader


def _parse_timestamp(ts_str: str) -> int:
if ts_str[-1] == 'Z':
Copy link
Member

Choose a reason for hiding this comment

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

Using pendulum (which we already use) might be a better fix than this.

@stale stale bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Apr 8, 2020
@stale
Copy link

stale bot commented May 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label May 23, 2020
@stale stale bot closed this May 30, 2020
@benjaminsky
Copy link

This is still an issue with EKS and Airflow v1.10.10. This PR fixes it. Can we reopen this PR?

@potiuk potiuk reopened this Jul 19, 2020
@stale stale bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Jul 19, 2020
@potiuk
Copy link
Member

potiuk commented Jul 19, 2020

@benjaminsky -> sure, would you mind picking this up? I think this one neds rebase and there is a change requested. Unnless (@Bruschkov wants to do it).

@stale
Copy link

stale bot commented Sep 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 2, 2020
@stale stale bot closed this Sep 11, 2020
@ramsesrm
Copy link

Hi, this is still an issue on Airflow v1.10.12. Can we reopen the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants