Skip to content
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

Support for systypes w.r.t zones #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GunaKKIBM
Copy link

@GunaKKIBM GunaKKIBM commented Feb 18, 2025

The changes here lists available systypes against zones.

Fixes #17

@ppc64le-cloud-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GunaKKIBM
Once this PR has been reviewed and has the lgtm label, please assign mkumatag for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 18, 2025
@mkumatag
Copy link
Member

/cc @dharaneeshvrd @Karthik-K-N

Copy link
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?

@@ -47,8 +50,7 @@ type Region struct {
Description string
VPCRegion string
COSRegion string
Zones []string
SysTypes []string
Zones map[string]SysTypes
Copy link
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
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
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.

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

// AvailableSysTypes returns the default system type for the zone.
Copy link
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
Author

Choose a reason for hiding this comment

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

Done

region.go Outdated
Comment on lines 293 to 297
knownZone, ok := Regions[region].Zones[zone]
if !ok {
return nil, fmt.Errorf("unknown zone name provided")
}
return knownZone, nil
Copy link
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
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
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
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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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