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

Commit

Permalink
Merge pull request #15 from baidu/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
wccsama authored Jul 9, 2019
2 parents 83c4d33 + 993bd82 commit ec704c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/cloud-provider/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ func (bc *Baiducloud) CurrentNodeName(ctx context.Context, hostname string) (typ
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (bc *Baiducloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) {
// when node.spec.providerID is not set, providerID is only instanceID, not start with cce://
if !strings.HasPrefix(providerID, bc.ProviderName() + "://") {
providerID = bc.ProviderName() + "://" + providerID
}
splitted := strings.Split(providerID, "//")
if len(splitted) != 2 {
return false, fmt.Errorf("parse ProviderID failed: %v", providerID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud-provider/load_balancer_blb_backend_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (bc *Baiducloud) reconcileBackendServers(service *v1.Service, nodes []*v1.N
var candidateBackends []blb.BackendServer
for _, node := range nodes {
splitted := strings.Split(node.Spec.ProviderID, "//")
if len(splitted) < 1 {
if len(splitted) != 2 {
glog.Warningf("node %s has no spec.providerId", node.Name)
continue
}
Expand Down

0 comments on commit ec704c6

Please sign in to comment.