Fix formating

This commit is contained in:
Zach Aller 2018-05-16 14:30:10 -05:00
parent 4cb92b7c1e
commit 0a456d3101
3 changed files with 16 additions and 16 deletions

View File

@ -18,13 +18,13 @@ package cloudinstances
import ( import (
"fmt" "fmt"
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/kops/pkg/apis/kops" "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/apis/kops/util"
api "k8s.io/kops/pkg/apis/kops" api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/apis/kops/util"
) )
// CloudInstanceGroup is the cloud backing of InstanceGroup. // CloudInstanceGroup is the cloud backing of InstanceGroup.
@ -87,20 +87,20 @@ func (c *CloudInstanceGroup) Status() string {
// GetNodeMap returns a list of nodes keyed by their external id // GetNodeMap returns a list of nodes keyed by their external id
func GetNodeMap(nodes []v1.Node, cluster *kops.Cluster) map[string]*v1.Node { func GetNodeMap(nodes []v1.Node, cluster *kops.Cluster) map[string]*v1.Node {
sv, _ := util.ParseKubernetesVersion(cluster.Spec.KubernetesVersion) sv, _ := util.ParseKubernetesVersion(cluster.Spec.KubernetesVersion)
nodeMap := make(map[string]*v1.Node) nodeMap := make(map[string]*v1.Node)
for i := range nodes { for i := range nodes {
node := &nodes[i] node := &nodes[i]
//ExternalID is deprecated in kubernetes 1.11 https://github.com/kubernetes/kubernetes/pull/61877 //ExternalID is deprecated in kubernetes 1.11 https://github.com/kubernetes/kubernetes/pull/61877
//Mappings from ExternalID https://github.com/kubernetes/kubernetes/issues/61966#issuecomment-377659476 //Mappings from ExternalID https://github.com/kubernetes/kubernetes/issues/61966#issuecomment-377659476
if sv.Major == 1 && sv.Minor < 10 { if sv.Major == 1 && sv.Minor < 10 {
nodeMap[node.Spec.ExternalID] = node nodeMap[node.Spec.ExternalID] = node
} else { } else {
providerIDs := strings.Split(node.Spec.ProviderID,"/") providerIDs := strings.Split(node.Spec.ProviderID, "/")
instanceID := providerIDs[len(providerIDs)-1] instanceID := providerIDs[len(providerIDs)-1]
nodeMap[instanceID] = node nodeMap[instanceID] = node
} }
} }
return nodeMap return nodeMap

View File

@ -383,7 +383,7 @@ func (c *awsCloudImplementation) GetCloudGroups(cluster *kops.Cluster, instanceg
} }
func getCloudGroups(c AWSCloud, cluster *kops.Cluster, instancegroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) { func getCloudGroups(c AWSCloud, cluster *kops.Cluster, instancegroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) {
nodeMap := cloudinstances.GetNodeMap(nodes, cluster) nodeMap := cloudinstances.GetNodeMap(nodes, cluster)
groups := make(map[string]*cloudinstances.CloudInstanceGroup) groups := make(map[string]*cloudinstances.CloudInstanceGroup)
asgs, err := FindAutoscalingGroups(c, c.Tags()) asgs, err := FindAutoscalingGroups(c, c.Tags())

View File

@ -100,7 +100,7 @@ func getCloudGroups(c GCECloud, cluster *kops.Cluster, instancegroups []*kops.In
project := c.Project() project := c.Project()
ctx := context.Background() ctx := context.Background()
nodesByProviderID := cloudinstances.GetNodeMap(nodes, cluster) nodesByProviderID := cloudinstances.GetNodeMap(nodes, cluster)
// There is some code duplication with resources/gce.go here, but more in the structure than a straight copy-paste // There is some code duplication with resources/gce.go here, but more in the structure than a straight copy-paste
@ -171,7 +171,7 @@ func getCloudGroups(c GCECloud, cluster *kops.Cluster, instancegroups []*kops.In
CloudInstanceGroup: g, CloudInstanceGroup: g,
} }
node := nodesByProviderID[strconv.FormatUint(i.Id, 10)] node := nodesByProviderID[strconv.FormatUint(i.Id, 10)]
if node != nil { if node != nil {
cm.Node = node cm.Node = node
} else { } else {