diff --git a/pkg/apis/kops/validation/instancegroup.go b/pkg/apis/kops/validation/instancegroup.go index 9d9b71098c..9338430e85 100644 --- a/pkg/apis/kops/validation/instancegroup.go +++ b/pkg/apis/kops/validation/instancegroup.go @@ -98,7 +98,7 @@ func ValidateInstanceGroup(g *kops.InstanceGroup) error { // @step: iterate and check the volume specs for i, x := range g.Spec.Volumes { - devices := make(map[string]bool, 0) + devices := make(map[string]bool) path := field.NewPath("volumes").Index(i) if err := validateVolumeSpec(path, x); err != nil { @@ -115,7 +115,7 @@ func ValidateInstanceGroup(g *kops.InstanceGroup) error { // @step: iterate and check the volume mount specs for i, x := range g.Spec.VolumeMounts { - used := make(map[string]bool, 0) + used := make(map[string]bool) path := field.NewPath("volumeMounts").Index(i) if err := validateVolumeMountSpec(path, x); err != nil { diff --git a/pkg/dns/gossip.go b/pkg/dns/gossip.go index 87787664c8..38daf26f68 100644 --- a/pkg/dns/gossip.go +++ b/pkg/dns/gossip.go @@ -21,8 +21,5 @@ import "strings" // TODO: Are .local names necessarily invalid for "real DNS"? Do we need more qualification here? func IsGossipHostname(name string) bool { normalized := "." + strings.TrimSuffix(name, ".") - if strings.HasSuffix(normalized, ".k8s.local") { - return true - } - return false + return strings.HasSuffix(normalized, ".k8s.local") } diff --git a/pkg/drain/cordon.go b/pkg/drain/cordon.go index fc33975266..63d7502aa2 100644 --- a/pkg/drain/cordon.go +++ b/pkg/drain/cordon.go @@ -62,10 +62,7 @@ func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime // or false when no change is needed func (c *CordonHelper) UpdateIfRequired(desired bool) bool { c.desired = desired - if c.node.Spec.Unschedulable == c.desired { - return false - } - return true + return c.node.Spec.Unschedulable != c.desired } // PatchOrReplace uses given clientset to update the node status, either by patching or diff --git a/pkg/model/bootstrapscript.go b/pkg/model/bootstrapscript.go index e5c5832f2a..25afd37498 100644 --- a/pkg/model/bootstrapscript.go +++ b/pkg/model/bootstrapscript.go @@ -181,7 +181,7 @@ func (b *BootstrapScript) ResourceNodeUp(ig *kops.InstanceGroup, cluster *kops.C if ig.IsMaster() { spec["encryptionConfig"] = cs.EncryptionConfig - spec["etcdClusters"] = make(map[string]kops.EtcdClusterSpec, 0) + spec["etcdClusters"] = make(map[string]kops.EtcdClusterSpec) spec["kubeAPIServer"] = cs.KubeAPIServer spec["kubeControllerManager"] = cs.KubeControllerManager spec["kubeScheduler"] = cs.KubeScheduler diff --git a/pkg/model/gcemodel/autoscalinggroup.go b/pkg/model/gcemodel/autoscalinggroup.go index 7f3b6e2dc2..806f20d4d2 100644 --- a/pkg/model/gcemodel/autoscalinggroup.go +++ b/pkg/model/gcemodel/autoscalinggroup.go @@ -170,7 +170,7 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error { // 1) no support in terraform // 2) we can't steer to specific zones AFAICT, only to all zones in the region - targetSizes := make([]int, len(zones), len(zones)) + targetSizes := make([]int, len(zones)) totalSize := 0 for i := range zones { targetSizes[i] = minSize / len(zones) diff --git a/pkg/model/spotinstmodel/instance_group.go b/pkg/model/spotinstmodel/instance_group.go index 164f04f5e2..0cb4ad510f 100644 --- a/pkg/model/spotinstmodel/instance_group.go +++ b/pkg/model/spotinstmodel/instance_group.go @@ -159,29 +159,24 @@ func (b *InstanceGroupModelBuilder) buildElastigroup(c *fi.ModelBuilderContext, if err != nil { return err } - break case InstanceGroupLabelOrientation: group.Orientation = fi.String(v) - break case InstanceGroupLabelUtilizeReservedInstances: group.UtilizeReservedInstances, err = parseBool(v) if err != nil { return err } - break case InstanceGroupLabelFallbackToOnDemand: group.FallbackToOnDemand, err = parseBool(v) if err != nil { return err } - break case InstanceGroupLabelHealthCheckType: group.HealthCheckType = fi.String(strings.ToUpper(v)) - break } } diff --git a/pkg/resources/digitalocean/cloud.go b/pkg/resources/digitalocean/cloud.go index d02e9b2e3a..c92237a6cb 100644 --- a/pkg/resources/digitalocean/cloud.go +++ b/pkg/resources/digitalocean/cloud.go @@ -17,6 +17,7 @@ limitations under the License. package digitalocean import ( + "context" "errors" "fmt" "os" @@ -70,7 +71,7 @@ func NewCloud(region string) (*Cloud, error) { AccessToken: accessToken, } - oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource) + oauthClient := oauth2.NewClient(context.TODO(), tokenSource) client := godo.NewClient(oauthClient) return &Cloud{ diff --git a/pkg/resources/digitalocean/dns/dns.go b/pkg/resources/digitalocean/dns/dns.go index 2c73b9c204..8c36d82343 100644 --- a/pkg/resources/digitalocean/dns/dns.go +++ b/pkg/resources/digitalocean/dns/dns.go @@ -72,7 +72,7 @@ func newClient() (*godo.Client, error) { AccessToken: accessToken, } - oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource) + oauthClient := oauth2.NewClient(context.TODO(), tokenSource) return godo.NewClient(oauthClient), nil }