Merge pull request #123137 from neolit123/1.30-update-kubelet-validation-fields

kubelet: warn instead of error for unsupported options on Windows
This commit is contained in:
Kubernetes Prow Robot 2024-07-15 19:27:09 -07:00 committed by GitHub
commit eb9b928c23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,24 +20,22 @@ limitations under the License.
package validation package validation
import ( import (
"fmt" "k8s.io/klog/v2"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
) )
// validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid. // validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid.
func validateKubeletOSConfiguration(kc *kubeletconfig.KubeletConfiguration) error { func validateKubeletOSConfiguration(kc *kubeletconfig.KubeletConfiguration) error {
message := "invalid configuration: %v (%v) %v is not supported on Windows" message := "ignored configuration option: %v (%v) %v is not supported on Windows"
allErrors := []error{}
if kc.CgroupsPerQOS { if kc.CgroupsPerQOS {
allErrors = append(allErrors, fmt.Errorf(message, "CgroupsPerQOS", "--cgroups-per-qos", kc.CgroupsPerQOS)) klog.Warningf(message, "CgroupsPerQOS", "--cgroups-per-qos", kc.CgroupsPerQOS)
} }
if len(kc.EnforceNodeAllocatable) > 0 { if len(kc.EnforceNodeAllocatable) > 0 {
allErrors = append(allErrors, fmt.Errorf(message, "EnforceNodeAllocatable", "--enforce-node-allocatable", kc.EnforceNodeAllocatable)) klog.Warningf(message, "EnforceNodeAllocatable", "--enforce-node-allocatable", kc.EnforceNodeAllocatable)
} }
return utilerrors.NewAggregate(allErrors) return nil
} }