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

Update objects and tests for client 18.x.x #219

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions kubetest/objects/daemonset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class DaemonSet(ApiObject):
api_clients = {
"preferred": client.AppsV1Api,
"apps/v1": client.AppsV1Api,
"apps/v1beta1": client.AppsV1beta1Api,
"apps/v1beta2": client.AppsV1beta2Api,
}

def __init__(self, *args, **kwargs) -> None:
Expand Down
2 changes: 0 additions & 2 deletions kubetest/objects/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class Deployment(ApiObject):
api_clients = {
"preferred": client.AppsV1Api,
"apps/v1": client.AppsV1Api,
"apps/v1beta1": client.AppsV1beta1Api,
"apps/v1beta2": client.AppsV1beta2Api,
}

def __init__(self, *args, **kwargs) -> None:
Expand Down
6 changes: 3 additions & 3 deletions kubetest/objects/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class Ingress(ApiObject):
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#ingress-v1beta1-extensions
"""

obj_type = client.ExtensionsV1beta1Api
obj_type = client.NetworkingV1beta1Api

api_clients = {
"preferred": client.ExtensionsV1beta1Api,
"extensions/v1beta1": client.ExtensionsV1beta1Api,
"preferred": client.NetworkingV1beta1Api,
"networking.k8s.io/v1beta1": client.NetworkingV1beta1Api,
}

def __str__(self):
Expand Down
1 change: 0 additions & 1 deletion kubetest/objects/replicaset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class ReplicaSet(ApiObject):
api_clients = {
"preferred": client.AppsV1Api,
"apps/v1": client.AppsV1Api,
"apps/v1beta2": client.AppsV1beta2Api,
}

def __init__(self, *args, **kwargs) -> None:
Expand Down
2 changes: 0 additions & 2 deletions kubetest/objects/statefulset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class StatefulSet(ApiObject):
api_clients = {
"preferred": client.AppsV1Api,
"apps/v1": client.AppsV1Api,
"apps/v1beta1": client.AppsV1beta1Api,
"apps/v1beta2": client.AppsV1beta2Api,
}

def __init__(self, *args, **kwargs) -> None:
Expand Down
16 changes: 8 additions & 8 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=requirements-test.txt test-requirements.in
#
coverage==5.5
# via -r test-requirements.in
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --output-file=requirements-test.txt test-requirements.in
#
coverage==6.0.2
# via -r test-requirements.in
124 changes: 63 additions & 61 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,81 +1,83 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=requirements.txt setup.py
#
attrs==20.3.0
# via pytest
cachetools==4.2.1
# via google-auth
certifi==2020.12.5
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --output-file=requirements.txt setup.py
#
atomicwrites==1.4.0
# via pytest
attrs==21.2.0
# via pytest
cachetools==4.2.4
# via google-auth
certifi==2021.10.8
# via
# kubernetes
# requests
chardet==4.0.0
# via requests
google-auth==1.28.0
# via kubernetes
idna==2.10
# via requests
importlib-metadata==3.7.3
# requests
charset-normalizer==2.0.7
# via requests
colorama==0.4.4
# via pytest
google-auth==2.3.0
# via kubernetes
idna==3.3
# via requests
importlib-metadata==4.8.1
# via
# pluggy
# pytest
# pytest
iniconfig==1.1.1
# via pytest
kubernetes==12.0.1
# via kubetest (setup.py)
oauthlib==3.1.0
# via requests-oauthlib
packaging==20.9
# via pytest
pluggy==0.13.1
# via pytest
# via pytest
kubernetes==18.20.0
# via kubetest (setup.py)
oauthlib==3.1.1
# via requests-oauthlib
packaging==21.0
# via pytest
pluggy==1.0.0
# via pytest
py==1.10.0
# via pytest
pyasn1-modules==0.2.8
# via google-auth
# via pytest
pyasn1==0.4.8
# via
# pyasn1-modules
# rsa
# rsa
pyasn1-modules==0.2.8
# via google-auth
pyparsing==2.4.7
# via packaging
pytest==6.2.2
# via kubetest (setup.py)
python-dateutil==2.8.1
# via kubernetes
pyyaml==5.4.1
# via packaging
pytest==6.2.5
# via kubetest (setup.py)
python-dateutil==2.8.2
# via kubernetes
pyyaml==6.0
# via
# kubernetes
# kubetest (setup.py)
requests-oauthlib==1.3.0
# via kubernetes
requests==2.25.1
# kubetest (setup.py)
requests==2.26.0
# via
# kubernetes
# requests-oauthlib
# requests-oauthlib
requests-oauthlib==1.3.0
# via kubernetes
rsa==4.7.2
# via google-auth
six==1.15.0
# via google-auth
six==1.16.0
# via
# google-auth
# kubernetes
# python-dateutil
# websocket-client
# python-dateutil
toml==0.10.2
# via pytest
typing-extensions==3.7.4.3
# via importlib-metadata
urllib3==1.26.4
# via pytest
typing-extensions==3.10.0.2
# via importlib-metadata
urllib3==1.26.7
# via
# kubernetes
# requests
websocket-client==0.58.0
# via kubernetes
zipp==3.4.1
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
# requests
websocket-client==1.2.1
# via kubernetes
zipp==3.6.0
# via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# setuptools
15 changes: 8 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,18 @@ def simple_persistentvolumeclaim():
@pytest.fixture()
def simple_ingress():
"""Return the Kubernetes config matching the simple-ingress.yaml manifest."""
return client.ExtensionsV1beta1Ingress(
api_version="extensions/v1beta1",
return client.NetworkingV1beta1Ingress(
api_version="networking.k8s.io/v1beta1",
kind="Ingress",
metadata=client.V1ObjectMeta(name="my-ingress"),
spec=client.ExtensionsV1beta1IngressSpec(
spec=client.NetworkingV1beta1IngressSpec(
rules=[
client.ExtensionsV1beta1IngressRule(
http=client.ExtensionsV1beta1HTTPIngressRuleValue(
client.NetworkingV1beta1IngressRule(
host='my-host.com',
http=client.NetworkingV1beta1HTTPIngressRuleValue(
paths=[
client.ExtensionsV1beta1HTTPIngressPath(
backend=client.ExtensionsV1beta1IngressBackend(
client.NetworkingV1beta1HTTPIngressPath(
backend=client.NetworkingV1beta1IngressBackend(
service_name="my-service", service_port=80
),
path="/",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/manifests/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
Expand Down
4 changes: 2 additions & 2 deletions tests/data/simple-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host:
- host: my-host.com
http:
paths:
- path: /
Expand Down
14 changes: 1 addition & 13 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_simple_service_wrong_type(self, manifest_dir):
def test_simple_ingress_ok(self, manifest_dir, simple_ingress):
"""Test loading the simple service successfully."""
obj = manifest.load_type(
client.ExtensionsV1beta1Ingress,
client.NetworkingV1beta1Ingress,
os.path.join(manifest_dir, "simple-ingress.yaml"),
)
assert obj == simple_ingress
Expand Down Expand Up @@ -254,18 +254,6 @@ class TestGetType:
({"apiVersion": "v1", "kind": "Secret"}, client.V1Secret),
({"apiVersion": "v1", "kind": "Deployment"}, client.V1Deployment),
({"apiVersion": "apps/v1", "kind": "Deployment"}, client.V1Deployment),
(
{"apiVersion": "apps/v1beta1", "kind": "Deployment"},
client.AppsV1beta1Deployment,
),
(
{"apiVersion": "apps/v1beta2", "kind": "Deployment"},
client.V1beta2Deployment,
),
(
{"apiVersion": "extensions/v1beta1", "kind": "Deployment"},
client.ExtensionsV1beta1Deployment,
),
(
{
"apiVersion": "rbac.authorization.k8s.io/v1",
Expand Down