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
MULTIARCH-3212: Add region mapping config for PowerVS cloud #1454
Conversation
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.
few minor changes and also mention the original location of code from where we are moving this code
found := false | ||
for r := range Regions { | ||
if region == Regions[r].VPCRegion { | ||
found = true | ||
break | ||
} | ||
} | ||
return found |
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.
found := false | |
for r := range Regions { | |
if region == Regions[r].VPCRegion { | |
found = true | |
break | |
} | |
} | |
return found | |
for r := range Regions { | |
if region == Regions[r].VPCRegion { | |
return true | |
} | |
} | |
return false |
keys := make([]string, len(Regions)) | ||
i := 0 | ||
for r := range Regions { | ||
keys[i] = r | ||
i++ | ||
} | ||
return keys |
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.
keys := make([]string, len(Regions)) | |
i := 0 | |
for r := range Regions { | |
keys[i] = r | |
i++ | |
} | |
return keys | |
keys := []string{} | |
for r := range Regions { | |
keys = append(keys, r) | |
} | |
return keys |
2724b03
to
979bb31
Compare
Currently this mapping is placed inside installer repo here - https://github.com/openshift/installer/blob/master/pkg/types/powervs/powervs_regions.go |
@mkumatag Addressed your comments. |
/lgtm |
/assign @sttts |
/lgtm |
VPCRegion: "br-sao", | ||
Zones: []string{"sao01"}, | ||
}, | ||
"tor": { |
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.
can you delete this element?
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.
Removed tor region.
979bb31
to
8316587
Compare
Zones []string | ||
} | ||
|
||
// Regions holds the regions for IBM Power VS, and descriptions used during the survey. |
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.
nit: "the survey" is an IPI term. I change this to:
"Regions provides a mapping between Power VS and IBM Cloud VPC regions."
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.
Fixed.
// VPCRegionForPowerVSRegion returns the VPC region for the specified PowerVS region. | ||
func VPCRegionForPowerVSRegion(region string) (string, error) { | ||
if r, ok := Regions[region]; ok { | ||
return r.VPCRegion, nil | ||
} | ||
|
||
return "", fmt.Errorf("VPC region corresponding to a PowerVS region %s not found ", region) | ||
} | ||
|
||
// RegionShortNames returns the list of region names | ||
func RegionShortNames() []string { | ||
keys := []string{} | ||
for r := range Regions { | ||
keys = append(keys, r) | ||
} | ||
return keys | ||
} | ||
|
||
// ValidateVPCRegion validates that given VPC region is known/tested. | ||
func ValidateVPCRegion(region string) bool { | ||
for r := range Regions { | ||
if region == Regions[r].VPCRegion { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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.
I know these utility functions are useful for IPI, but do they belong in this repo? I'm personally fine with it but would like to hear from others.
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.
Need to use func VPCRegionForPowerVSRegion()
in image registry changes. Need to decide on remaining funcs. I am fine with it too on keeping them here.
This is to keep the region mapping of PowerVS in common package
8316587
to
9178819
Compare
@dharaneeshvrd: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
/assign @soltysh |
@dharaneeshvrd: This pull request references MULTIARCH-3212 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@dharaneeshvrd: This pull request references MULTIARCH-3212 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
} | ||
|
||
// Regions provides a mapping between Power VS and IBM Cloud VPC regions. | ||
var Regions = map[string]Region{ |
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.
This looks like configuration data, not something we'd want to keep in a repository.
/hold
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.
@soltysh For some context this is a mapping between two different cloud services in IBM Cloud. Currently this is in the openshift-installer, but we found that it would need to be referenced by other projects as well. It was then suggested to put it here in a comment in this PR openshift/api#1383
If something like this doesn't belong here, could you suggest where it should go?
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dharaneeshvrd, mjturek, Prashanth684 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 |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
@mjturek i have forgotten where this discussion landed. should we close this? |
I think We can close this one. |
This is to keep the region mapping of PowerVS in common package, so all the components can access.
Region mapping is required to derive the location for VPC or COS from PowerVS region, since PowerVS follows different location notation, this mapping is required. With this mapping, user need to pass PowerVS region alone and other resource like VPC's region can be derived from this mapping.
As per @JoelSpeed's suggestion here raised this PR.
Fixes https://issues.redhat.com/browse/MULTIARCH-3212