mirror of https://github.com/k3s-io/k3s
Merge pull request #45192 from cehoffman/azure_deadlock
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Prevent deadlock on azure zone fetch in presence of failure **What this PR does / why we need it**: This fixes a bug in the Zone get function for the Azure cloud provider. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note Fix deadlock in azure cloud provider zone fetching ```pull/6/head
commit
a6741ea743
|
@ -44,6 +44,7 @@ type instanceInfo struct {
|
||||||
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in
|
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in
|
||||||
func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
|
func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
|
||||||
faultMutex.Lock()
|
faultMutex.Lock()
|
||||||
|
defer faultMutex.Unlock()
|
||||||
if faultDomain == nil {
|
if faultDomain == nil {
|
||||||
var err error
|
var err error
|
||||||
faultDomain, err = fetchFaultDomain()
|
faultDomain, err = fetchFaultDomain()
|
||||||
|
@ -55,7 +56,6 @@ func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
|
||||||
FailureDomain: *faultDomain,
|
FailureDomain: *faultDomain,
|
||||||
Region: az.Location,
|
Region: az.Location,
|
||||||
}
|
}
|
||||||
faultMutex.Unlock()
|
|
||||||
return zone, nil
|
return zone, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue