Skip to content

Commit

Permalink
fix(alibaba): fix delete command can not release eip without state file
Browse files Browse the repository at this point in the history
Signed-off-by: NewGr8Player <273221594@qq.com>
  • Loading branch information
NewGr8Player authored and rancher-sy-bot committed Oct 14, 2020
1 parent c720981 commit aa661e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/providers/alibaba/alibaba.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,15 @@ func (p *Alibaba) releaseEipAddresses(rollBack bool) {
p.logger.Errorf("[%s] error when query eip address: %v\n", p.GetProviderName(), err)
}

// run delete command without a state file
if !rollBack && len(p.MasterNodes) == 0 && len(p.WorkerNodes) == 0 {
for _, allocationID := range allocationIds {
if err := p.unassociateEipAddress(allocationID); err != nil {
p.logger.Errorf("[%s] error when unassociating eip address %s: %v\n", p.GetProviderName(), allocationID, err)
}
}
}

// eip can be released only when status is `Available`.
// wait eip to be `Available` status.
if err := p.getEipStatus(allocationIds, eipStatusAvailable); err != nil {
Expand Down

0 comments on commit aa661e2

Please sign in to comment.