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
d4376599
Commit
d4376599
authored
Apr 24, 2017
by
NickrenREN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: replace some hardcoded codes and remove unused functions
parent
35159f9c
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
37 additions
and
114 deletions
+37
-114
pods.go
test/e2e/common/pods.go
+1
-1
daemon_set.go
test/e2e/daemon_set.go
+1
-2
etcd_failure.go
test/e2e/etcd_failure.go
+1
-1
events.go
test/e2e/events.go
+1
-1
metrics_util.go
test/e2e/framework/metrics_util.go
+0
-11
nodes_util.go
test/e2e/framework/nodes_util.go
+0
-23
service_util.go
test/e2e/framework/service_util.go
+1
-1
size.go
test/e2e/framework/size.go
+0
-5
test_context.go
test/e2e/framework/test_context.go
+0
-10
util.go
test/e2e/framework/util.go
+3
-27
network_partition.go
test/e2e/network_partition.go
+1
-1
load.go
test/e2e/perf/load.go
+12
-15
rc.go
test/e2e/rc.go
+1
-1
replica_set.go
test/e2e/replica_set.go
+1
-1
resize_nodes.go
test/e2e/resize_nodes.go
+6
-8
ubernetes_lite.go
test/e2e/ubernetes_lite.go
+1
-1
daemonsets.go
test/e2e/upgrades/daemonsets.go
+1
-1
daemonset.go
test/e2e_federation/daemonset.go
+1
-1
container_manager_test.go
test/e2e_node/container_manager_test.go
+1
-1
BUILD
test/soak/cauldron/BUILD
+1
-0
cauldron.go
test/soak/cauldron/cauldron.go
+2
-1
serve_hostnames.go
test/soak/serve_hostnames/serve_hostnames.go
+1
-1
No files found.
test/e2e/common/pods.go
View file @
d4376599
...
...
@@ -368,7 +368,7 @@ var _ = framework.KubeDescribe("Pods", func() {
Containers
:
[]
v1
.
Container
{
{
Name
:
"srv"
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
framework
.
ServeHostnameImage
,
Ports
:
[]
v1
.
ContainerPort
{{
ContainerPort
:
9376
}},
},
},
...
...
test/e2e/daemon_set.go
View file @
d4376599
...
...
@@ -94,8 +94,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
f
=
framework
.
NewDefaultFramework
(
"daemonsets"
)
image
:=
"gcr.io/google_containers/serve_hostname:v1.4"
redisImage
:=
"gcr.io/k8s-testimages/redis:e2e"
image
:=
framework
.
ServeHostnameImage
dsName
:=
"daemon-set"
var
ns
string
...
...
test/e2e/etcd_failure.go
View file @
d4376599
...
...
@@ -73,7 +73,7 @@ func etcdFailTest(f *framework.Framework, failCommand, fixCommand string) {
checkExistingRCRecovers
(
f
)
testReplicationControllerServeImageOrFail
(
f
,
"basic"
,
"gcr.io/google_containers/serve_hostname:v1.4"
)
testReplicationControllerServeImageOrFail
(
f
,
"basic"
,
framework
.
ServeHostnameImage
)
}
// For this duration, etcd will be failed by executing a failCommand on the master.
...
...
test/e2e/events.go
View file @
d4376599
...
...
@@ -55,7 +55,7 @@ var _ = framework.KubeDescribe("Events", func() {
Containers
:
[]
v1
.
Container
{
{
Name
:
"p"
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
framework
.
ServeHostnameImage
,
Ports
:
[]
v1
.
ContainerPort
{{
ContainerPort
:
80
}},
},
},
...
...
test/e2e/framework/metrics_util.go
View file @
d4376599
...
...
@@ -497,17 +497,6 @@ func LogSuspiciousLatency(latencyData []PodLatencyData, latencyDataLag []PodLate
float64
(
nodeCount
)
/
(
latencyDataLag
[
len
(
latencyDataLag
)
-
1
]
.
Latency
.
Minutes
()))
}
// testMaximumLatencyValue verifies the highest latency value is less than or equal to
// the given time.Duration. Since the arrays are sorted we are looking at the last
// element which will always be the highest. If the latency is higher than the max Failf
// is called.
func
testMaximumLatencyValue
(
latencies
[]
PodLatencyData
,
max
time
.
Duration
,
name
string
)
{
highestLatency
:=
latencies
[
len
(
latencies
)
-
1
]
if
!
(
highestLatency
.
Latency
<=
max
)
{
Failf
(
"%s were not all under %s: %#v"
,
name
,
max
.
String
(),
latencies
)
}
}
func
PrintLatencies
(
latencies
[]
PodLatencyData
,
header
string
)
{
metrics
:=
ExtractLatencyMetrics
(
latencies
)
Logf
(
"10%% %s: %v"
,
header
,
latencies
[(
len
(
latencies
)
*
9
)
/
10
:
])
...
...
test/e2e/framework/nodes_util.go
View file @
d4376599
...
...
@@ -133,29 +133,6 @@ func nodeUpgradeGCE(rawV, img string) error {
return
err
}
func
cleanupNodeUpgradeGCE
(
tmplBefore
string
)
{
Logf
(
"Cleaning up any unused node templates"
)
tmplAfter
,
err
:=
MigTemplate
()
if
err
!=
nil
{
Logf
(
"Could not get node template post-upgrade; may have leaked template %s"
,
tmplBefore
)
return
}
if
tmplBefore
==
tmplAfter
{
// The node upgrade failed so there's no need to delete
// anything.
Logf
(
"Node template %s is still in use; not cleaning up"
,
tmplBefore
)
return
}
Logf
(
"Deleting node template %s"
,
tmplBefore
)
if
_
,
_
,
err
:=
retryCmd
(
"gcloud"
,
"compute"
,
"instance-templates"
,
fmt
.
Sprintf
(
"--project=%s"
,
TestContext
.
CloudConfig
.
ProjectID
),
"delete"
,
tmplBefore
);
err
!=
nil
{
Logf
(
"gcloud compute instance-templates delete %s call failed with err: %v"
,
tmplBefore
,
err
)
Logf
(
"May have leaked instance template %q"
,
tmplBefore
)
}
}
func
nodeUpgradeGKE
(
v
string
,
img
string
)
error
{
Logf
(
"Upgrading nodes to version %q and image %q"
,
v
,
img
)
args
:=
[]
string
{
...
...
test/e2e/framework/service_util.go
View file @
d4376599
...
...
@@ -1057,7 +1057,7 @@ func StartServeHostnameService(c clientset.Interface, internalClient internalcli
config
:=
testutils
.
RCConfig
{
Client
:
c
,
InternalClient
:
internalClient
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
ServeHostnameImage
,
Name
:
name
,
Namespace
:
ns
,
PollInterval
:
3
*
time
.
Second
,
...
...
test/e2e/framework/size.go
View file @
d4376599
...
...
@@ -29,13 +29,8 @@ import (
)
const
(
serveHostnameImage
=
"gcr.io/google_containers/serve_hostname:v1.4"
resizeNodeReadyTimeout
=
2
*
time
.
Minute
resizeNodeNotReadyTimeout
=
2
*
time
.
Minute
nodeReadinessTimeout
=
3
*
time
.
Minute
podNotReadyTimeout
=
1
*
time
.
Minute
podReadyTimeout
=
2
*
time
.
Minute
testPort
=
9376
)
func
ResizeGroup
(
group
string
,
size
int32
)
error
{
...
...
test/e2e/framework/test_context.go
View file @
d4376599
...
...
@@ -238,16 +238,6 @@ func RegisterNodeFlags() {
flag
.
BoolVar
(
&
TestContext
.
PrepullImages
,
"prepull-images"
,
true
,
"If true, prepull images so image pull failures do not cause test failures."
)
}
// overwriteFlagsWithViperConfig finds and writes values to flags using viper as input.
func
overwriteFlagsWithViperConfig
()
{
viperFlagSetter
:=
func
(
f
*
flag
.
Flag
)
{
if
viper
.
IsSet
(
f
.
Name
)
{
f
.
Value
.
Set
(
viper
.
GetString
(
f
.
Name
))
}
}
flag
.
VisitAll
(
viperFlagSetter
)
}
// ViperizeFlags sets up all flag and config processing. Future configuration info should be added to viper, not to flags.
func
ViperizeFlags
()
{
...
...
test/e2e/framework/util.go
View file @
d4376599
...
...
@@ -176,6 +176,9 @@ const (
// TODO(justinsb): Avoid hardcoding this.
awsMasterIP
=
"172.20.0.9"
// Serve hostname image name
ServeHostnameImage
=
"gcr.io/google_containers/serve_hostname:v1.4"
)
var
(
...
...
@@ -407,9 +410,6 @@ func SkipIfMissingResource(clientPool dynamic.ClientPool, gvr schema.GroupVersio
// ProvidersWithSSH are those providers where each node is accessible with SSH
var
ProvidersWithSSH
=
[]
string
{
"gce"
,
"gke"
,
"aws"
,
"local"
}
// providersWithMasterSSH are those providers where master node is accessible with SSH
var
providersWithMasterSSH
=
[]
string
{
"gce"
,
"gke"
,
"kubemark"
,
"aws"
,
"local"
}
type
podCondition
func
(
pod
*
v1
.
Pod
)
(
bool
,
error
)
// logPodStates logs basic info of provided pods for debugging.
...
...
@@ -1377,30 +1377,6 @@ func WaitForPodSuccessInNamespaceSlow(c clientset.Interface, podName string, nam
return
waitForPodSuccessInNamespaceTimeout
(
c
,
podName
,
namespace
,
slowPodStartTimeout
)
}
// waitForRCPodOnNode returns the pod from the given replication controller (described by rcName) which is scheduled on the given node.
// In case of failure or too long waiting time, an error is returned.
func
waitForRCPodOnNode
(
c
clientset
.
Interface
,
ns
,
rcName
,
node
string
)
(
*
v1
.
Pod
,
error
)
{
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
rcName
}))
var
p
*
v1
.
Pod
=
nil
err
:=
wait
.
PollImmediate
(
10
*
time
.
Second
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
Logf
(
"Waiting for pod %s to appear on node %s"
,
rcName
,
node
)
options
:=
metav1
.
ListOptions
{
LabelSelector
:
label
.
String
()}
pods
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
List
(
options
)
if
err
!=
nil
{
return
false
,
err
}
for
_
,
pod
:=
range
pods
.
Items
{
if
pod
.
Spec
.
NodeName
==
node
{
Logf
(
"Pod %s found on node %s"
,
pod
.
Name
,
node
)
p
=
&
pod
return
true
,
nil
}
}
return
false
,
nil
})
return
p
,
err
}
// WaitForRCToStabilize waits till the RC has a matching generation/replica count between spec and status.
func
WaitForRCToStabilize
(
c
clientset
.
Interface
,
ns
,
name
string
,
timeout
time
.
Duration
)
error
{
options
:=
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
...
...
test/e2e/network_partition.go
View file @
d4376599
...
...
@@ -85,7 +85,7 @@ func podOnNode(podName, nodeName string, image string) *v1.Pod {
}
func
newPodOnNode
(
c
clientset
.
Interface
,
namespace
,
podName
,
nodeName
string
)
error
{
pod
,
err
:=
c
.
Core
()
.
Pods
(
namespace
)
.
Create
(
podOnNode
(
podName
,
nodeName
,
s
erveHostnameImage
))
pod
,
err
:=
c
.
Core
()
.
Pods
(
namespace
)
.
Create
(
podOnNode
(
podName
,
nodeName
,
framework
.
S
erveHostnameImage
))
if
err
==
nil
{
framework
.
Logf
(
"Created pod %s on node %s"
,
pod
.
ObjectMeta
.
Name
,
nodeName
)
}
else
{
...
...
test/e2e/perf/load.go
View file @
d4376599
...
...
@@ -48,15 +48,12 @@ import (
)
const
(
smallGroupSize
=
5
mediumGroupSize
=
30
bigGroupSize
=
250
smallGroupName
=
"load-small"
mediumGroupName
=
"load-medium"
bigGroupName
=
"load-big"
smallGroupBatchSize
=
30
mediumGroupBatchSize
=
5
bigGroupBatchSize
=
1
smallGroupSize
=
5
mediumGroupSize
=
30
bigGroupSize
=
250
smallGroupName
=
"load-small"
mediumGroupName
=
"load-medium"
bigGroupName
=
"load-big"
// We start RCs/Services/pods/... in different namespace in this test.
// nodeCountPerNamespace determines how many namespaces we will be using
// depending on the number of nodes in the underlying cluster.
...
...
@@ -143,16 +140,16 @@ var _ = framework.KubeDescribe("Load capacity", func() {
loadTests
:=
[]
Load
{
// The container will consume 1 cpu and 512mb of memory.
{
podsPerNode
:
3
,
image
:
"jess/stress"
,
command
:
[]
string
{
"stress"
,
"-c"
,
"1"
,
"-m"
,
"2"
},
kind
:
api
.
Kind
(
"ReplicationController"
)},
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
api
.
Kind
(
"ReplicationController"
)},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
api
.
Kind
(
"ReplicationController"
)},
// Tests for other resource types
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
extensions
.
Kind
(
"Deployment"
)},
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
batch
.
Kind
(
"Job"
)},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
extensions
.
Kind
(
"Deployment"
)},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
batch
.
Kind
(
"Job"
)},
// Test scheduling when daemons are preset
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
api
.
Kind
(
"ReplicationController"
),
daemonsPerNode
:
2
},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
api
.
Kind
(
"ReplicationController"
),
daemonsPerNode
:
2
},
// Test with secrets
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
extensions
.
Kind
(
"Deployment"
),
secretsPerPod
:
2
},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
extensions
.
Kind
(
"Deployment"
),
secretsPerPod
:
2
},
// Special test case which randomizes created resources
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
randomKind
},
{
podsPerNode
:
30
,
image
:
framework
.
ServeHostnameImage
,
kind
:
randomKind
},
}
for
_
,
testArg
:=
range
loadTests
{
...
...
test/e2e/rc.go
View file @
d4376599
...
...
@@ -38,7 +38,7 @@ var _ = framework.KubeDescribe("ReplicationController", func() {
f
:=
framework
.
NewDefaultFramework
(
"replication-controller"
)
It
(
"should serve a basic image on each replica with a public image [Conformance]"
,
func
()
{
testReplicationControllerServeImageOrFail
(
f
,
"basic"
,
"gcr.io/google_containers/serve_hostname:v1.4"
)
testReplicationControllerServeImageOrFail
(
f
,
"basic"
,
framework
.
ServeHostnameImage
)
})
It
(
"should serve a basic image on each replica with a private image"
,
func
()
{
...
...
test/e2e/replica_set.go
View file @
d4376599
...
...
@@ -78,7 +78,7 @@ var _ = framework.KubeDescribe("ReplicaSet", func() {
f
:=
framework
.
NewDefaultFramework
(
"replicaset"
)
It
(
"should serve a basic image on each replica with a public image [Conformance]"
,
func
()
{
testReplicaSetServeImageOrFail
(
f
,
"basic"
,
"gcr.io/google_containers/serve_hostname:v1.4"
)
testReplicaSetServeImageOrFail
(
f
,
"basic"
,
framework
.
ServeHostnameImage
)
})
It
(
"should serve a basic image on each replica with a private image"
,
func
()
{
...
...
test/e2e/resize_nodes.go
View file @
d4376599
...
...
@@ -32,13 +32,11 @@ import (
)
const
(
serveHostnameImage
=
"gcr.io/google_containers/serve_hostname:v1.4"
resizeNodeReadyTimeout
=
2
*
time
.
Minute
resizeNodeNotReadyTimeout
=
2
*
time
.
Minute
nodeReadinessTimeout
=
3
*
time
.
Minute
podNotReadyTimeout
=
1
*
time
.
Minute
podReadyTimeout
=
2
*
time
.
Minute
testPort
=
9376
resizeNodeReadyTimeout
=
2
*
time
.
Minute
nodeReadinessTimeout
=
3
*
time
.
Minute
podNotReadyTimeout
=
1
*
time
.
Minute
podReadyTimeout
=
2
*
time
.
Minute
testPort
=
9376
)
func
svcByName
(
name
string
,
port
int
)
*
v1
.
Service
{
...
...
@@ -68,7 +66,7 @@ func newSVCByName(c clientset.Interface, ns, name string) error {
func
newRCByName
(
c
clientset
.
Interface
,
ns
,
name
string
,
replicas
int32
,
gracePeriod
*
int64
)
(
*
v1
.
ReplicationController
,
error
)
{
By
(
fmt
.
Sprintf
(
"creating replication controller %s"
,
name
))
return
c
.
Core
()
.
ReplicationControllers
(
ns
)
.
Create
(
framework
.
RcByNamePort
(
name
,
replicas
,
s
erveHostnameImage
,
9376
,
v1
.
ProtocolTCP
,
map
[
string
]
string
{},
gracePeriod
))
name
,
replicas
,
framework
.
S
erveHostnameImage
,
9376
,
v1
.
ProtocolTCP
,
map
[
string
]
string
{},
gracePeriod
))
}
func
resizeRC
(
c
clientset
.
Interface
,
ns
,
name
string
,
replicas
int32
)
error
{
...
...
test/e2e/ubernetes_lite.go
View file @
d4376599
...
...
@@ -37,7 +37,7 @@ var _ = framework.KubeDescribe("Multi-AZ Clusters", func() {
f
:=
framework
.
NewDefaultFramework
(
"multi-az"
)
var
zoneCount
int
var
err
error
image
:=
"gcr.io/google_containers/serve_hostname:v1.4"
image
:=
framework
.
ServeHostnameImage
BeforeEach
(
func
()
{
framework
.
SkipUnlessProviderIs
(
"gce"
,
"gke"
,
"aws"
)
if
zoneCount
<=
0
{
...
...
test/e2e/upgrades/daemonsets.go
View file @
d4376599
...
...
@@ -42,7 +42,7 @@ func (DaemonSetUpgradeTest) Name() string { return "daemonset-upgrade" }
func
(
t
*
DaemonSetUpgradeTest
)
Setup
(
f
*
framework
.
Framework
)
{
daemonSetName
:=
"ds1"
labelSet
:=
map
[
string
]
string
{
"ds-name"
:
daemonSetName
}
image
:=
"gcr.io/google_containers/serve_hostname:v1.4"
image
:=
framework
.
ServeHostnameImage
ns
:=
f
.
Namespace
...
...
test/e2e_federation/daemonset.go
View file @
d4376599
...
...
@@ -173,7 +173,7 @@ func createDaemonSetOrFail(clientset *fedclientset.Clientset, namespace string)
Containers
:
[]
v1
.
Container
{
{
Name
:
"container1"
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
framework
.
ServeHostnameImage
,
Ports
:
[]
v1
.
ContainerPort
{{
ContainerPort
:
9376
}},
},
},
...
...
test/e2e_node/container_manager_test.go
View file @
d4376599
...
...
@@ -110,7 +110,7 @@ var _ = framework.KubeDescribe("Container Manager Misc [Serial]", func() {
Spec
:
v1
.
PodSpec
{
Containers
:
[]
v1
.
Container
{
{
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
framework
.
ServeHostnameImage
,
Name
:
podName
,
},
},
...
...
test/soak/cauldron/BUILD
View file @
d4376599
...
...
@@ -21,6 +21,7 @@ go_library(
deps = [
"//pkg/api:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//test/e2e/framework:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
...
...
test/soak/cauldron/cauldron.go
View file @
d4376599
...
...
@@ -36,6 +36,7 @@ import (
restclient
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/test/e2e/framework"
)
var
(
...
...
@@ -184,7 +185,7 @@ func main() {
Containers
:
[]
api
.
Container
{
{
Name
:
"serve-hostname"
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
framework
.
ServeHostnameImage
,
Ports
:
[]
api
.
ContainerPort
{{
ContainerPort
:
9376
}},
},
},
...
...
test/soak/serve_hostnames/serve_hostnames.go
View file @
d4376599
...
...
@@ -203,7 +203,7 @@ func main() {
Containers
:
[]
v1
.
Container
{
{
Name
:
"serve-hostname"
,
Image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
Image
:
e2e
.
ServeHostnameImage
,
Ports
:
[]
v1
.
ContainerPort
{{
ContainerPort
:
9376
}},
},
},
...
...
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