Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit ec704c6

Browse files
authored
Merge pull request #15 from baidu/master
update
2 parents 83c4d33 + 993bd82 commit ec704c6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/cloud-provider/instances.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ func (bc *Baiducloud) CurrentNodeName(ctx context.Context, hostname string) (typ
138138
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
139139
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
140140
func (bc *Baiducloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) {
141+
// when node.spec.providerID is not set, providerID is only instanceID, not start with cce://
142+
if !strings.HasPrefix(providerID, bc.ProviderName() + "://") {
143+
providerID = bc.ProviderName() + "://" + providerID
144+
}
141145
splitted := strings.Split(providerID, "//")
142146
if len(splitted) != 2 {
143147
return false, fmt.Errorf("parse ProviderID failed: %v", providerID)

pkg/cloud-provider/load_balancer_blb_backend_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (bc *Baiducloud) reconcileBackendServers(service *v1.Service, nodes []*v1.N
4848
var candidateBackends []blb.BackendServer
4949
for _, node := range nodes {
5050
splitted := strings.Split(node.Spec.ProviderID, "//")
51-
if len(splitted) < 1 {
51+
if len(splitted) != 2 {
5252
glog.Warningf("node %s has no spec.providerId", node.Name)
5353
continue
5454
}

0 commit comments

Comments
 (0)