Skip to content

Support for systypes w.r.t zones#18

Merged
ppc64le-cloud-bot merged 1 commit intoppc64le-cloud:mainfrom
GunaKKIBM:Systypes-zones
Apr 3, 2025
Merged

Support for systypes w.r.t zones#18
ppc64le-cloud-bot merged 1 commit intoppc64le-cloud:mainfrom
GunaKKIBM:Systypes-zones

Conversation

@GunaKKIBM
Copy link
Copy Markdown
Contributor

@GunaKKIBM GunaKKIBM commented Feb 18, 2025

The changes here lists available systypes against zones.

Fixes #17

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 18, 2025
@mkumatag
Copy link
Copy Markdown
Contributor

/cc @dharaneeshvrd @Karthik-K-N

Copy link
Copy Markdown
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions

  1. Should we add some tests?
  2. Can we mention somewhere in the file, what is the source of truth for this system types against zone. Is it from PowerVS doc?

Comment thread region.go
COSRegion string
Zones []string
SysTypes []string
Zones map[string]SysTypes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked in CAPI and openshift, this isn't a breaking change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks for verifying.

Comment thread region.go Outdated
@@ -287,12 +285,16 @@ func RegionFromZone(zone string) string {
}

// AvailableSysTypes returns the default system type for the zone.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// AvailableSysTypes returns the default system type for the zone.
// AvailableSysTypes returns the supported system type for the zone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread region.go Outdated
Comment on lines +293 to +302
knownZone, ok := Regions[region].Zones[zone]
if !ok {
return nil, fmt.Errorf("unknown zone name provided")
}
return knownZone, nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@GunaKKIBM
Copy link
Copy Markdown
Contributor Author

Couple of questions

  1. Should we add some tests?
  2. Can we mention somewhere in the file, what is the source of truth for this system types against zone. Is it from PowerVS doc?

@Karthik-K-N
I am not quite sure about this being mentioned in docs.

#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.

@Karthik-K-N
Copy link
Copy Markdown
Contributor

Couple of questions

  1. Should we add some tests?
  2. Can we mention somewhere in the file, what is the source of truth for this system types against zone. Is it from PowerVS doc?

@Karthik-K-N I am not quite sure about this being mentioned in docs.

#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.

@dharaneeshvrd
Copy link
Copy Markdown
Contributor

Changes LGTM
Ideally the data should come from this https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-ibm-cloud-reg doc, but its not documented there. Paul has populated the data using the ibmloud cli which underneath use this API https://cloud.ibm.com/apidocs/power-cloud#v1-datacenters-getall, for now we can add this in the code.

@mkumatag mkumatag requested a review from Karthik-K-N April 2, 2025 16:05
@mkumatag
Copy link
Copy Markdown
Contributor

mkumatag commented Apr 2, 2025

@Karthik-K-N @dharaneeshvrd lets review and merge if no further comments

@GunaKKIBM can you please squash the commits?

Copy link
Copy Markdown
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!!

Comment thread region.go Outdated
"strings"
)

// SysTypes denotes the available systypes against individual zones
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// SysTypes denotes the available systypes against individual zones
// SysTypes denotes the available system types against individual zones

Copy link
Copy Markdown
Contributor

@dharaneeshvrd dharaneeshvrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2025
Comment thread region.go
Zones map[string]SysTypes
VPCZones []string
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering so many breaking changes we made to this Region variable, can we make this variable private instead of exposing this to outside world?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I checked if it impacts any other repos, it doesn't

@ppc64le-cloud-bot ppc64le-cloud-bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2025
Copy link
Copy Markdown
Contributor

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2025
@ppc64le-cloud-bot
Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ppc64le-cloud-bot ppc64le-cloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 3, 2025
@ppc64le-cloud-bot ppc64le-cloud-bot merged commit 219b161 into ppc64le-cloud:main Apr 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the e1050 System Type

5 participants