cluster-api-provider-gcp icon indicating copy to clipboard operation
cluster-api-provider-gcp copied to clipboard

Incorrect URI used for subnetwork setup

Open mcastelino opened this issue 5 years ago • 7 comments
trafficstars

/kind bug

What steps did you take and what happened:

Specifying sub network does not work due to incorrect URI being used

https://www.googleapis.com/compute/v1/projects/<project>/regions/<region>/subnetworks/<subnetwork>

It should be subnetworks not subnetwork

diff --git a/cloud/services/compute/instances.go b/cloud/services/compute/instances.go
index dee46ddc..6db51c42 100644
--- a/cloud/services/compute/instances.go
+++ b/cloud/services/compute/instances.go
@@ -138,7 +138,7 @@ func (s *Service) CreateInstance(scope *scope.MachineScope) (*compute.Instance,
        }

        if scope.GCPMachine.Spec.Subnet != nil {
-               input.NetworkInterfaces[0].Subnetwork = fmt.Sprintf("regions/%s/subnetwork/%s",
+               input.NetworkInterfaces[0].Subnetwork = fmt.Sprintf("regions/%s/subnetworks/%s",
                        scope.Region(), *scope.GCPMachine.Spec.Subnet)
        }

What did you expect to happen:

User should be able to create and use custom subnets.

Environment:

  • Cluster-api version: v1 alpha 2 (but the bug is present in master)
  • Minikube/KIND version: 0.7.0
  • Kubernetes version: (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-10T03:03:57Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2020-01-14T00:09:19Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
``
- OS (e.g. from `/etc/os-release`):

NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.3 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic


mcastelino avatar Jan 15 '20 19:01 mcastelino

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

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

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Apr 14 '20 19:04 fejta-bot

/remove-lifecycle stale

detiber avatar Apr 14 '20 19:04 detiber

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

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

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Jul 13 '20 19:07 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

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

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Aug 12 '20 19:08 fejta-bot

/lifecycle frozen

detiber avatar Aug 12 '20 21:08 detiber

Seems to be fixed in https://github.com/kubernetes-sigs/cluster-api-provider-gcp/pull/331 or?

caulagi avatar Jul 15 '22 17:07 caulagi

Agreed this has been fixed.

evanfreed avatar Aug 15 '22 17:08 evanfreed