[PSM Interop] Ignore DeprecationWarning: HTTPResponse.getheaders() (#34018)

Disables the warning produced by kubernetes/client/rest.py calling the
deprecated `urllib3.response.HTTPResponse.getheaders`,
`urllib3.response.HTTPResponse.getheader` methods:

```
venv-test/lib/python3.9/site-packages/kubernetes/client/rest.py:44: DeprecationWarning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
  return self.urllib3_response.getheaders()
```

This issue introduced by openapi-generator, and solved in `v6.4.0`. To
fix the issue properly, kubernetes/python folks need to regenerate the
library using newer openapi-generator. The most recent release `v27.2.0`
still used openapi-generator
[`v4.3.0`](https://github.com/kubernetes-client/python/blob/v27.2.0/kubernetes/.openapi-generator/VERSION).
Since they release two times a year, and the 2 major version difference
of openapi-generator, the fix may take a while.

Created an issue in their repo:
https://github.com/kubernetes-client/python/issues/2101.
pull/34050/head
Sergii Tkachenko 1 year ago committed by GitHub
parent bd343fd51d
commit 912cb59be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/k8s.py

@ -20,6 +20,7 @@ import logging
import pathlib
import threading
from typing import Any, Callable, List, Optional, Tuple
import warnings
from kubernetes import client
from kubernetes import utils
@ -105,6 +106,17 @@ class KubernetesApiManager:
self.apps = client.AppsV1Api(self.client)
self.core = client.CoreV1Api(self.client)
self._apis = {self.apps, self.core}
# TODO(https://github.com/kubernetes-client/python/issues/2101): remove
# when the issue is solved, and the kubernetes dependency is bumped.
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
module="kubernetes",
message=(
"HTTPResponse.getheaders?\\(\\) is deprecated"
" and will be removed in urllib3 v2.1.0."
),
)
@property
def client(self) -> ApiClient:

Loading…
Cancel
Save