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
a9c6f873
Commit
a9c6f873
authored
Aug 26, 2016
by
Mike Danese
Committed by
GitHub
Aug 26, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31530 from kubernetes/revert-31391-container-gc
Revert "Avoid disk eviction node e2e test using up all the disk space"
parents
6eb279ee
24e81af7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
78 deletions
+46
-78
disk_eviction_test.go
test/e2e_node/disk_eviction_test.go
+0
-32
kubelet_test.go
test/e2e_node/kubelet_test.go
+19
-5
memory_eviction_test.go
test/e2e_node/memory_eviction_test.go
+27
-1
util.go
test/e2e_node/util.go
+0
-40
No files found.
test/e2e_node/disk_eviction_test.go
View file @
a9c6f873
...
...
@@ -110,12 +110,6 @@ var _ = framework.KubeDescribe("Kubelet Eviction Manager [Serial] [Disruptive]",
nodeDiskPressureCondition
:=
false
podRescheduleable
:=
false
Eventually
(
func
()
error
{
// Avoid the test using up all the disk space
err
:=
checkDiskUsage
(
0.05
)
if
err
!=
nil
{
return
err
}
// The pod should be evicted.
if
!
evictionOccurred
{
podData
,
err
:=
podClient
.
Get
(
busyPodName
)
...
...
@@ -233,29 +227,3 @@ func isImageSupported() bool {
// instead of skipping images the eviction thresholds should be adjusted based on the images.
return
strings
.
Contains
(
framework
.
TestContext
.
NodeName
,
"-gci-dev-"
)
}
// checkDiskUsage verifies that the available bytes on disk are above the limit.
func
checkDiskUsage
(
limit
float64
)
error
{
summary
,
err
:=
getNodeSummary
()
if
err
!=
nil
{
return
err
}
if
nodeFs
:=
summary
.
Node
.
Fs
;
nodeFs
!=
nil
{
if
nodeFs
.
AvailableBytes
!=
nil
&&
nodeFs
.
CapacityBytes
!=
nil
{
if
float64
(
*
nodeFs
.
CapacityBytes
)
*
limit
>
float64
(
*
nodeFs
.
AvailableBytes
)
{
return
fmt
.
Errorf
(
"available nodefs byte is less than %v%%"
,
int
(
limit
)
*
100
)
}
}
}
if
summary
.
Node
.
Runtime
!=
nil
{
if
imageFs
:=
summary
.
Node
.
Runtime
.
ImageFs
;
imageFs
!=
nil
{
if
float64
(
*
imageFs
.
CapacityBytes
)
*
limit
>
float64
(
*
imageFs
.
AvailableBytes
)
{
return
fmt
.
Errorf
(
"available imagefs byte is less than %v%%"
,
int
(
limit
)
*
100
)
}
}
}
return
nil
}
test/e2e_node/kubelet_test.go
View file @
a9c6f873
...
...
@@ -18,7 +18,10 @@ package e2e_node
import
(
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
...
...
@@ -115,20 +118,31 @@ var _ = framework.KubeDescribe("Kubelet", func() {
volumeNamePrefix
:=
"test-empty-dir"
podNames
,
volumes
:=
createSummaryTestPods
(
f
.
PodClient
(),
podNamePrefix
,
2
,
volumeNamePrefix
)
By
(
"Returning stats summary"
)
summary
:=
stats
.
Summary
{}
Eventually
(
func
()
error
{
summary
,
err
:=
getNodeSummary
(
)
resp
,
err
:=
http
.
Get
(
*
kubeletAddress
+
"/stats/summary"
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"
failed to get node summary:
%v"
,
err
)
return
fmt
.
Errorf
(
"
Failed to get /stats/summary -
%v"
,
err
)
}
missingPods
:=
podsMissingFromSummary
(
*
summary
,
podNames
)
contentsBytes
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Failed to read /stats/summary - %+v"
,
resp
)
}
contents
:=
string
(
contentsBytes
)
decoder
:=
json
.
NewDecoder
(
strings
.
NewReader
(
contents
))
err
=
decoder
.
Decode
(
&
summary
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Failed to parse /stats/summary to go struct: %+v"
,
resp
)
}
missingPods
:=
podsMissingFromSummary
(
summary
,
podNames
)
if
missingPods
.
Len
()
!=
0
{
return
fmt
.
Errorf
(
"expected pods not found. Following pods are missing - %v"
,
missingPods
)
}
missingVolumes
:=
volumesMissingFromSummary
(
*
summary
,
volumes
)
missingVolumes
:=
volumesMissingFromSummary
(
summary
,
volumes
)
if
missingVolumes
.
Len
()
!=
0
{
return
fmt
.
Errorf
(
"expected volumes not found. Following volumes are missing - %v"
,
missingVolumes
)
}
if
err
:=
testSummaryMetrics
(
*
summary
,
podNamePrefix
);
err
!=
nil
{
if
err
:=
testSummaryMetrics
(
summary
,
podNamePrefix
);
err
!=
nil
{
return
err
}
return
nil
...
...
test/e2e_node/memory_eviction_test.go
View file @
a9c6f873
...
...
@@ -17,13 +17,18 @@ limitations under the License.
package
e2e_node
import
(
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
"time"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats"
"k8s.io/kubernetes/test/e2e/framework"
.
"github.com/onsi/ginkgo"
...
...
@@ -101,8 +106,29 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
Eventually
(
func
()
bool
{
glog
.
Infof
(
"Waiting for available memory to decrease to a reasonable level before ending the test."
)
summary
,
err
:=
getNodeSummary
()
summary
:=
stats
.
Summary
{}
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
"GET"
,
"http://localhost:10255/stats/summary"
,
nil
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to build http request: %v"
,
err
)
return
false
}
req
.
Header
.
Add
(
"Accept"
,
"application/json"
)
resp
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to get /stats/summary: %v"
,
err
)
return
false
}
contentsBytes
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to read /stats/summary: %+v"
,
resp
)
return
false
}
contents
:=
string
(
contentsBytes
)
decoder
:=
json
.
NewDecoder
(
strings
.
NewReader
(
contents
))
err
=
decoder
.
Decode
(
&
summary
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to parse /stats/summary to go struct: %+v"
,
resp
)
return
false
}
if
summary
.
Node
.
Memory
.
AvailableBytes
==
nil
{
...
...
test/e2e_node/util.go
View file @
a9c6f873
...
...
@@ -17,15 +17,7 @@ limitations under the License.
package
e2e_node
import
(
"encoding/json"
"flag"
"io/ioutil"
"net/http"
"strings"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats"
)
// TODO(random-liu): Get this automatically from kubelet flag.
...
...
@@ -33,35 +25,3 @@ var kubeletAddress = flag.String("kubelet-address", "http://127.0.0.1:10255", "H
var
startServices
=
flag
.
Bool
(
"start-services"
,
true
,
"If true, start local node services"
)
var
stopServices
=
flag
.
Bool
(
"stop-services"
,
true
,
"If true, stop local node services after running tests"
)
func
getNodeSummary
()
(
*
stats
.
Summary
,
error
)
{
req
,
err
:=
http
.
NewRequest
(
"GET"
,
*
kubeletAddress
+
"/stats/summary"
,
nil
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to build http request: %v"
,
err
)
return
nil
,
err
}
req
.
Header
.
Add
(
"Accept"
,
"application/json"
)
client
:=
&
http
.
Client
{}
resp
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to get /stats/summary: %v"
,
err
)
return
nil
,
err
}
defer
resp
.
Body
.
Close
()
contentsBytes
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to read /stats/summary: %+v"
,
resp
)
return
nil
,
err
}
decoder
:=
json
.
NewDecoder
(
strings
.
NewReader
(
string
(
contentsBytes
)))
summary
:=
stats
.
Summary
{}
err
=
decoder
.
Decode
(
&
summary
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to parse /stats/summary to go struct: %+v"
,
resp
)
return
nil
,
err
}
return
&
summary
,
nil
}
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