Support for systypes w.r.t zones#18
Conversation
Karthik-K-N
left a comment
There was a problem hiding this comment.
Couple of questions
- Should we add some tests?
- Can we mention somewhere in the file, what is the source of truth for this system types against zone. Is it from PowerVS doc?
| COSRegion string | ||
| Zones []string | ||
| SysTypes []string | ||
| Zones map[string]SysTypes |
There was a problem hiding this comment.
Not sure we should directly update this Zones data type or add an another filed?
May be if we are planning to update it then once merged lets post this change in channel so consumers are aware of this breaking change.
There was a problem hiding this comment.
I have checked in CAPI and openshift, this isn't a breaking change.
There was a problem hiding this comment.
cool, thanks for verifying.
| @@ -287,12 +285,16 @@ func RegionFromZone(zone string) string { | |||
| } | |||
|
|
|||
| // AvailableSysTypes returns the default system type for the zone. | |||
There was a problem hiding this comment.
| // AvailableSysTypes returns the default system type for the zone. | |
| // AvailableSysTypes returns the supported system type for the zone. |
| knownZone, ok := Regions[region].Zones[zone] | ||
| if !ok { | ||
| return nil, fmt.Errorf("unknown zone name provided") | ||
| } | ||
| return knownZone, nil |
There was a problem hiding this comment.
| knownZone, ok := Regions[region].Zones[zone] | |
| if !ok { | |
| return nil, fmt.Errorf("unknown zone name provided") | |
| } | |
| return knownZone, nil | |
| knownRegion, ok := Regions[region] | |
| if !ok { | |
| return nil, fmt.Errorf("unknown region name provided %s", region) | |
| } | |
| supportedSystemTypes, ok := knownRegion.Zones[zone] | |
| if !ok { | |
| return nil, fmt.Errorf("unknown zone name provided %s", zone) | |
| } | |
| return supportedSystemTypes, nil |
Would this make it better?
@Karthik-K-N #17 (comment) - I fetched in from ibmcloud cli as mentioned her. As for the tests, region_test.go isn't updated. I will add the Unit tests, if that is the expectation. |
If you can, I think that would be better. |
|
Changes LGTM |
|
@Karthik-K-N @dharaneeshvrd lets review and merge if no further comments @GunaKKIBM can you please squash the commits? |
Karthik-K-N
left a comment
There was a problem hiding this comment.
Changes LGTM,
also can we mention somewhere in the file how these values are retrived may be like as Dharaneesh mentioned here #18 (comment), So the future contributor wont waste time looking for the info!!
| "strings" | ||
| ) | ||
|
|
||
| // SysTypes denotes the available systypes against individual zones |
There was a problem hiding this comment.
| // SysTypes denotes the available systypes against individual zones | |
| // SysTypes denotes the available system types against individual zones |
721e2a1 to
1b5b8c9
Compare
| Zones map[string]SysTypes | ||
| VPCZones []string | ||
| } | ||
|
|
There was a problem hiding this comment.
Considering so many breaking changes we made to this Region variable, can we make this variable private instead of exposing this to outside world?
There was a problem hiding this comment.
Done. I checked if it impacts any other repos, it doesn't
1b5b8c9 to
7c21b95
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharaneeshvrd, GunaKKIBM, mkumatag The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The changes here lists available systypes against zones.
Fixes #17