Skip to content

Conversation

@AshwinHIBM
Copy link
Contributor

Currently if an invalid VPC name is provided in platform.powervs.vpcName, the installer ends up in a segmentation violation. This PR causes the installer to instead error out which is the expected behaviour.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 1, 2025
@openshift-ci-robot
Copy link
Contributor

@AshwinHIBM: This pull request references Jira Issue OCPBUGS-63133, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Currently if an invalid VPC name is provided in platform.powervs.vpcName, the installer ends up in a segmentation violation. This PR causes the installer to instead error out which is the expected behaviour.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from barbacbd and tthvo December 1, 2025 17:51
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 1, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sadasu for approval. For more information see the 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

@prb112
Copy link
Contributor

prb112 commented Dec 1, 2025

/jira refresh

@openshift-ci-robot
Copy link
Contributor

@prb112: This pull request references Jira Issue OCPBUGS-63133, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@prb112
Copy link
Contributor

prb112 commented Dec 1, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 1, 2025
@openshift-ci-robot
Copy link
Contributor

@prb112: This pull request references Jira Issue OCPBUGS-63133, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@prb112
Copy link
Contributor

prb112 commented Dec 1, 2025

/assign @mjturek

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 1, 2025

@AshwinHIBM: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-vsphere-ovn fda3e00 link false /test okd-scos-e2e-vsphere-ovn

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-sigs/prow repository. I understand the commands that are listed here.

Copy link
Contributor

@barbacbd barbacbd left a comment

Choose a reason for hiding this comment

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

I don't know that this is truly solving the nature of the bug. Why is the segmentation fault happening with an unknown vpc.

} else if vpc, err = client.GetVPCByName(ctx, vpcNameOrID); err == nil {
vpcExists = true
} else {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only ever return the error from the else-if directly above. This may take some reworking to get this to where the functionality is correct.

if vpcNameOrID == "" {
	vpcNameOrID = fmt.Sprintf("vpc-%s", clusterID.InfraID)
} else {
    if vpc, err = client.GetVPCByID(ctx, vpcNameOrID, vpcRegion); err == nil {
			vpcNameOrID = *vpc.Name
			vpcExists = true
	} else {
            return err << maybe want to override or add to the error here with fmt.Errorf
    }

    if vpc, err = client.GetVPCByName(ctx, vpcNameOrID); err == nil {
			vpcExists = true
	} else {
            return err << add to error for more info with fmt.Errorf
    }
} 

Logically it could be something like that but there is probably a cleaner way of doing this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GetVPCByID() errors out if there's no VPC with an ID with the value in vpcNameOrID. But vpcNameOrID could be the VPC's name so we can't exit out if GetVPCByID() returns an error since we need to check whether vpcNameOrID is a valid, existing VPC's name. And if GetVPCByName() fails too, I think it's fine to cascade the error returned by GetVPCByName() which is "failed to find VPC vpcNameOrID. Available VPCs: list of available VPC names in the resource group".
Hopefully that makes sense. Please let me know if it's still a concern.

Copy link
Member

Choose a reason for hiding this comment

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

💡 Make sense to me. I guess we can further refactor (if you'd like later on) this chain of if into a function like GetVPCByIDOrName as the same chain is being used in other places.

@AshwinHIBM
Copy link
Contributor Author

Why is the segmentation fault happening with an unknown vpc.

Because a non-existent but non-empty vpcNameOrID gets passed into https://github.com/openshift/installer/blob/b35dbe664be1c5e57be99a4a950fbee0844fc799/pkg/asset/manifests/cloudproviderconfig.go#L355:L367
which causes something further to fail. We must error out instead of proceeding by making it empty because the user likely wants to deploy to an existing VPC but got the name or ID wrong so the installer mustn't create a new VPC.

@tthvo
Copy link
Member

tthvo commented Dec 5, 2025

Because a non-existent but non-empty vpcNameOrID gets passed into https://github.com/openshift/installer/blob/b35dbe664be1c5e57be99a4a950fbee0844fc799/pkg/asset/manifests/cloudproviderconfig.go#L355:L367 which causes something further to fail. We must error out instead of proceeding by making it empty because the user likely wants to deploy to an existing VPC but got the name or ID wrong so the installer mustn't create a new VPC.

Ahh, I see. The segmentation fault is elsewhere in other components (i.e. not within the installer). The fix is to ensure an invalid non-existing VPC ID/Name is rejected and the install process stops early.

Though, I think such check should already be performed in pkg/asset/installconfig/powervs/validation.go before even reaching this far... Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants