-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure: Fix creating cluster when zones are not available for the region #1259
Conversation
|
Fixed merge conflicts. :) |
availabilityZones, err := ac.getAvailabilityZones() | ||
if err != nil { | ||
return containerservice.ManagedClusterAgentPoolProfileProperties{}, err | ||
} | ||
|
||
var targetZones *[]string = nil | ||
if availabilityZones != nil && len(*availabilityZones) > 0 { | ||
targetZones = &[]string{ac.Region.Zone} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 AzureDirver.go에서 사전에 확인한 Zone 정보(iConn.Region.Zone)를 활용하는 것은 어떨지 검토 부탁드립니다. Azure 드라이버 내 공통적으로 사용되는 내용일 것으로 추정되며, 일관성을 유지할 필요가 있을 것 같습니다.
cb-spider/cloud-control-manager/cloud-driver/drivers/azure/AzureDriver.go
Lines 282 to 309 in ab555cc
regionZoneHandler, err := iConn.CreateRegionZoneHandler() | |
if err != nil { | |
return nil, err | |
} | |
regionZoneInfo, err := regionZoneHandler.GetRegionZone(connectionInfo.RegionInfo.Region) | |
if err != nil { | |
return nil, err | |
} | |
if len(regionZoneInfo.ZoneList) == 0 { | |
cblog.Warn("Zone is not available for this region. (" + connectionInfo.RegionInfo.Region + ")") | |
iConn.Region.Zone = "" | |
} else { | |
var zoneFound bool | |
for _, zone := range regionZoneInfo.ZoneList { | |
if zone.Name == connectionInfo.RegionInfo.Zone { | |
zoneFound = true | |
break | |
} | |
} | |
if !zoneFound { | |
cblog.Warn("Configured zone is not found in the selected region." + | |
" (Region: " + connectionInfo.RegionInfo.Region + ", Zone: " + connectionInfo.RegionInfo.Zone + ")") | |
cblog.Warn("1 will be used as the default zone.") | |
iConn.Region.Zone = "1" | |
} | |
} |
availabilityZones, err := ac.getAvailabilityZones() | ||
if err != nil { | ||
return containerservice.ManagedClusterAgentPoolProfile{}, err | ||
} | ||
|
||
var targetZones *[]string = nil | ||
if availabilityZones != nil && len(*availabilityZones) > 0 { | ||
targetZones = &[]string{ac.Region.Zone} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상동
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ac.getAvailabilityZones() 함수는 AvailabilityZone 목록을 가져오는 역할을 수행하고
실제로 zone들이 존재하는지 확인 한 후 0보다 클경우
사전에 Connection 정보에 설정된 Zone을 사용합니다.
이미 말씀 하신 사항대로 구동됩니다.
targetZones = &[]string{ac.Region.Zone}
ac.Region.Zone 부분이 Conneciton 에 설정된 Zone 입니다.
cb-spider/cloud-control-manager/cloud-driver/drivers/azure/resources/ClusterHandler.go
Line 1352 in 28a7975
targetZones = &[]string{ac.Region.Zone} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아. 그렇군요.
그렇다면 ac.getAvailabilityZones()를 호출할 필요 없이 ac.Region.Zone 값만 체크하면 되는 건 아닌지요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생각해보니 그래도 될꺼 같네요. 수정해서 반영하겠습니다
LGTM |
Azure
Fix creating cluster when zones are not available for the region
Related Issue: [Azure:PMKS] When availability zone is not supported(WestUS region), it failed to create a kubernetes cluster #1246