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
9c8eab96
Commit
9c8eab96
authored
Feb 08, 2018
by
Michael Taufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bury KubeletConfiguration.ConfigTrialDuration for now
parent
30f54b40
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
39 deletions
+13
-39
helpers_test.go
pkg/kubelet/apis/kubeletconfig/helpers_test.go
+0
-1
types.go
pkg/kubelet/apis/kubeletconfig/types.go
+0
-3
defaults.go
pkg/kubelet/apis/kubeletconfig/v1alpha1/defaults.go
+0
-4
types.go
pkg/kubelet/apis/kubeletconfig/v1alpha1/types.go
+0
-3
zz_generated.conversion.go
...et/apis/kubeletconfig/v1alpha1/zz_generated.conversion.go
+0
-6
zz_generated.deepcopy.go
...elet/apis/kubeletconfig/v1alpha1/zz_generated.deepcopy.go
+0
-10
zz_generated.deepcopy.go
pkg/kubelet/apis/kubeletconfig/zz_generated.deepcopy.go
+0
-1
controller.go
pkg/kubelet/kubeletconfig/controller.go
+4
-1
dynamic_kubelet_config_test.go
test/e2e_node/dynamic_kubelet_config_test.go
+9
-10
No files found.
pkg/kubelet/apis/kubeletconfig/helpers_test.go
View file @
9c8eab96
...
@@ -152,7 +152,6 @@ var (
...
@@ -152,7 +152,6 @@ var (
"CgroupsPerQOS"
,
"CgroupsPerQOS"
,
"ClusterDNS[*]"
,
"ClusterDNS[*]"
,
"ClusterDomain"
,
"ClusterDomain"
,
"ConfigTrialDuration.Duration"
,
"ContentType"
,
"ContentType"
,
"EnableContentionProfiling"
,
"EnableContentionProfiling"
,
"EnableControllerAttachDetach"
,
"EnableControllerAttachDetach"
,
...
...
pkg/kubelet/apis/kubeletconfig/types.go
View file @
9c8eab96
...
@@ -47,9 +47,6 @@ const (
...
@@ -47,9 +47,6 @@ const (
type
KubeletConfiguration
struct
{
type
KubeletConfiguration
struct
{
metav1
.
TypeMeta
metav1
.
TypeMeta
// Only used for dynamic configuration.
// The length of the trial period for this configuration. This configuration will become the last-known-good after this duration.
ConfigTrialDuration
metav1
.
Duration
// podManifestPath is the path to the directory containing pod manifests to
// podManifestPath is the path to the directory containing pod manifests to
// run, or the path to a single manifest file
// run, or the path to a single manifest file
PodManifestPath
string
PodManifestPath
string
...
...
pkg/kubelet/apis/kubeletconfig/v1alpha1/defaults.go
View file @
9c8eab96
...
@@ -45,10 +45,6 @@ func addDefaultingFuncs(scheme *kruntime.Scheme) error {
...
@@ -45,10 +45,6 @@ func addDefaultingFuncs(scheme *kruntime.Scheme) error {
}
}
func
SetDefaults_KubeletConfiguration
(
obj
*
KubeletConfiguration
)
{
func
SetDefaults_KubeletConfiguration
(
obj
*
KubeletConfiguration
)
{
// pointer because the zeroDuration is valid - if you want to skip the trial period
if
obj
.
ConfigTrialDuration
==
nil
{
obj
.
ConfigTrialDuration
=
&
metav1
.
Duration
{
Duration
:
10
*
time
.
Minute
}
}
if
obj
.
Authentication
.
Anonymous
.
Enabled
==
nil
{
if
obj
.
Authentication
.
Anonymous
.
Enabled
==
nil
{
obj
.
Authentication
.
Anonymous
.
Enabled
=
boolVar
(
true
)
obj
.
Authentication
.
Anonymous
.
Enabled
=
boolVar
(
true
)
}
}
...
...
pkg/kubelet/apis/kubeletconfig/v1alpha1/types.go
View file @
9c8eab96
...
@@ -47,9 +47,6 @@ const (
...
@@ -47,9 +47,6 @@ const (
type
KubeletConfiguration
struct
{
type
KubeletConfiguration
struct
{
metav1
.
TypeMeta
`json:",inline"`
metav1
.
TypeMeta
`json:",inline"`
// Only used for dynamic configuration.
// The length of the trial period for this configuration. This configuration will become the last-known-good after this duration.
ConfigTrialDuration
*
metav1
.
Duration
`json:"configTrialDuration"`
// podManifestPath is the path to the directory containing pod manifests to
// podManifestPath is the path to the directory containing pod manifests to
// run, or the path to a single manifest file
// run, or the path to a single manifest file
PodManifestPath
string
`json:"podManifestPath"`
PodManifestPath
string
`json:"podManifestPath"`
...
...
pkg/kubelet/apis/kubeletconfig/v1alpha1/zz_generated.conversion.go
View file @
9c8eab96
...
@@ -141,9 +141,6 @@ func Convert_kubeletconfig_KubeletAuthorization_To_v1alpha1_KubeletAuthorization
...
@@ -141,9 +141,6 @@ func Convert_kubeletconfig_KubeletAuthorization_To_v1alpha1_KubeletAuthorization
}
}
func
autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfiguration
(
in
*
KubeletConfiguration
,
out
*
kubeletconfig
.
KubeletConfiguration
,
s
conversion
.
Scope
)
error
{
func
autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfiguration
(
in
*
KubeletConfiguration
,
out
*
kubeletconfig
.
KubeletConfiguration
,
s
conversion
.
Scope
)
error
{
if
err
:=
v1
.
Convert_Pointer_v1_Duration_To_v1_Duration
(
&
in
.
ConfigTrialDuration
,
&
out
.
ConfigTrialDuration
,
s
);
err
!=
nil
{
return
err
}
out
.
PodManifestPath
=
in
.
PodManifestPath
out
.
PodManifestPath
=
in
.
PodManifestPath
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
...
@@ -266,9 +263,6 @@ func Convert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfiguration
...
@@ -266,9 +263,6 @@ func Convert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfiguration
}
}
func
autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfiguration
(
in
*
kubeletconfig
.
KubeletConfiguration
,
out
*
KubeletConfiguration
,
s
conversion
.
Scope
)
error
{
func
autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfiguration
(
in
*
kubeletconfig
.
KubeletConfiguration
,
out
*
KubeletConfiguration
,
s
conversion
.
Scope
)
error
{
if
err
:=
v1
.
Convert_v1_Duration_To_Pointer_v1_Duration
(
&
in
.
ConfigTrialDuration
,
&
out
.
ConfigTrialDuration
,
s
);
err
!=
nil
{
return
err
}
out
.
PodManifestPath
=
in
.
PodManifestPath
out
.
PodManifestPath
=
in
.
PodManifestPath
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
...
...
pkg/kubelet/apis/kubeletconfig/v1alpha1/zz_generated.deepcopy.go
View file @
9c8eab96
...
@@ -21,7 +21,6 @@ limitations under the License.
...
@@ -21,7 +21,6 @@ limitations under the License.
package
v1alpha1
package
v1alpha1
import
(
import
(
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
runtime
"k8s.io/apimachinery/pkg/runtime"
runtime
"k8s.io/apimachinery/pkg/runtime"
)
)
...
@@ -90,15 +89,6 @@ func (in *KubeletAuthorization) DeepCopy() *KubeletAuthorization {
...
@@ -90,15 +89,6 @@ func (in *KubeletAuthorization) DeepCopy() *KubeletAuthorization {
func
(
in
*
KubeletConfiguration
)
DeepCopyInto
(
out
*
KubeletConfiguration
)
{
func
(
in
*
KubeletConfiguration
)
DeepCopyInto
(
out
*
KubeletConfiguration
)
{
*
out
=
*
in
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
out
.
TypeMeta
=
in
.
TypeMeta
if
in
.
ConfigTrialDuration
!=
nil
{
in
,
out
:=
&
in
.
ConfigTrialDuration
,
&
out
.
ConfigTrialDuration
if
*
in
==
nil
{
*
out
=
nil
}
else
{
*
out
=
new
(
v1
.
Duration
)
**
out
=
**
in
}
}
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
HTTPCheckFrequency
=
in
.
HTTPCheckFrequency
out
.
HTTPCheckFrequency
=
in
.
HTTPCheckFrequency
...
...
pkg/kubelet/apis/kubeletconfig/zz_generated.deepcopy.go
View file @
9c8eab96
...
@@ -80,7 +80,6 @@ func (in *KubeletAuthorization) DeepCopy() *KubeletAuthorization {
...
@@ -80,7 +80,6 @@ func (in *KubeletAuthorization) DeepCopy() *KubeletAuthorization {
func
(
in
*
KubeletConfiguration
)
DeepCopyInto
(
out
*
KubeletConfiguration
)
{
func
(
in
*
KubeletConfiguration
)
DeepCopyInto
(
out
*
KubeletConfiguration
)
{
*
out
=
*
in
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
out
.
TypeMeta
=
in
.
TypeMeta
out
.
ConfigTrialDuration
=
in
.
ConfigTrialDuration
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
SyncFrequency
=
in
.
SyncFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
FileCheckFrequency
=
in
.
FileCheckFrequency
out
.
HTTPCheckFrequency
=
in
.
HTTPCheckFrequency
out
.
HTTPCheckFrequency
=
in
.
HTTPCheckFrequency
...
...
pkg/kubelet/kubeletconfig/controller.go
View file @
9c8eab96
...
@@ -39,6 +39,9 @@ import (
...
@@ -39,6 +39,9 @@ import (
const
(
const
(
checkpointsDir
=
"checkpoints"
checkpointsDir
=
"checkpoints"
// TODO(mtaufen): We may expose this in a future API, but for the time being we use an internal default,
// because it is not especially clear where this should live in the API.
configTrialDuration
=
10
*
time
.
Minute
)
)
// Controller manages syncing dynamic Kubelet configurations
// Controller manages syncing dynamic Kubelet configurations
...
@@ -101,7 +104,7 @@ func (cc *Controller) Bootstrap() (*kubeletconfig.KubeletConfiguration, error) {
...
@@ -101,7 +104,7 @@ func (cc *Controller) Bootstrap() (*kubeletconfig.KubeletConfiguration, error) {
// periodically checks whether the last-known good needs to be updated
// periodically checks whether the last-known good needs to be updated
// we only do this when the assigned config loads and passes validation
// we only do this when the assigned config loads and passes validation
// wait.Forever will call the func once before starting the timer
// wait.Forever will call the func once before starting the timer
go
wait
.
Forever
(
func
()
{
cc
.
checkTrial
(
assigned
.
ConfigTrialDuration
.
Duration
)
},
10
*
time
.
Second
)
go
wait
.
Forever
(
func
()
{
cc
.
checkTrial
(
configTrial
Duration
)
},
10
*
time
.
Second
)
return
assigned
,
nil
return
assigned
,
nil
}
// Assert: the assigned config failed to load, parse, or validate
}
// Assert: the assigned config failed to load, parse, or validate
...
...
test/e2e_node/dynamic_kubelet_config_test.go
View file @
9c8eab96
...
@@ -95,10 +95,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -95,10 +95,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
Context
(
"When setting new NodeConfigSources that cause transitions between ConfigOK conditions"
,
func
()
{
Context
(
"When setting new NodeConfigSources that cause transitions between ConfigOK conditions"
,
func
()
{
It
(
"the Kubelet should report the appropriate status and configz"
,
func
()
{
It
(
"the Kubelet should report the appropriate status and configz"
,
func
()
{
var
err
error
var
err
error
// we base the "correct" configmap off of the current configuration,
// we base the "correct" configmap off of the current configuration
// but we also set the trial duration very high to prevent changing the last-known-good
correctKC
:=
originalKC
.
DeepCopy
()
correctKC
:=
originalKC
.
DeepCopy
()
correctKC
.
ConfigTrialDuration
=
metav1
.
Duration
{
Duration
:
time
.
Hour
}
correctConfigMap
:=
newKubeletConfigMap
(
"dynamic-kubelet-config-test-correct"
,
correctKC
)
correctConfigMap
:=
newKubeletConfigMap
(
"dynamic-kubelet-config-test-correct"
,
correctKC
)
correctConfigMap
,
err
=
f
.
ClientSet
.
CoreV1
()
.
ConfigMaps
(
"kube-system"
)
.
Create
(
correctConfigMap
)
correctConfigMap
,
err
=
f
.
ClientSet
.
CoreV1
()
.
ConfigMaps
(
"kube-system"
)
.
Create
(
correctConfigMap
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
...
@@ -209,7 +207,7 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -209,7 +207,7 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
L
:=
len
(
states
)
L
:=
len
(
states
)
for
i
:=
1
;
i
<=
L
;
i
++
{
// need one less iteration than the number of states
for
i
:=
1
;
i
<=
L
;
i
++
{
// need one less iteration than the number of states
testBothDirections
(
f
,
&
states
[
i
-
1
:
i
][
0
],
states
[
i
:
L
])
testBothDirections
(
f
,
&
states
[
i
-
1
:
i
][
0
],
states
[
i
:
L
]
,
0
)
}
}
})
})
...
@@ -218,10 +216,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -218,10 +216,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
Context
(
"When a remote config becomes the new last-known-good, and then the Kubelet is updated to use a new, bad config"
,
func
()
{
Context
(
"When a remote config becomes the new last-known-good, and then the Kubelet is updated to use a new, bad config"
,
func
()
{
It
(
"the Kubelet should report a status and configz indicating that it rolled back to the new last-known-good"
,
func
()
{
It
(
"the Kubelet should report a status and configz indicating that it rolled back to the new last-known-good"
,
func
()
{
var
err
error
var
err
error
// we base the "lkg" configmap off of the current configuration, but set the trial
// we base the "lkg" configmap off of the current configuration
// duration very low so that it quickly becomes the last-known-good
lkgKC
:=
originalKC
.
DeepCopy
()
lkgKC
:=
originalKC
.
DeepCopy
()
lkgKC
.
ConfigTrialDuration
=
metav1
.
Duration
{
Duration
:
time
.
Nanosecond
}
lkgConfigMap
:=
newKubeletConfigMap
(
"dynamic-kubelet-config-test-intended-lkg"
,
lkgKC
)
lkgConfigMap
:=
newKubeletConfigMap
(
"dynamic-kubelet-config-test-intended-lkg"
,
lkgKC
)
lkgConfigMap
,
err
=
f
.
ClientSet
.
CoreV1
()
.
ConfigMaps
(
"kube-system"
)
.
Create
(
lkgConfigMap
)
lkgConfigMap
,
err
=
f
.
ClientSet
.
CoreV1
()
.
ConfigMaps
(
"kube-system"
)
.
Create
(
lkgConfigMap
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
...
@@ -264,7 +260,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -264,7 +260,8 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
},
},
}
}
testBothDirections
(
f
,
&
states
[
0
],
states
[
1
:
])
// wait 12 minutes after setting the first config to ensure it has time to pass the trial duration
testBothDirections
(
f
,
&
states
[
0
],
states
[
1
:
],
12
*
time
.
Minute
)
})
})
})
})
...
@@ -314,7 +311,7 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -314,7 +311,7 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
}
}
for
i
:=
0
;
i
<
50
;
i
++
{
// change the config 101 times (changes 3 times in the first iteration, 2 times in each subsequent iteration)
for
i
:=
0
;
i
<
50
;
i
++
{
// change the config 101 times (changes 3 times in the first iteration, 2 times in each subsequent iteration)
testBothDirections
(
f
,
&
states
[
0
],
states
[
1
:
])
testBothDirections
(
f
,
&
states
[
0
],
states
[
1
:
]
,
0
)
}
}
})
})
})
})
...
@@ -323,13 +320,15 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
...
@@ -323,13 +320,15 @@ var _ = framework.KubeDescribe("DynamicKubeletConfiguration [Feature:DynamicKube
// testBothDirections tests the state change represented by each edge, where each state is a vertex,
// testBothDirections tests the state change represented by each edge, where each state is a vertex,
// and there are edges in each direction between first and each of the states.
// and there are edges in each direction between first and each of the states.
func
testBothDirections
(
f
*
framework
.
Framework
,
first
*
configState
,
states
[]
configState
)
{
func
testBothDirections
(
f
*
framework
.
Framework
,
first
*
configState
,
states
[]
configState
,
waitAfterFirst
time
.
Duration
)
{
// set to first and check that everything got set up properly
// set to first and check that everything got set up properly
By
(
fmt
.
Sprintf
(
"setting configSource to state %q"
,
first
.
desc
))
By
(
fmt
.
Sprintf
(
"setting configSource to state %q"
,
first
.
desc
))
// we don't always expect an event here, because setting "first" might not represent
// we don't always expect an event here, because setting "first" might not represent
// a change from the current configuration
// a change from the current configuration
setAndTestKubeletConfigState
(
f
,
first
,
false
)
setAndTestKubeletConfigState
(
f
,
first
,
false
)
time
.
Sleep
(
waitAfterFirst
)
// for each state, set to that state, check condition and configz, then reset to first and check again
// for each state, set to that state, check condition and configz, then reset to first and check again
for
i
:=
range
states
{
for
i
:=
range
states
{
By
(
fmt
.
Sprintf
(
"from %q to %q"
,
first
.
desc
,
states
[
i
]
.
desc
))
By
(
fmt
.
Sprintf
(
"from %q to %q"
,
first
.
desc
,
states
[
i
]
.
desc
))
...
...
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