From 664414cec01c221e2fe500fc174d8f41663de185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80b=C3=A9j=C3=ADd=C3=A9=20=C3=80yod=C3=A9l=C3=A9?= Date: Tue, 30 Apr 2019 23:40:15 +0000 Subject: [PATCH] Clean up cloud-controller-manager. These are based on recommendation from [staticcheck](http://staticcheck.io/). --- cmd/cloud-controller-manager/app/controllermanager.go | 4 ++-- cmd/controller-manager/app/options/generic.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/cloud-controller-manager/app/controllermanager.go b/cmd/cloud-controller-manager/app/controllermanager.go index 26710bbb92..041dd5289b 100644 --- a/cmd/cloud-controller-manager/app/controllermanager.go +++ b/cmd/cloud-controller-manager/app/controllermanager.go @@ -120,8 +120,8 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error klog.Fatalf("cloud provider is nil") } - if cloud.HasClusterID() == false { - if c.ComponentConfig.KubeCloudShared.AllowUntaggedCloud == true { + if !cloud.HasClusterID() { + if c.ComponentConfig.KubeCloudShared.AllowUntaggedCloud { klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues") } else { klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option") diff --git a/cmd/controller-manager/app/options/generic.go b/cmd/controller-manager/app/options/generic.go index 9491ec0a74..59dc678446 100644 --- a/cmd/controller-manager/app/options/generic.go +++ b/cmd/controller-manager/app/options/generic.go @@ -103,9 +103,7 @@ func (o *GenericControllerManagerConfigurationOptions) Validate(allControllers [ if controller == "*" { continue } - if strings.HasPrefix(controller, "-") { - controller = controller[1:] - } + controller = strings.TrimPrefix(controller, "-") if !allControllersSet.Has(controller) { errs = append(errs, fmt.Errorf("%q is not in the list of known controllers", controller)) }