The openshift library has been completely redesigned with recent releases so bump the dep and adapt to the new api. The update is necessary in order to fix a urllib3 version conflict [1]. [1] Trace: ERROR: nodepool 3.14.1.dev3 has requirement urllib3<1.26,>=1.25.4, but you'll have urllib3 1.24 which is incompatible. ERROR: kubernetes 8.0.2 has requirement urllib3>=1.24.2, but you'll have urllib3 1.24 which is incompatible. ERROR: botocore 1.19.30 has requirement urllib3<1.27,>=1.25.4; python_version != "3.4", but you'll have urllib3 1.24 which is incompatible. Change-Id: Ia4d09fd0a4a49d644bb575b74184de930c62ce89 Co-Authored-By: Tobias Henkel <tobias.henkel@bmw.de> Story: 2008427 Task: 41373
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# Copyright 2018 Red Hat
|
|
#
|
|
# Licensed 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.
|
|
|
|
from kubernetes import config as k8s_config
|
|
from nodepool.driver import Driver
|
|
from nodepool.driver.openshift.config import OpenshiftProviderConfig
|
|
from nodepool.driver.openshift.provider import OpenshiftProvider
|
|
|
|
|
|
class OpenshiftDriver(Driver):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def reset(self):
|
|
try:
|
|
k8s_config.load_kube_config(persist_config=True)
|
|
except k8s_config.config_exception.ConfigException as e:
|
|
if 'Invalid kube-config file. No configuration found.' in str(e):
|
|
pass
|
|
else:
|
|
raise
|
|
except FileNotFoundError:
|
|
pass
|
|
|
|
def getProviderConfig(self, provider):
|
|
return OpenshiftProviderConfig(self, provider)
|
|
|
|
def getProvider(self, provider_config):
|
|
return OpenshiftProvider(provider_config)
|