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
40abe94a
Commit
40abe94a
authored
Apr 23, 2018
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate cgroups-per-qos for windows
parent
86bd9771
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
1 deletion
+112
-1
BUILD
pkg/kubelet/apis/kubeletconfig/validation/BUILD
+38
-1
validation.go
pkg/kubelet/apis/kubeletconfig/validation/validation.go
+4
-0
validation_others.go
...ubelet/apis/kubeletconfig/validation/validation_others.go
+28
-0
validation_windows.go
...belet/apis/kubeletconfig/validation/validation_windows.go
+42
-0
No files found.
pkg/kubelet/apis/kubeletconfig/validation/BUILD
View file @
40abe94a
...
...
@@ -8,7 +8,44 @@ load(
go_library(
name = "go_default_library",
srcs = ["validation.go"],
srcs = [
"validation.go",
] + select({
"@io_bazel_rules_go//go/platform:android": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:darwin": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:linux": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:nacl": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:plan9": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:solaris": [
"validation_others.go",
],
"@io_bazel_rules_go//go/platform:windows": [
"validation_windows.go",
],
"//conditions:default": [],
}),
importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/validation",
deps = [
"//pkg/features:go_default_library",
...
...
pkg/kubelet/apis/kubeletconfig/validation/validation.go
View file @
40abe94a
...
...
@@ -118,5 +118,9 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
"invalid configuration: option %q specified for HairpinMode (--hairpin-mode). Valid options are %q, %q or %q"
,
kc
.
HairpinMode
,
kubeletconfig
.
HairpinNone
,
kubeletconfig
.
HairpinVeth
,
kubeletconfig
.
PromiscuousBridge
))
}
if
err
:=
validateKubeletOSConfiguration
(
kc
);
err
!=
nil
{
allErrors
=
append
(
allErrors
,
err
)
}
return
utilerrors
.
NewAggregate
(
allErrors
)
}
pkg/kubelet/apis/kubeletconfig/validation/validation_others.go
0 → 100644
View file @
40abe94a
// +build !windows
/*
Copyright 2018 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
validation
import
(
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
)
// validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid.
func
validateKubeletOSConfiguration
(
kc
*
kubeletconfig
.
KubeletConfiguration
)
error
{
return
nil
}
pkg/kubelet/apis/kubeletconfig/validation/validation_windows.go
0 → 100644
View file @
40abe94a
// +build windows
/*
Copyright 2018 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
validation
import
(
"fmt"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
)
// validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid.
func
validateKubeletOSConfiguration
(
kc
*
kubeletconfig
.
KubeletConfiguration
)
error
{
message
:=
"invalid configuration: %v (%v) %v is not supported on Windows"
allErrors
:=
[]
error
{}
if
kc
.
CgroupsPerQOS
{
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
message
,
"CgroupsPerQOS"
,
"--cgroups-per-qos"
,
kc
.
CgroupsPerQOS
))
}
if
len
(
kc
.
EnforceNodeAllocatable
)
>
0
{
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
message
,
"EnforceNodeAllocatable"
,
"--enforce-node-allocatable"
,
kc
.
EnforceNodeAllocatable
))
}
return
utilerrors
.
NewAggregate
(
allErrors
)
}
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