Skip to content

Add dual-stack IPv4/IPv6 networking support for GCP instances#156

Open
barbacbd wants to merge 1 commit into
openshift:mainfrom
barbacbd:dual-stack-support
Open

Add dual-stack IPv4/IPv6 networking support for GCP instances#156
barbacbd wants to merge 1 commit into
openshift:mainfrom
barbacbd:dual-stack-support

Conversation

@barbacbd

@barbacbd barbacbd commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Enable GCP instances to use dual-stack networking with both IPv4 and IPv6
addresses to support modern networking requirements and IPv6-first environments.

This change extends the GCPNetworkInterface spec to support:

  • StackType field (IPv4Only or DualStack)
  • IPv6AccessType field (External or Internal)
  • Static IPv6 address assignment
  • IPv6 address reporting in Machine status

The reconciler now configures GCP instances with appropriate stack types,
IPv6 access configurations, and extracts both IPv4 and IPv6 addresses
from running instances. Includes validation to ensure IPv6-specific fields
are only used with DualStack configurations.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Note: This commit is temporary and only used for testing. Please be aware that MAPI is being transitioned to CAPI. This is not currently available for GCP.

@barbacbd

barbacbd commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

/hold

@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 Apr 6, 2026
@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: da090c3c-1bff-4f0f-b5d9-09aab85c28ea

📥 Commits

Reviewing files that changed from the base of the PR and between 5358064 and 64bd9be.

⛔ Files ignored due to path filters (30)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/openshift/api/config/v1/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_authentication.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_dns.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_infrastructure.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_cluster_monitoring.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features/features.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/types_gcpprovider.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/modules.txt is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (4)
  • go.mod
  • pkg/cloud/gcp/actuators/machine/reconciler.go
  • pkg/cloud/gcp/actuators/machine/reconciler_test.go
  • pkg/cloud/gcp/actuators/services/compute/computeservice_mock.go
✅ Files skipped from review due to trivial changes (1)
  • go.mod

Walkthrough

Adds GCP dual‑stack IPv6 support across machine reconciliation: NIC StackType mapping, optional IPv6 access configs and addresses, validation for dual‑stack fields, updated cloud-state address reconciliation, expanded tests, a mock setter for instance retrieval, and a go.mod replace directive.

Changes

Cohort / File(s) Summary
Module Configuration
go.mod
Added a replace directive mapping github.com/openshift/api to github.com/barbacbd/api pinned to a specific pseudo‑version/commit.
Machine reconciler (dual‑stack networking)
pkg/cloud/gcp/actuators/machine/reconciler.go
Map API nic.StackType to GCP compute.NetworkInterface.StackType; create Ipv6AccessConfigs for external IPv6 (DIRECT_IPV6) and set Ipv6Address when provided; build nodeAddresses conditionally to include IPv4/IPv6 internal and external addresses; add validation enforcing stackType, allowed ipv6AccessType values, and restrictions on ipv6Address/ipv6AccessType when not dual‑stack.
Tests (dual‑stack cases) & reconciliation test
pkg/cloud/gcp/actuators/machine/reconciler_test.go
Extended table-driven TestCreate with dual‑stack positive/negative cases (StackType, IPv6 access configs, IPv6Address propagation, defaults, validation errors); added TestReconcileMachineWithCloudStateDualStack validating machine.Status.Addresses and provider fields from a mocked dual‑stack GCE instance.
Compute service mock
pkg/cloud/gcp/actuators/services/compute/computeservice_mock.go
Added exported SetMockInstancesGet(fn) to allow overriding the mock's InstancesGet behavior during tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from mdbooth and theobarberbany April 6, 2026 14:45
@openshift-ci

openshift-ci Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

[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 joelspeed for approval. For more information see the Code Review Process.

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

Details 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Around line 130-131: Remove the temporary replace directive that maps
"github.com/openshift/api" to the personal fork (the line starting with replace
github.com/openshift/api => github.com/barbacbd/api ...) from go.mod, ensure the
changes that required that fork are submitted/upstreamed to the official
github.com/openshift/api repository, then update the module graph (run go mod
tidy) and verify the project builds and CI passes so no local replace is
required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2852d1a3-0edf-4523-9693-6c57cf6c4baf

📥 Commits

Reviewing files that changed from the base of the PR and between 0073bd1 and 7728ea7.

⛔ Files ignored due to path filters (30)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/openshift/api/config/v1/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_authentication.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_dns.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_infrastructure.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_cluster_monitoring.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features/features.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/types_gcpprovider.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/modules.txt is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (4)
  • go.mod
  • pkg/cloud/gcp/actuators/machine/reconciler.go
  • pkg/cloud/gcp/actuators/machine/reconciler_test.go
  • pkg/cloud/gcp/actuators/services/compute/computeservice_mock.go

Comment thread go.mod
Comment on lines +130 to +131

replace github.com/openshift/api => github.com/barbacbd/api v0.0.0-20260406135515-7f681bb588e9

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace directive to personal fork must be removed before merge.

This redirects the official github.com/openshift/api to a personal fork. As noted in the PR description, this is temporary for testing. Ensure this replace directive is removed and the changes are upstreamed to the official API repository before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 130 - 131, Remove the temporary replace directive that
maps "github.com/openshift/api" to the personal fork (the line starting with
replace github.com/openshift/api => github.com/barbacbd/api ...) from go.mod,
ensure the changes that required that fork are submitted/upstreamed to the
official github.com/openshift/api repository, then update the module graph (run
go mod tidy) and verify the project builds and CI passes so no local replace is
required.

@barbacbd barbacbd force-pushed the dual-stack-support branch from 7728ea7 to 5358064 Compare April 7, 2026 16:12
  Enable GCP instances to use dual-stack networking with both IPv4 and IPv6
  addresses to support modern networking requirements and IPv6-first environments.

  This change extends the GCPNetworkInterface spec to support:
  - StackType field (IPv4Only or DualStack)
  - IPv6AccessType field (External or Internal)
  - Static IPv6 address assignment
  - IPv6 address reporting in Machine status

  The reconciler now configures GCP instances with appropriate stack types,
  IPv6 access configurations, and extracts both IPv4 and IPv6 addresses
  from running instances. Includes validation to ensure IPv6-specific fields
  are only used with DualStack configurations.

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Note: This commit is temporary and only used for testing. Please be aware that
MAPI is being transitioned to CAPI. This is not currently available for GCP.
@barbacbd barbacbd force-pushed the dual-stack-support branch from 5358064 to 64bd9be Compare April 8, 2026 11:51
@openshift-ci

openshift-ci Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@barbacbd: 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/regression-clusterinfra-gcp-ipi-mapi 64bd9be link false /test regression-clusterinfra-gcp-ipi-mapi

Full PR test history. Your PR dashboard.

Details

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.

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

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant