21
21
22
22
from kubernetes_asyncio .client import api_client
23
23
from kubernetes_asyncio import utils
24
- from kubernetes_asyncio .client .api import extensions_v1beta1_api
24
+ from kubernetes_asyncio .client .api import apps_v1_api
25
25
from kubernetes_asyncio .client .models import v1_delete_options
26
26
from kubernetes_asyncio .e2e_test import base
27
27
28
28
29
- class TestClientExtensions (asynctest .TestCase ):
29
+ class TestClientApi (asynctest .TestCase ):
30
30
31
31
@classmethod
32
32
def setUpClass (cls ):
33
33
cls .config = base .get_e2e_configuration ()
34
34
35
35
async def test_create_deployment (self ):
36
36
client = api_client .ApiClient (configuration = self .config )
37
- api = extensions_v1beta1_api . ExtensionsV1beta1Api (client )
37
+ api = apps_v1_api . AppsV1Api (client )
38
38
name = 'nginx-deployment-' + str (uuid .uuid4 ())
39
- deployment = '''apiVersion: extensions/v1beta1
39
+ deployment = '''apiVersion: apps/v1
40
40
kind: Deployment
41
41
metadata:
42
42
name: %s
43
43
spec:
44
44
replicas: 3
45
+ selector:
46
+ matchLabels:
47
+ app: nginx
45
48
template:
46
49
metadata:
47
50
labels:
@@ -64,15 +67,18 @@ async def test_create_deployment(self):
64
67
65
68
async def test_create_deployment_from_yaml_file (self ):
66
69
client = api_client .ApiClient (configuration = self .config )
67
- api = extensions_v1beta1_api . ExtensionsV1beta1Api (client )
70
+ api = apps_v1_api . AppsV1Api (client )
68
71
name = 'nginx-deployment-' + str (uuid .uuid4 ())
69
72
tempfile = 'temp.yaml'
70
- deployment = '''apiVersion: extensions/v1beta1
73
+ deployment = '''apiVersion: apps/v1
71
74
kind: Deployment
72
75
metadata:
73
76
name: %s
74
77
spec:
75
78
replicas: 3
79
+ selector:
80
+ matchLabels:
81
+ app: nginx
76
82
template:
77
83
metadata:
78
84
labels:
@@ -96,16 +102,19 @@ async def test_create_deployment_from_yaml_file(self):
96
102
97
103
async def test_create_daemonset (self ):
98
104
client = api_client .ApiClient (configuration = self .config )
99
- api = extensions_v1beta1_api . ExtensionsV1beta1Api (client )
105
+ api = apps_v1_api . AppsV1Api (client )
100
106
name = 'nginx-app-' + str (uuid .uuid4 ())
101
107
daemonset = {
102
- 'apiVersion' : 'extensions/v1beta1 ' ,
108
+ 'apiVersion' : 'apps/v1 ' ,
103
109
'kind' : 'DaemonSet' ,
104
110
'metadata' : {
105
111
'labels' : {'app' : 'nginx' },
106
- 'name' : '%s' % name ,
112
+ 'name' : name ,
107
113
},
108
114
'spec' : {
115
+ 'selector' : {
116
+ 'matchLabels' : {'app' : 'nginx' }
117
+ },
109
118
'template' : {
110
119
'metadata' : {
111
120
'labels' : {'app' : 'nginx' },
0 commit comments