paolo-moriello opened a new pull request, #39325:
URL: https://github.com/apache/airflow/pull/39325

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   Closes: [#32718](https://github.com/apache/airflow/issues/32718)
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   The `KubernetesPodOperator` caches the hook and client used to interact with 
K8S. This includes also the `kube config` and related secret auth token. For 
long running jobs, the token may expire during the execution, causing the job 
to fail:
   
   ```
   Traceback (most recent call last):
     [...]
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/airflow/providers/cncf/kubernetes/utils/pod_manager.py",
 line 690, in read_pod
       return self._client.read_namespaced_pod(pod.metadata.name, 
pod.metadata.namespace)
              
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/api/core_v1_api.py",
 line 23483, in read_namespaced_pod
       return self.read_namespaced_pod_with_http_info(name, namespace, 
**kwargs)  # noqa: E501
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/api/core_v1_api.py",
 line 23570, in read_namespaced_pod_with_http_info
       return self.api_client.call_api(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/api_client.py",
 line 348, in call_api
       return self.__call_api(resource_path, method,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/api_client.py",
 line 180, in __call_api
       response_data = self.request(
                       ^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/api_client.py",
 line 373, in request
       return self.rest_client.GET(url,
              ^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/rest.py",
 line 240, in GET
       return self.request("GET", url,
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/kubernetes/client/rest.py",
 line 234, in request
       raise ApiException(http_resp=r)
   kubernetes.client.exceptions.ApiException: (401)
   Reason: Unauthorized
   HTTP response headers: HTTPHeaderDict({'Audit-Id': 
'5262e548-af32-44b3-b9f1-08c4325fb772', 'Cache-Control': 'no-cache, private', 
'Content-Length': '129', 'Content-Type': 'application/json', 'Date': 'Fri, 26 
Apr 2024 01:07:44 GMT', 'Server': 'Skipper'})
   HTTP response body: 
{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}
   ```
   
   This PR builds on top of https://github.com/apache/airflow/pull/32719. 
Before adding more tests, I'd be happy to discuss this or other approaches to 
solve this issue.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to