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
1a240404
Unverified
Commit
1a240404
authored
Mar 16, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74781 from liggitt/http2-watch
kubelet watch-manager test, restore watch-based manager default
parents
35127578
f2a0c034
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
173 additions
and
3 deletions
+173
-3
defaulted.yaml
...il/config/testdata/defaulting/controlplane/defaulted.yaml
+1
-1
defaulted_non_linux.yaml
...testdata/defaulting/controlplane/defaulted_non_linux.yaml
+1
-1
defaults.go
pkg/kubelet/apis/config/v1beta1/defaults.go
+1
-1
BUILD
test/integration/BUILD
+1
-0
BUILD
test/integration/kubelet/BUILD
+36
-0
main_test.go
test/integration/kubelet/main_test.go
+27
-0
watch_manager_test.go
test/integration/kubelet/watch_manager_test.go
+106
-0
No files found.
cmd/kubeadm/app/util/config/testdata/defaulting/controlplane/defaulted.yaml
View file @
1a240404
...
...
@@ -101,7 +101,7 @@ cgroupsPerQOS: true
clusterDNS
:
-
10.192.0.10
clusterDomain
:
cluster.global
configMapAndSecretChangeDetectionStrategy
:
Cache
configMapAndSecretChangeDetectionStrategy
:
Watch
containerLogMaxFiles
:
5
containerLogMaxSize
:
10Mi
contentType
:
application/vnd.kubernetes.protobuf
...
...
cmd/kubeadm/app/util/config/testdata/defaulting/controlplane/defaulted_non_linux.yaml
View file @
1a240404
...
...
@@ -101,7 +101,7 @@ cgroupsPerQOS: true
clusterDNS
:
-
10.192.0.10
clusterDomain
:
cluster.global
configMapAndSecretChangeDetectionStrategy
:
Cache
configMapAndSecretChangeDetectionStrategy
:
Watch
containerLogMaxFiles
:
5
containerLogMaxSize
:
10Mi
contentType
:
application/vnd.kubernetes.protobuf
...
...
pkg/kubelet/apis/config/v1beta1/defaults.go
View file @
1a240404
...
...
@@ -215,7 +215,7 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
obj
.
ContainerLogMaxFiles
=
utilpointer
.
Int32Ptr
(
5
)
}
if
obj
.
ConfigMapAndSecretChangeDetectionStrategy
==
""
{
obj
.
ConfigMapAndSecretChangeDetectionStrategy
=
kubeletconfigv1beta1
.
TTLCache
ChangeDetectionStrategy
obj
.
ConfigMapAndSecretChangeDetectionStrategy
=
kubeletconfigv1beta1
.
Watch
ChangeDetectionStrategy
}
if
obj
.
EnforceNodeAllocatable
==
nil
{
obj
.
EnforceNodeAllocatable
=
DefaultNodeAllocatableEnforcement
...
...
test/integration/BUILD
View file @
1a240404
...
...
@@ -52,6 +52,7 @@ filegroup(
"//test/integration/framework:all-srcs",
"//test/integration/garbagecollector:all-srcs",
"//test/integration/ipamperf:all-srcs",
"//test/integration/kubelet:all-srcs",
"//test/integration/master:all-srcs",
"//test/integration/metrics:all-srcs",
"//test/integration/objectmeta:all-srcs",
...
...
test/integration/kubelet/BUILD
0 → 100644
View file @
1a240404
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
srcs = [
"main_test.go",
"watch_manager_test.go",
],
tags = ["integration"],
deps = [
"//cmd/kube-apiserver/app/testing:go_default_library",
"//pkg/kubelet/util/manager:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//test/integration/framework:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
test/integration/kubelet/main_test.go
0 → 100644
View file @
1a240404
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
kubelet
import
(
"testing"
"k8s.io/kubernetes/test/integration/framework"
)
func
TestMain
(
m
*
testing
.
M
)
{
framework
.
EtcdMain
(
m
.
Run
)
}
test/integration/kubelet/watch_manager_test.go
0 → 100644
View file @
1a240404
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
kubelet
import
(
"fmt"
"sync"
"testing"
"time"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
kubeapiservertesting
"k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
"k8s.io/kubernetes/pkg/kubelet/util/manager"
"k8s.io/kubernetes/test/integration/framework"
)
func
TestWatchBasedManager
(
t
*
testing
.
T
)
{
server
:=
kubeapiservertesting
.
StartTestServerOrDie
(
t
,
nil
,
nil
,
framework
.
SharedEtcd
())
defer
server
.
TearDownFn
()
server
.
ClientConfig
.
QPS
=
10000
client
,
err
:=
kubernetes
.
NewForConfig
(
server
.
ClientConfig
)
if
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %v"
,
err
)
}
listObj
:=
func
(
namespace
string
,
options
metav1
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
client
.
CoreV1
()
.
Secrets
(
namespace
)
.
List
(
options
)
}
watchObj
:=
func
(
namespace
string
,
options
metav1
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
client
.
CoreV1
()
.
Secrets
(
namespace
)
.
Watch
(
options
)
}
newObj
:=
func
()
runtime
.
Object
{
return
&
v1
.
Secret
{}
}
store
:=
manager
.
NewObjectCache
(
listObj
,
watchObj
,
newObj
,
schema
.
GroupResource
{
Group
:
"v1"
,
Resource
:
"secrets"
})
// create 1000 secrets in parallel
t
.
Log
(
time
.
Now
(),
"creating 1000 secrets"
)
wg
:=
sync
.
WaitGroup
{}
for
i
:=
0
;
i
<
10
;
i
++
{
wg
.
Add
(
1
)
go
func
(
i
int
)
{
defer
wg
.
Done
()
for
j
:=
0
;
j
<
100
;
j
++
{
name
:=
fmt
.
Sprintf
(
"s%d"
,
i
*
100
+
j
)
if
_
,
err
:=
client
.
CoreV1
()
.
Secrets
(
"default"
)
.
Create
(
&
v1
.
Secret
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
name
}});
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
fmt
.
Print
(
"."
)
}(
i
)
}
wg
.
Wait
()
t
.
Log
(
time
.
Now
(),
"finished creating 1000 secrets"
)
// fetch all secrets
wg
=
sync
.
WaitGroup
{}
for
i
:=
0
;
i
<
10
;
i
++
{
wg
.
Add
(
1
)
go
func
(
i
int
)
{
defer
wg
.
Done
()
for
j
:=
0
;
j
<
100
;
j
++
{
name
:=
fmt
.
Sprintf
(
"s%d"
,
i
*
100
+
j
)
start
:=
time
.
Now
()
store
.
AddReference
(
"default"
,
name
)
err
:=
wait
.
PollImmediate
(
10
*
time
.
Millisecond
,
10
*
time
.
Second
,
func
()
(
bool
,
error
)
{
obj
,
err
:=
store
.
Get
(
"default"
,
name
)
if
err
!=
nil
{
t
.
Logf
(
"failed on %s, retrying: %v"
,
name
,
err
)
return
false
,
nil
}
if
obj
.
(
*
v1
.
Secret
)
.
Name
!=
name
{
return
false
,
fmt
.
Errorf
(
"wrong object: %v"
,
obj
.
(
*
v1
.
Secret
)
.
Name
)
}
return
true
,
nil
})
if
err
!=
nil
{
t
.
Fatalf
(
"failed on %s: %v"
,
name
,
err
)
}
if
d
:=
time
.
Now
()
.
Sub
(
start
);
d
>
time
.
Second
{
t
.
Logf
(
"%s took %v"
,
name
,
d
)
}
}
}(
i
)
}
wg
.
Wait
()
}
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