Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c08abb71
Commit
c08abb71
authored
Feb 16, 2018
by
Cheng Xing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi-zone PD e2e tests
parent
6e856480
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
13 deletions
+88
-13
e2e.go
test/e2e/e2e.go
+4
-1
BUILD
test/e2e/framework/BUILD
+1
-0
google_compute.go
test/e2e/framework/google_compute.go
+30
-0
util.go
test/e2e/framework/util.go
+48
-1
ubernetes_lite.go
test/e2e/scheduling/ubernetes_lite.go
+1
-0
BUILD
test/e2e/storage/BUILD
+2
-0
regional_pd.go
test/e2e/storage/regional_pd.go
+0
-0
volume_provisioning.go
test/e2e/storage/volume_provisioning.go
+2
-11
No files found.
test/e2e/e2e.go
View file @
c08abb71
...
...
@@ -72,7 +72,10 @@ func setupProviderConfig() error {
managedZones
=
[]
string
{
zone
}
}
gceAlphaFeatureGate
,
err
:=
gcecloud
.
NewAlphaFeatureGate
([]
string
{
gcecloud
.
AlphaFeatureNetworkEndpointGroup
})
gceAlphaFeatureGate
,
err
:=
gcecloud
.
NewAlphaFeatureGate
([]
string
{
gcecloud
.
AlphaFeatureNetworkEndpointGroup
,
gcecloud
.
AlphaFeatureGCEDisk
,
})
if
err
!=
nil
{
glog
.
Errorf
(
"Encountered error for creating alpha feature gate: %v"
,
err
)
}
...
...
test/e2e/framework/BUILD
View file @
c08abb71
...
...
@@ -62,6 +62,7 @@ go_library(
"//pkg/controller/nodelifecycle:go_default_library",
"//pkg/features:go_default_library",
"//pkg/kubectl:go_default_library",
"//pkg/kubelet/apis:go_default_library",
"//pkg/kubelet/apis/kubeletconfig:go_default_library",
"//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
"//pkg/kubelet/dockershim/metrics:go_default_library",
...
...
test/e2e/framework/google_compute.go
View file @
c08abb71
...
...
@@ -124,3 +124,33 @@ func LogClusterImageSources() {
Logf
(
"cluster images sources, could not write to %q: %v"
,
filePath
,
err
)
}
}
func
CreateManagedInstanceGroup
(
size
int64
,
zone
,
template
string
)
error
{
// TODO(verult): make this hit the compute API directly instead of
// shelling out to gcloud.
_
,
_
,
err
:=
retryCmd
(
"gcloud"
,
"compute"
,
"instance-groups"
,
"managed"
,
"create"
,
fmt
.
Sprintf
(
"--project=%s"
,
TestContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--zone=%s"
,
zone
),
TestContext
.
CloudConfig
.
NodeInstanceGroup
,
fmt
.
Sprintf
(
"--size=%d"
,
size
),
fmt
.
Sprintf
(
"--template=%s"
,
template
))
if
err
!=
nil
{
return
fmt
.
Errorf
(
"gcloud compute instance-groups managed create call failed with err: %v"
,
err
)
}
return
nil
}
func
DeleteManagedInstanceGroup
(
zone
string
)
error
{
// TODO(verult): make this hit the compute API directly instead of
// shelling out to gcloud.
_
,
_
,
err
:=
retryCmd
(
"gcloud"
,
"compute"
,
"instance-groups"
,
"managed"
,
"delete"
,
fmt
.
Sprintf
(
"--project=%s"
,
TestContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--zone=%s"
,
zone
),
TestContext
.
CloudConfig
.
NodeInstanceGroup
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"gcloud compute instance-groups managed delete call failed with err: %v"
,
err
)
}
return
nil
}
test/e2e/framework/util.go
View file @
c08abb71
...
...
@@ -90,6 +90,7 @@ import (
nodectlr
"k8s.io/kubernetes/pkg/controller/nodelifecycle"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/kubectl"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/master/ports"
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
...
...
@@ -336,6 +337,16 @@ func SkipUnlessProviderIs(supportedProviders ...string) {
}
}
func
SkipUnlessMultizone
(
c
clientset
.
Interface
)
{
zones
,
err
:=
GetClusterZones
(
c
)
if
err
!=
nil
{
Skipf
(
"Error listing cluster zones"
)
}
if
zones
.
Len
()
<=
1
{
Skipf
(
"Requires more than one zone"
)
}
}
func
SkipUnlessClusterMonitoringModeIs
(
supportedMonitoring
...
string
)
{
if
!
ClusterMonitoringModeIs
(
supportedMonitoring
...
)
{
Skipf
(
"Only next monitoring modes are supported %v (not %s)"
,
supportedMonitoring
,
TestContext
.
ClusterMonitoringMode
)
...
...
@@ -897,6 +908,26 @@ func WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase, c clientset.In
return
fmt
.
Errorf
(
"PersistentVolume %s not in phase %s within %v"
,
pvName
,
phase
,
timeout
)
}
// WaitForStatefulSetReplicasReady waits for all replicas of a StatefulSet to become ready or until timeout occurs, whichever comes first.
func
WaitForStatefulSetReplicasReady
(
statefulSetName
,
ns
string
,
c
clientset
.
Interface
,
Poll
,
timeout
time
.
Duration
)
error
{
Logf
(
"Waiting up to %v for StatefulSet %s to have all replicas ready"
,
timeout
,
statefulSetName
)
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
Poll
)
{
sts
,
err
:=
c
.
AppsV1
()
.
StatefulSets
(
ns
)
.
Get
(
statefulSetName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
Logf
(
"Get StatefulSet %s failed, ignoring for %v: %v"
,
statefulSetName
,
Poll
,
err
)
continue
}
else
{
if
sts
.
Status
.
ReadyReplicas
==
*
sts
.
Spec
.
Replicas
{
Logf
(
"All %d replicas of StatefulSet %s are ready. (%v)"
,
sts
.
Status
.
ReadyReplicas
,
statefulSetName
,
time
.
Since
(
start
))
return
nil
}
else
{
Logf
(
"StatefulSet %s found but there are %d ready replicas and %d total replicas."
,
statefulSetName
,
sts
.
Status
.
ReadyReplicas
,
*
sts
.
Spec
.
Replicas
)
}
}
}
return
fmt
.
Errorf
(
"StatefulSet %s still has unready pods within %v"
,
statefulSetName
,
timeout
)
}
// WaitForPersistentVolumeDeleted waits for a PersistentVolume to get deleted or until timeout occurs, whichever comes first.
func
WaitForPersistentVolumeDeleted
(
c
clientset
.
Interface
,
pvName
string
,
Poll
,
timeout
time
.
Duration
)
error
{
Logf
(
"Waiting up to %v for PersistentVolume %s to get deleted"
,
timeout
,
pvName
)
...
...
@@ -4067,7 +4098,7 @@ func WaitForReadyNodes(c clientset.Interface, size int, timeout time.Duration) e
Logf
(
"Cluster has reached the desired number of ready nodes %d"
,
size
)
return
nil
}
Logf
(
"Waiting for ready nodes %d, current ready %d, not ready nodes %d"
,
size
,
num
Nodes
,
numNodes
-
numReady
)
Logf
(
"Waiting for ready nodes %d, current ready %d, not ready nodes %d"
,
size
,
num
Ready
,
numNodes
-
numReady
)
}
return
fmt
.
Errorf
(
"timeout waiting %v for number of ready nodes to be %d"
,
timeout
,
size
)
}
...
...
@@ -5160,3 +5191,19 @@ func WaitForPersistentVolumeClaimDeleted(c clientset.Interface, ns string, pvcNa
}
return
fmt
.
Errorf
(
"PersistentVolumeClaim %s is not removed from the system within %v"
,
pvcName
,
timeout
)
}
func
GetClusterZones
(
c
clientset
.
Interface
)
(
sets
.
String
,
error
)
{
nodes
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Error getting nodes while attempting to list cluster zones: %v"
,
err
)
}
// collect values of zone label from all nodes
zones
:=
sets
.
NewString
()
for
_
,
node
:=
range
nodes
.
Items
{
if
zone
,
found
:=
node
.
Labels
[
kubeletapis
.
LabelZoneFailureDomain
];
found
{
zones
.
Insert
(
zone
)
}
}
return
zones
,
nil
}
test/e2e/scheduling/ubernetes_lite.go
View file @
c08abb71
...
...
@@ -125,6 +125,7 @@ func getZoneNameForNode(node v1.Node) (string, error) {
node
.
Name
,
kubeletapis
.
LabelZoneFailureDomain
)
}
// TODO (verult) Merge with framework.GetClusterZones()
// Find the names of all zones in which we have nodes in this cluster.
func
getZoneNames
(
c
clientset
.
Interface
)
([]
string
,
error
)
{
zoneNames
:=
sets
.
NewString
()
...
...
test/e2e/storage/BUILD
View file @
c08abb71
...
...
@@ -20,6 +20,7 @@ go_library(
"persistent_volumes-local.go",
"pv_protection.go",
"pvc_protection.go",
"regional_pd.go",
"volume_expand.go",
"volume_io.go",
"volume_metrics.go",
...
...
@@ -29,6 +30,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e/storage",
deps = [
"//pkg/api/testapi:go_default_library",
"//pkg/api/v1/pod:go_default_library",
"//pkg/apis/core/v1/helper:go_default_library",
"//pkg/apis/storage/v1/util:go_default_library",
"//pkg/client/conditions:go_default_library",
...
...
test/e2e/storage/regional_pd.go
0 → 100644
View file @
c08abb71
This diff is collapsed.
Click to expand it.
test/e2e/storage/volume_provisioning.go
View file @
c08abb71
...
...
@@ -43,7 +43,6 @@ import (
clientset
"k8s.io/client-go/kubernetes"
v1helper
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
storageutil
"k8s.io/kubernetes/pkg/apis/storage/v1/util"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/utils"
)
...
...
@@ -1019,16 +1018,8 @@ func deleteProvisionedVolumesAndDisks(c clientset.Interface, pvs []*v1.Persisten
}
func
getRandomCloudZone
(
c
clientset
.
Interface
)
string
{
nodes
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// collect values of zone label from all nodes
zones
:=
sets
.
NewString
()
for
_
,
node
:=
range
nodes
.
Items
{
if
zone
,
found
:=
node
.
Labels
[
kubeletapis
.
LabelZoneFailureDomain
];
found
{
zones
.
Insert
(
zone
)
}
}
zones
,
err
:=
framework
.
GetClusterZones
(
c
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
// return "" in case that no node has zone label
zone
,
_
:=
zones
.
PopAny
()
return
zone
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment