Commit 765cdc17 authored by Erik Wilson's avatar Erik Wilson

Fix kubelet --enforce-node-allocatable validation

If --cgroups-per-qos is false and --enforce-node-allocatable is "none" then validation should pass. Needed if cgroup pids is disabled.
parent eed6fd4c
...@@ -18,6 +18,7 @@ package validation ...@@ -18,6 +18,7 @@ package validation
import ( import (
"fmt" "fmt"
utilerrors "k8s.io/apimachinery/pkg/util/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors"
utilvalidation "k8s.io/apimachinery/pkg/util/validation" utilvalidation "k8s.io/apimachinery/pkg/util/validation"
utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeature "k8s.io/apiserver/pkg/util/feature"
...@@ -38,7 +39,8 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error ...@@ -38,7 +39,8 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
if kc.NodeLeaseDurationSeconds <= 0 { if kc.NodeLeaseDurationSeconds <= 0 {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: NodeLeaseDurationSeconds must be greater than 0")) allErrors = append(allErrors, fmt.Errorf("invalid configuration: NodeLeaseDurationSeconds must be greater than 0"))
} }
if !kc.CgroupsPerQOS && len(kc.EnforceNodeAllocatable) > 0 { if !kc.CgroupsPerQOS && len(kc.EnforceNodeAllocatable) > 0 &&
!(len(kc.EnforceNodeAllocatable) == 1 && kc.EnforceNodeAllocatable[0] == kubetypes.NodeAllocatableNoneKey) {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: EnforceNodeAllocatable (--enforce-node-allocatable) is not supported unless CgroupsPerQOS (--cgroups-per-qos) feature is turned on")) allErrors = append(allErrors, fmt.Errorf("invalid configuration: EnforceNodeAllocatable (--enforce-node-allocatable) is not supported unless CgroupsPerQOS (--cgroups-per-qos) feature is turned on"))
} }
if kc.SystemCgroups != "" && kc.CgroupRoot == "" { if kc.SystemCgroups != "" && kc.CgroupRoot == "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment