Bump k8s client to v25.3.0

Bumping k8s client to v25.3.0
Cronjob batch v1beta1 no longer available in k8s 1.25
Update tox.ini file to be compatible with v4

Change-Id: Iac79c52c97c9ef1223ae8d502da1572ef8d068fa
This commit is contained in:
SPEARS, DUSTIN (ds443n) 2023-01-06 15:37:00 -05:00
parent 379c88d619
commit 099de8aaf4
8 changed files with 28 additions and 37 deletions

View File

@ -28,7 +28,7 @@ package. It is assumed that:
"""
import collections
import collections.abc
import importlib
import os
import pkgutil
@ -38,7 +38,7 @@ IGNORED_MODULES = ('opts', 'constants', 'utils')
def list_opts():
opts = collections.defaultdict(list)
opts = collections.abc.defaultdict(list)
module_names = _list_module_names()
imported_modules = _import_modules(module_names)
_append_config_options(imported_modules, opts)

View File

@ -55,7 +55,6 @@ class K8s(object):
self.client = client.CoreV1Api(api_client)
self.batch_api = client.BatchV1Api(api_client)
self.batch_v1beta1_api = client.BatchV1beta1Api(api_client)
self.custom_objects = client.CustomObjectsApi(api_client)
self.api_extensions = client.ApiextensionsV1Api(api_client)
self.apps_v1_api = client.AppsV1Api(api_client)
@ -96,9 +95,9 @@ class K8s(object):
:param timeout: The timeout to wait for the delete to complete
'''
self._delete_item_action(
self.batch_v1beta1_api.list_namespaced_cron_job,
self.batch_v1beta1_api.delete_namespaced_cron_job, "cron job",
name, namespace, propagation_policy, timeout)
self.batch_api.list_namespaced_cron_job,
self.batch_api.delete_namespaced_cron_job, "cron job", name,
namespace, propagation_policy, timeout)
def delete_pod_action(
self,
@ -225,8 +224,7 @@ class K8s(object):
'''
try:
return self.batch_v1beta1_api.list_namespaced_cron_job(
namespace, **kwargs)
return self.batch_api.list_namespaced_cron_job(namespace, **kwargs)
except ApiException as e:
LOG.error(
"Exception getting cron jobs: namespace=%s, label=%s: %s",

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import collections
import collections.abc
import json
import yaml
@ -54,7 +54,7 @@ class Override(object):
def update(self, d, u):
for k, v in u.items():
if isinstance(v, collections.Mapping):
if isinstance(v, collections.abc.Mapping):
r = self.update(d.get(k, {}), v)
d[k] = r
elif isinstance(v, str) and isinstance(d.get(k), (list, tuple)):
@ -90,9 +90,9 @@ class Override(object):
def convert(data):
if isinstance(data, str):
return str(data)
elif isinstance(data, collections.Mapping):
elif isinstance(data, collections.abc.Mapping):
return dict(map(convert, data.items()))
elif isinstance(data, collections.Iterable):
elif isinstance(data, collections.abc.Iterable):
return type(data)(map(convert, data))
else:
return data
@ -113,7 +113,7 @@ class Override(object):
t = t.setdefault(part, {})
string = json.dumps(tree).replace('null', '"{}"'.format(new_value))
data_obj = convert(json.loads(string, encoding='utf-8'))
data_obj = convert(json.loads(string))
return data_obj

View File

@ -13,7 +13,7 @@
# limitations under the License.
from abc import ABC, abstractmethod
import collections
import collections.abc
import copy
import math
import re

View File

@ -19,7 +19,7 @@
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------

View File

@ -1,11 +1,11 @@
amqp<2.7,>=2.6.0
deepdiff==3.3.0
deepdiff>=3.3.0
gitpython
jsonschema>=3.0.1,<4
keystoneauth1>=3.18.0
keystonemiddleware==5.3.0
keystonemiddleware>=5.3.0
kombu<4.7,>=4.6.10
kubernetes~=24.2.0; python_version >= '3.6'
kubernetes~=25.3.0; python_version >= '3.6'
Paste>=2.0.3
PasteDeploy>=1.5.2
pylibyaml~=0.1
@ -32,5 +32,5 @@ oslo.log>=3.45.2 # Apache-2.0
oslo.messaging!=5.25.0,>=5.24.2 # Apache-2.0
oslo.middleware>=3.27.0 # Apache-2.0
oslo.policy>=1.23.0 # Apache-2.0
oslo.serialization==2.29.2 # Apache-2.0
oslo.serialization>=2.29.2 # Apache-2.0
oslo.utils>=3.42.1 # Apache-2.0

View File

@ -15,9 +15,9 @@ flake8>=3.3.0
mock
responses>=0.8.1
yapf==0.27.0
flake8-import-order==0.18.1
flake8-import-order>=0.18.1
grpcio-tools==1.16.0
typing-extensions==3.7.2
cmd2==1.5.0
grpcio-tools>=1.16.0
typing-extensions>=3.7.2
cmd2>=1.5.0
stestr

21
tox.ini
View File

@ -1,18 +1,18 @@
[tox]
skipsdist = True
minversion = 2.3.1
envlist = py35, pep8, cover, bandit
envlist = py38, pep8, cover, bandit
[testenv]
deps=
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy
passenv=HTTP_PROXY,HTTPS_PROXY,http_proxy,https_proxy,NO_PROXY,no_proxy
setenv=
VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install {opts} {packages}
whitelist_externals =
allowlist_externals =
bash
find
rm
@ -21,19 +21,10 @@ commands =
rm -Rf .testrepository/times.dbm
[testenv:venv]
basepython=python3
commands =
{posargs}
[testenv:py35]
basepython = python3.5
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
[testenv:py38]
commands =
{[testenv]commands}
stestr run {posargs}
@ -41,7 +32,9 @@ commands =
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
deps=
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -W -b html doc/source doc/build/html