Skip to content

Commit fe9f11e

Browse files
Add cce runtime option (#518)
Add cce runtime option Tests passed === RUN TestNodes --- PASS: TestNodes (743.95s) === RUN TestNodes/TestNodeLifecycle --- PASS: TestNodes/TestNodeLifecycle (257.69s) PASS Reviewed-by: Anton Sidelnikov Reviewed-by: Artem Lifshits
1 parent 7597df6 commit fe9f11e

File tree

6 files changed

+47
-20
lines changed

6 files changed

+47
-20
lines changed

acceptance/openstack/cce/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func CreateCluster(t *testing.T, vpcID, subnetID string) string {
2929
VpcId: vpcID,
3030
SubnetId: subnetID,
3131
},
32+
Version: "v1.25",
3233
ContainerNetwork: clusters.ContainerNetworkSpec{
3334
Mode: "overlay_l2",
3435
},

acceptance/openstack/cce/v3/nodes_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (s *testNodes) TestNodeLifecycle() {
5050
client, err := clients.NewCceV3Client()
5151
th.AssertNoErr(t, err)
5252

53-
privateIP := "192.168.1.12" // suppose used subnet is 192.168.0.0/16
53+
privateIP := "192.168.0.12" // suppose used subnet is 192.168.0.0/16
5454

5555
kp := cce.CreateKeypair(t)
5656
defer cce.DeleteKeypair(t, kp)
@@ -71,7 +71,7 @@ func (s *testNodes) TestNodeLifecycle() {
7171
Spec: nodes.Spec{
7272
Flavor: "s2.xlarge.2",
7373
Az: "eu-de-01",
74-
Os: "EulerOS 2.5",
74+
Os: "EulerOS 2.9",
7575
Login: nodes.LoginSpec{
7676
SshKey: kp,
7777
},
@@ -96,6 +96,9 @@ func (s *testNodes) TestNodeLifecycle() {
9696
FixedIPs: []string{privateIP},
9797
},
9898
},
99+
Runtime: nodes.RuntimeSpec{
100+
Name: "containerd",
101+
},
99102
ExtendParam: nodes.ExtendParam{
100103
MaxPods: 16,
101104
DockerBaseSize: 20,

openstack/cce/v3/nodes/results.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ type Spec struct {
7575
K8sTags map[string]string `json:"k8sTags,omitempty"`
7676
// taints to created nodes to configure anti-affinity
7777
Taints []TaintSpec `json:"taints,omitempty"`
78+
// Container runtime. The default value is docker.
79+
Runtime RuntimeSpec `json:"runtime,omitempty"`
80+
}
81+
82+
type RuntimeSpec struct {
83+
// Container runtime. The default value is docker.
84+
// Enumeration values: docker, containerd
85+
Name string `json:"name,omitempty"`
7886
}
7987

8088
// NodeNicSpec spec of the node

openstack/cce/v3/nodes/testing/fixtures.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ const Output = `{
2828
"volumetype": "SATA",
2929
"size": 100
3030
}
31-
]
31+
],
32+
"runtime": {
33+
"name": "containerd"
34+
}
3235
}
3336
}`
3437

@@ -54,13 +57,16 @@ var Expected = &nodes.Nodes{
5457
Size: 100,
5558
},
5659
},
60+
Runtime: nodes.RuntimeSpec{
61+
Name: "containerd",
62+
},
5763
},
5864
}
5965

6066
const JobOutput = `{
6167
"kind": "Job",
6268
"metadata": {
63-
"uid": "73ce052c-8b1b-11e8-8f9d-0255ac10193f"
69+
"uid": "73ce052c-8b1b-11e8-8f9d-0255ac10193f"
6470
},
6571
"spec": {
6672
"type": "ScaleupCluster",
@@ -80,7 +86,7 @@ const JobOutput = `{
8086
{
8187
"kind": "Job",
8288
"metadata": {
83-
"uid": "73ce03fd-8b1b-11e8-8f9d-0255ac10193f"
89+
"uid": "73ce03fd-8b1b-11e8-8f9d-0255ac10193f"
8490
},
8591
"spec": {
8692
"type": "GetPSMCert",

openstack/cce/v3/nodes/testing/requests_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func TestListNode(t *testing.T) {
5050
"size": 100
5151
}
5252
],
53+
"runtime": {
54+
"name": "containerd"
55+
},
5356
"publicIP": {
5457
"eip": {
5558
"bandwidth": {}
@@ -75,7 +78,7 @@ func TestListNode(t *testing.T) {
7578
t.Errorf("Failed to extract nodes: %v", err)
7679
}
7780

78-
expected := []nodes.Nodes{
81+
var expected = []nodes.Nodes{
7982
{
8083
Kind: "Host",
8184
Apiversion: "v3",
@@ -91,11 +94,13 @@ func TestListNode(t *testing.T) {
9194
Size: 100,
9295
}},
9396
Flavor: "s1.medium",
97+
Runtime: nodes.RuntimeSpec{
98+
Name: "containerd",
99+
},
94100
},
95101
Status: nodes.Status{Phase: "Active", ServerID: "41748e56-33d4-46a1-aa57-2c8c29907995", PrivateIP: "192.168.0.3"},
96102
},
97103
}
98-
99104
th.AssertDeepEquals(t, expected, actual)
100105
}
101106

@@ -165,7 +170,10 @@ func TestCreateV3Node(t *testing.T) {
165170
"rootVolume": {
166171
"size": 40,
167172
"volumetype": "SATA"
168-
}
173+
},
174+
"runtime": {
175+
"name": "containerd"
176+
}
169177
}
170178
}
171179
`)
@@ -193,6 +201,9 @@ func TestCreateV3Node(t *testing.T) {
193201
},
194202
},
195203
Count: 1,
204+
Runtime: nodes.RuntimeSpec{
205+
Name: "containerd",
206+
},
196207
},
197208
}
198209
actual, err := nodes.Create(fake.ServiceClient(), "cec124c2-58f1-11e8-ad73-0255ac101926", options).Extract()

openstack/utils/utils.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func DeleteNotPassParams(params *map[string]interface{}, notPassParams []string)
1414
}
1515
}
1616

17-
// merges two interfaces. In cases where a value is defined for both 'overridingInterface' and
17+
// MergeInterfaces merges two interfaces. In cases where a value is defined for both 'overridingInterface' and
1818
// 'inferiorInterface' the value in 'overridingInterface' will take precedence.
1919
func MergeInterfaces(overridingInterface, inferiorInterface interface{}) interface{} {
2020
switch overriding := overridingInterface.(type) {
@@ -35,9 +35,7 @@ func MergeInterfaces(overridingInterface, inferiorInterface interface{}) interfa
3535
if !ok {
3636
return overriding
3737
}
38-
for i := range list {
39-
overriding = append(overriding, list[i])
40-
}
38+
overriding = append(overriding, list)
4139
return overriding
4240
case nil:
4341
// mergeClouds(nil, map[string]interface{...}) -> map[string]interface{...}
@@ -63,14 +61,14 @@ func PrependString(item string, slice []string) []string {
6361
return result
6462
}
6563

66-
func In(item interface{}, slice interface{}) bool {
67-
for _, it := range slice.([]interface{}) {
68-
if reflect.DeepEqual(item, it) {
69-
return true
70-
}
71-
}
72-
return false
73-
}
64+
// func In(item interface{}, slice interface{}) bool {
65+
// for _, it := range slice.([]interface{}) {
66+
// if reflect.DeepEqual(item, it) {
67+
// return true
68+
// }
69+
// }
70+
// return false
71+
// }
7472

7573
// GetRegion returns the region that was specified in the auth options. If a
7674
// region was not set it returns value from env OS_REGION_NAME

0 commit comments

Comments
 (0)