mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #81931 from RainbowMango/pr_cleanup_staticcheck_issues_for_vsphere
Cleanup vsphere staticcheck issue
This commit is contained in:
commit
f0be447922
@ -250,6 +250,5 @@ vendor/k8s.io/kubectl/pkg/describe/versioned
|
||||
vendor/k8s.io/kubectl/pkg/scale
|
||||
vendor/k8s.io/legacy-cloud-providers/aws
|
||||
vendor/k8s.io/legacy-cloud-providers/azure
|
||||
vendor/k8s.io/legacy-cloud-providers/vsphere
|
||||
vendor/k8s.io/metrics/pkg/client/custom_metrics
|
||||
vendor/k8s.io/sample-controller
|
||||
|
@ -181,10 +181,10 @@ func (nm *NodeManager) DiscoverNode(node *v1.Node) error {
|
||||
}()
|
||||
|
||||
for i := 0; i < POOL_SIZE; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
for res := range queueChannel {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
vm, err := res.datacenter.GetVMByUUID(ctx, nodeUUID)
|
||||
if err != nil {
|
||||
klog.V(4).Infof("Error while looking for vm=%+v in vc=%s and datacenter=%s: %v",
|
||||
@ -195,6 +195,7 @@ func (nm *NodeManager) DiscoverNode(node *v1.Node) error {
|
||||
klog.V(4).Infof("Did not find node %s in vc=%s and datacenter=%s",
|
||||
node.Name, res.vc, res.datacenter.Name())
|
||||
}
|
||||
cancel()
|
||||
continue
|
||||
}
|
||||
if vm != nil {
|
||||
@ -210,12 +211,12 @@ func (nm *NodeManager) DiscoverNode(node *v1.Node) error {
|
||||
for range queueChannel {
|
||||
}
|
||||
setVMFound(true)
|
||||
cancel()
|
||||
break
|
||||
}
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
wg.Add(1)
|
||||
}
|
||||
wg.Wait()
|
||||
if vmFound {
|
||||
|
@ -657,7 +657,7 @@ func (vs *VSphere) NodeAddresses(ctx context.Context, nodeName k8stypes.NodeName
|
||||
// Below logic can be executed only on master as VC details are present.
|
||||
addrs := []v1.NodeAddress{}
|
||||
// Create context
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
vsi, err := vs.getVSphereInstance(nodeName)
|
||||
if err != nil {
|
||||
@ -1640,6 +1640,10 @@ func (vs *VSphere) GetVolumeLabels(volumePath string) (map[string]string, error)
|
||||
return nil, err
|
||||
}
|
||||
dsZones, err = vs.collapseZonesInRegion(ctx, dsZones)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to collapse zones. %v", err)
|
||||
return nil, err
|
||||
}
|
||||
// FIXME: For now, pick the first zone of datastore as the zone of volume
|
||||
labels := make(map[string]string)
|
||||
if len(dsZones) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user