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

MULTIARCH-3212: Add region mapping config for PowerVS cloud #1454

Closed

Conversation

dharaneeshvrd
Copy link
Member

@dharaneeshvrd dharaneeshvrd commented Jan 13, 2023

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

@openshift-ci openshift-ci bot requested review from soltysh and sttts January 13, 2023 08:10
@dharaneeshvrd
Copy link
Member Author

Copy link
Member

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

few minor changes and also mention the original location of code from where we are moving this code

Comment on lines 103 to 110
found := false
for r := range Regions {
if region == Regions[r].VPCRegion {
found = true
break
}
}
return found
Copy link
Member

Choose a reason for hiding this comment

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

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

Comment on lines 92 to 91
keys := make([]string, len(Regions))
i := 0
for r := range Regions {
keys[i] = r
i++
}
return keys
Copy link
Member

Choose a reason for hiding this comment

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

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

@dharaneeshvrd
Copy link
Member Author

Currently this mapping is placed inside installer repo here - https://github.com/openshift/installer/blob/master/pkg/types/powervs/powervs_regions.go
Once it moved here, we can remove from installer.

@dharaneeshvrd
Copy link
Member Author

@mkumatag Addressed your comments.
@clnperez @Prashanth684
Could you please review this PR when you get a chance?

@Prashanth684
Copy link

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2023
@dharaneeshvrd
Copy link
Member Author

@soltysh @sttts Could you please take a look at this PR?

@mkumatag
Copy link
Member

/assign @sttts

@mjturek
Copy link

mjturek commented Jan 24, 2023

/lgtm

VPCRegion: "br-sao",
Zones: []string{"sao01"},
},
"tor": {

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed tor region.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2023
Zones []string
}

// Regions holds the regions for IBM Power VS, and descriptions used during the survey.
Copy link

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines +76 to +102
// 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
}
Copy link

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.

Copy link
Member Author

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
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 27, 2023

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

@mjturek
Copy link

mjturek commented Jan 30, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2023
@dharaneeshvrd
Copy link
Member Author

/assign @soltysh

@dharaneeshvrd
Copy link
Member Author

@sttts @soltysh
Could you please take a look at this PR and provide your comments?

@dharaneeshvrd dharaneeshvrd changed the title Add region mapping config for PowerVS cloud MULTIARCH-3212: Add region mapping config for PowerVS cloud Feb 6, 2023
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 6, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 6, 2023

@dharaneeshvrd: This pull request references MULTIARCH-3212 which is a valid jira issue.

In response to this:

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.

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 6, 2023

@dharaneeshvrd: This pull request references MULTIARCH-3212 which is a valid jira issue.

In response to this:

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

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{
Copy link
Member

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

Copy link

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?

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 6, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 6, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dharaneeshvrd, mjturek, Prashanth684
Once this PR has been reviewed and has the lgtm label, please ask for approval from soltysh by writing /assign @soltysh in a comment. 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

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 2023
@clnperez
Copy link

clnperez commented May 8, 2023

@mjturek i have forgotten where this discussion landed. should we close this?

@dharaneeshvrd
Copy link
Member Author

I think We can close this one.
@clnperez As per RH team's suggestion we decided to keep the region mapping in IBM's repo here https://github.com/ppc64le-cloud/powervs-utils/blob/main/region.go since it does not have any other major functionality, we thought of keeping it here so we won't need to worry about dependency it would bring when we update a new region.
Yet to change the cluster-image-registry-operator to use region mapping from here.
@mjturek If need openshift/installer can also use this mapping I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants