Copilot commented on code in PR #83:
URL:
https://github.com/apache/cloudstack-kubernetes-provider/pull/83#discussion_r2560016685
##########
cloudstack.go:
##########
@@ -190,7 +193,12 @@ func (cs *CSCloud) GetZone(ctx context.Context)
(cloudprovider.Zone, error) {
klog.V(2).Infof("Current zone is %v", cs.zone)
zone.FailureDomain = cs.zone
- zone.Region = cs.zone
+
+ if cs.region == "" {
+ zone.Region = cs.zone
+ } else {
+ zone.Region = cs.region
+ }
Review Comment:
The logic for setting `zone.Region` in `GetZone` now uses the configured
region, but the similar methods `GetZoneByProviderID` (line 223) and
`GetZoneByNodeName` (line 245) still hardcode `zone.Region =
instance.Zonename`. This creates inconsistent behavior where different methods
return different region values for the same cluster.
Consider extracting this logic into a helper method or updating the other
two methods to use the same pattern:
```go
if cs.region == "" {
zone.Region = instance.Zonename
} else {
zone.Region = cs.region
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]