kubernetes-sigs / cluster-api-provider-gcp

The GCP provider implementation for Cluster API
Apache License 2.0
184 stars 198 forks source link

Incorrect URI used for subnetwork setup #278

Open mcastelino opened 4 years ago

mcastelino commented 4 years ago

/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:

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
fejta-bot commented 4 years ago

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

detiber commented 4 years ago

/remove-lifecycle stale

fejta-bot commented 4 years ago

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 commented 4 years ago

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

detiber commented 4 years ago

/lifecycle frozen

caulagi commented 2 years ago

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

evanfreed commented 2 years ago

Agreed this has been fixed.