mirror of https://github.com/kubernetes/kops.git
Merge pull request #7819 from hwdef/fix-static-check1
pkg: fix static check
This commit is contained in:
commit
2fa12d3dd9
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue