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

OCPBUGS-10526: pull project name from subnet uri #100

Merged
merged 1 commit into from Mar 28, 2023

Conversation

jluhrsen
Copy link
Contributor

In the case of GCP XPN the subnet project is not the same as the project that is determined from the providerID of the node. That is because the network resources are from a shared-vpc and come from a different "shared" project.

@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 Mar 24, 2023
@openshift-ci-robot
Copy link

@jluhrsen: This pull request references Jira Issue OCPBUGS-10526, which is invalid:

  • expected the bug to target the "4.14.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:

In the case of GCP XPN the subnet project is not the same as the project that is determined from the providerID of the node. That is because the network resources are from a shared-vpc and come from a different "shared" project.

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 openshift-ci bot requested review from dcbw and tssurya March 24, 2023 22:52
@jluhrsen
Copy link
Contributor Author

/assign @kyrtapz

@jluhrsen
Copy link
Contributor Author

/hold

I will add some UT next

@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 Mar 24, 2023
@jluhrsen
Copy link
Contributor Author

/retest

@kyrtapz
Copy link
Contributor

kyrtapz commented Mar 27, 2023

could we go with something like the following instead?

 func (g *GCP) GetNodeEgressIPConfiguration(node *corev1.Node, cloudPrivateIPConfigs []*v1.CloudPrivateIPConfig) ([]*NodeEgressIPConfiguration, error) {
-       project, _, instance, err := g.getInstance(node)
+       _, _, instance, err := g.getInstance(node)
        if err != nil {
                return nil, fmt.Errorf("error retrieving instance associated with node, err: %v", err)
        }
@@ -144,7 +144,7 @@ func (g *GCP) GetNodeEgressIPConfiguration(node *corev1.Node, cloudPrivateIPConf
                config := &NodeEgressIPConfiguration{
                        Interface: networkInterface.Name,
                }
-               v4Subnet, v6Subnet, err := g.getSubnet(project, networkInterface)
+               v4Subnet, v6Subnet, err := g.getSubnet(networkInterface)
                if err != nil {
                        return nil, fmt.Errorf("error retrieving the network interface subnets, err: %v", err)
                }
@@ -184,9 +184,9 @@ func (g *GCP) waitForCompletion(project, zone, opName string) error {
        return nil
 }
 
-func (g *GCP) getSubnet(project string, networkInterface *google.NetworkInterface) (*net.IPNet, *net.IPNet, error) {
+func (g *GCP) getSubnet(networkInterface *google.NetworkInterface) (*net.IPNet, *net.IPNet, error) {
        var v4Subnet, v6Subnet *net.IPNet
-       region, subnet, err := g.parseSubnet(networkInterface.Subnetwork)
+       project, region, subnet, err := g.parseSubnet(networkInterface.Subnetwork)
        if err != nil {
                return nil, nil, err
        }
@@ -279,10 +279,11 @@ func splitGCPNode(node *corev1.Node) (project, zone, instance string, err error)
 // - https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork
 // OR
 // - regions/region/subnetworks/subnetwork
-func (g *GCP) parseSubnet(subnetURL string) (string, string, error) {
+// returns project, region, subnetwork
+func (g *GCP) parseSubnet(subnetURL string) (string, string, string, error) {
        subnetURLParts := strings.Split(subnetURL, "/")
        if len(subnetURLParts) != 11 {
-               return "", "", UnexpectedURIError(subnetURL)
+               return "", "", "", UnexpectedURIError(subnetURL)
        }
-       return subnetURLParts[len(subnetURLParts)-3], subnetURLParts[len(subnetURLParts)-1], nil
+       return subnetURLParts[len(subnetURLParts)-5], subnetURLParts[len(subnetURLParts)-3], subnetURLParts[len(subnetURLParts)-1], nil
 }

parseSubnet already parses the URL so I don't think there is a need to do it again, especially because it is only used in getSubnet that doesn't really need the project arg.

@jluhrsen jluhrsen changed the title OCPBUGS-10526: pull project name from subnet uri pull project name from subnet uri Mar 27, 2023
@openshift-ci-robot openshift-ci-robot removed 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 Mar 27, 2023
@openshift-ci-robot
Copy link

@jluhrsen: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

In response to this:

In the case of GCP XPN the subnet project is not the same as the project that is determined from the providerID of the node. That is because the network resources are from a shared-vpc and come from a different "shared" project.

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.

In the case of GCP XPN the subnet project is not the same
as the project that is determined from the providerID of
the node. That is because the network resources are from
a shared-vpc and come from a different "shared" project.

Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
@jluhrsen
Copy link
Contributor Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 27, 2023
@jluhrsen
Copy link
Contributor Author

could we go with something like the following instead?

 func (g *GCP) GetNodeEgressIPConfiguration(node *corev1.Node, cloudPrivateIPConfigs []*v1.CloudPrivateIPConfig) ([]*NodeEgressIPConfiguration, error) {
-       project, _, instance, err := g.getInstance(node)
+       _, _, instance, err := g.getInstance(node)
        if err != nil {
                return nil, fmt.Errorf("error retrieving instance associated with node, err: %v", err)
        }
@@ -144,7 +144,7 @@ func (g *GCP) GetNodeEgressIPConfiguration(node *corev1.Node, cloudPrivateIPConf
                config := &NodeEgressIPConfiguration{
                        Interface: networkInterface.Name,
                }
-               v4Subnet, v6Subnet, err := g.getSubnet(project, networkInterface)
+               v4Subnet, v6Subnet, err := g.getSubnet(networkInterface)
                if err != nil {
                        return nil, fmt.Errorf("error retrieving the network interface subnets, err: %v", err)
                }
@@ -184,9 +184,9 @@ func (g *GCP) waitForCompletion(project, zone, opName string) error {
        return nil
 }
 
-func (g *GCP) getSubnet(project string, networkInterface *google.NetworkInterface) (*net.IPNet, *net.IPNet, error) {
+func (g *GCP) getSubnet(networkInterface *google.NetworkInterface) (*net.IPNet, *net.IPNet, error) {
        var v4Subnet, v6Subnet *net.IPNet
-       region, subnet, err := g.parseSubnet(networkInterface.Subnetwork)
+       project, region, subnet, err := g.parseSubnet(networkInterface.Subnetwork)
        if err != nil {
                return nil, nil, err
        }
@@ -279,10 +279,11 @@ func splitGCPNode(node *corev1.Node) (project, zone, instance string, err error)
 // - https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork
 // OR
 // - regions/region/subnetworks/subnetwork
-func (g *GCP) parseSubnet(subnetURL string) (string, string, error) {
+// returns project, region, subnetwork
+func (g *GCP) parseSubnet(subnetURL string) (string, string, string, error) {
        subnetURLParts := strings.Split(subnetURL, "/")
        if len(subnetURLParts) != 11 {
-               return "", "", UnexpectedURIError(subnetURL)
+               return "", "", "", UnexpectedURIError(subnetURL)
        }
-       return subnetURLParts[len(subnetURLParts)-3], subnetURLParts[len(subnetURLParts)-1], nil
+       return subnetURLParts[len(subnetURLParts)-5], subnetURLParts[len(subnetURLParts)-3], subnetURLParts[len(subnetURLParts)-1], nil
 }

parseSubnet already parses the URL so I don't think there is a need to do it again, especially because it is only used in getSubnet that doesn't really need the project arg.

done

@jluhrsen
Copy link
Contributor Author

/retest

2 similar comments
@jluhrsen
Copy link
Contributor Author

/retest

@jluhrsen
Copy link
Contributor Author

/retest

@jluhrsen jluhrsen changed the title pull project name from subnet uri OCPBUGS-10526: pull project name from subnet uri Mar 28, 2023
@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 Mar 28, 2023
@openshift-ci-robot
Copy link

@jluhrsen: This pull request references Jira Issue OCPBUGS-10526, which is invalid:

  • expected the bug to target the "4.14.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:

In the case of GCP XPN the subnet project is not the same as the project that is determined from the providerID of the node. That is because the network resources are from a shared-vpc and come from a different "shared" project.

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.

@jluhrsen
Copy link
Contributor Author

/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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Mar 28, 2023
@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Mar 28, 2023
@openshift-ci-robot
Copy link

@jluhrsen: This pull request references Jira Issue OCPBUGS-10526, 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.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @anuragthehatter

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 kubernetes/test-infra repository.

@kyrtapz
Copy link
Contributor

kyrtapz commented Mar 28, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jluhrsen, kyrtapz

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

The pull request process is described 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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2023
@kyrtapz
Copy link
Contributor

kyrtapz commented Mar 28, 2023

e2e-aws-serial fails because of https://issues.redhat.com/browse/OCPBUGS-10841

/override ci/prow/e2e-aws-serial

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 28, 2023

@kyrtapz: Overrode contexts on behalf of kyrtapz: ci/prow/e2e-aws-serial

In response to this:

e2e-aws-serial fails because of https://issues.redhat.com/browse/OCPBUGS-10841

/override ci/prow/e2e-aws-serial

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

openshift-ci bot commented Mar 28, 2023

@jluhrsen: 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/e2e-aws-ovn-serial 1da7e57 link false /test e2e-aws-ovn-serial

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.

@openshift-merge-robot openshift-merge-robot merged commit 327d49c into openshift:master Mar 28, 2023
9 of 10 checks passed
@openshift-ci-robot
Copy link

@jluhrsen: Jira Issue OCPBUGS-10526: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-10526 has been moved to the MODIFIED state.

In response to this:

In the case of GCP XPN the subnet project is not the same as the project that is determined from the providerID of the node. That is because the network resources are from a shared-vpc and come from a different "shared" project.

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.

@jluhrsen
Copy link
Contributor Author

/cherry-pick release-4.13

@openshift-cherrypick-robot

@jluhrsen: new pull request created: #101

In response to this:

/cherry-pick release-4.13

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.

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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants