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

Add support for Instance Alias IP Ranges

Open jwmay2012 opened this issue 1 year ago • 12 comments
trafficstars

What type of PR is this? /kind feature

What this PR does / why we need it: Allows instances to be created with a Secondary Alias IP/CIDR Range configured. https://cloud.google.com/vpc/docs/alias-ip

This enables things like Cilium to use Google Cloud's networks for Native Routing. By giving each pod/service an IP from the Alias IP Range.

TODOs:

  • [X] squashed commits
  • [ ] includes documentation
  • [ ] adds unit tests

Release note:

Add support for Instance Alias IP Ranges. `GCPMachine.Spec.AliasIPRanges` This allows for [Native Routing](https://docs.cilium.io/en/stable/network/concepts/routing/#google-cloud).

jwmay2012 avatar Sep 18 '24 20:09 jwmay2012

Hi @jwmay2012. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

k8s-ci-robot avatar Sep 18 '24 20:09 k8s-ci-robot

Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!

Name Link
Latest commit acb982fb8ec2202717885041227d7d3e06f66795
Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-cluster-api-gcp/deploys/68e94b32f194da000885f1c6
Deploy Preview https://deploy-preview-1314--kubernetes-sigs-cluster-api-gcp.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Sep 18 '24 20:09 netlify[bot]

/ok-to-test

damdo avatar Sep 30 '24 20:09 damdo

Rebased. We're running this code and it's helping us enable Native Routing for our Pods in GCP. Let me know if there's anything else to be done before merge :)

jwmay2012 avatar Oct 22 '24 17:10 jwmay2012

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 20 '25 18:01 k8s-triage-robot

Having the ability to utilize Native Networking in GCP for pods and services from CAPI && CAPG is pretty neat and enabled by being able to configure these Alias IP Ranges. We're still using this for our clusters but would love to get it upstreamed and stop using our custom build :) A pretty standard GCPMachine spec addition and conversion to the existing GCP SDK structs.

Is there something I could do to help move this ticket forward? Thanks :)

jwmay2012 avatar Feb 11 '25 14:02 jwmay2012

I think this would be a good addition. Any thoughts @cpanato @salasberryfin @richardcase ?

damdo avatar Feb 11 '25 15:02 damdo

/retest

jwmay2012 avatar Mar 11 '25 19:03 jwmay2012

It would be great to see this merged. 👍🏽

sl1pm4t avatar Apr 15 '25 05:04 sl1pm4t

@jwmay2012 You might be interested in this change I made in our fork, in relation to this PR: https://github.com/getditto/cluster-api-provider-gcp/commit/50effa68ce3a4c99e3454e5f82b2ab1859a72d2e

It adds a firewall rule allowing traffic from the secondary IP ranges. Necessary if using native routing mode from pods.

sl1pm4t avatar May 08 '25 03:05 sl1pm4t

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jun 07 '25 03:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Jul 07 '25 04:07 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

k8s-ci-robot avatar Jul 07 '25 04:07 k8s-ci-robot

/reopen

sl1pm4t avatar Jul 08 '25 02:07 sl1pm4t

@sl1pm4t: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

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.

k8s-ci-robot avatar Jul 08 '25 02:07 k8s-ci-robot

/reopen

jwmay2012 avatar Jul 08 '25 02:07 jwmay2012

@jwmay2012: Reopened this PR.

In response to this:

/reopen

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.

k8s-ci-robot avatar Jul 08 '25 02:07 k8s-ci-robot

Merged main but this test seems broken.(wont run. other builds have same problem) This should still be good to merge.

jwmay2012 avatar Jul 09 '25 13:07 jwmay2012

@barbacbd are you happy with this?

damdo avatar Jul 18 '25 08:07 damdo

@damdo this is LGTM

barbacbd avatar Aug 05 '25 16:08 barbacbd

@jwmay2012 You might be interested in this change I made in our fork, in relation to this PR: getditto@50effa6

It adds a firewall rule allowing traffic from the secondary IP ranges. Necessary if using native routing mode from pods.

@sl1pm4t We use a SharedVPC and manage our own Subnets and firewalls via terraform. (firewall rule generation is disabled when using a SharedVPC in CAPG) So I won't be able to make or test any firewall rule changes in this PR, unfortunately.

jwmay2012 avatar Sep 23 '25 19:09 jwmay2012

@cpanato @damdo I've added some unit tests and tests that use the API server to validate the CRD regex validation for the fields. Also added some documentation.

Let me know what ya think and if there's anything else needed to get this merged. I'm uncertain what would be required to do a full e2e test, but my changes end where the "google.golang.org/api/compute/v1" SDK begins.

I can say, with this field, GCP Machines are created with Alias IP ranges option on the Network interfaces section with the correct value and function. Our environment uses a SharedVPC subnet created outside CAPG.

jwmay2012 avatar Sep 23 '25 19:09 jwmay2012

/retest

jwmay2012 avatar Sep 29 '25 21:09 jwmay2012

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damdo, jwmay2012

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

k8s-ci-robot avatar Sep 30 '25 13:09 k8s-ci-robot

/retest

jwmay2012 avatar Oct 01 '25 18:10 jwmay2012

@cpanato @salasberryfin @justinsb @barbacbd

Are you able to add your review or LGTM if happy? Thanks!

damdo avatar Oct 09 '25 14:10 damdo

Thanks!

/lgtm

salasberryfin avatar Oct 10 '25 13:10 salasberryfin

Copyright corrected

jwmay2012 avatar Oct 10 '25 20:10 jwmay2012

/label tide/merge-method-squash

damdo avatar Oct 11 '25 08:10 damdo

Re-adding LGTM after feedback addressing

/lgtm

damdo avatar Oct 11 '25 08:10 damdo