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 #11219

Merged
merged 10 commits into from
Oct 23, 2020
Prev Previous commit
Next Next commit
[AIRFLOW-5117] Fixed Bug with ISO-8601 Timestamps
  • Loading branch information
Marian Cepok committed Oct 1, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0e6c534c3c59ece3dcbac19ad57e9ec10e6fbee1
11 changes: 3 additions & 8 deletions airflow/kubernetes/refresh_config.py
Original file line number Diff line number Diff line change
@@ -24,22 +24,17 @@
import logging
import os
import time
from datetime import datetime
from typing import Optional

import pendulum
import yaml
from kubernetes.client import Configuration
from kubernetes.config.exec_provider import ExecProvider
from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION, KubeConfigLoader


def _parse_timestamp(ts_str: str) -> int:
if ts_str[-1] == 'Z':
ts_str = ts_str[:-1] + '+0000'
expire_ts = calendar.timegm(
datetime.strptime(ts_str, "%Y-%m-%dT%H:%M:%S%z").timetuple()
)
return expire_ts
def _parse_timestamp(ts_str: str) -> time.struct_time:
return calendar.timegm(pendulum.parse(ts_str).timetuple())


class RefreshKubeConfigLoader(KubeConfigLoader):