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

Allow for use subnetworks with IPV6_Only stack type and check if cust… #2624

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cezarygerard
Copy link
Contributor

…om subnets of IPv4 services have correct address range

…om subnets of IPv4 services have correct address range

Change-Id: I794be04483a472a5728023427b0002c1e91470b3
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 8, 2024
@cezarygerard
Copy link
Contributor Author

/hold

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cezarygerard

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 k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 8, 2024
@cezarygerard
Copy link
Contributor Author

/assign @panslava

@cezarygerard
Copy link
Contributor Author

/assign @marqc

@k8s-ci-robot
Copy link
Contributor

@cezarygerard: GitHub didn't allow me to assign the following users: marqc.

Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @marqc

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.

@cezarygerard
Copy link
Contributor Author

/assign @mmamczur


func (l4 *L4) serviceSubnetHasInternalIPv4Range() error {
subnetName := l4.subnetName()
hasIPv6SubnetRange, err := utils.SubnetHasIPv4Range(l4.cloud, subnetName, subnetInternalAccessType)
Copy link

Choose a reason for hiding this comment

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

You have IPv6 on the left and IPv4 on the right

if err != nil {
return false, fmt.Errorf("failed getting subnet: %w", err)
}
return subnet.StackType == DualStackSubnetStackType && subnet.Ipv6AccessType == ipv6AccessType, nil
stackTypeMatches := subnet.StackType == DualStackSubnetStackType || subnet.StackType == IPv4SubnetStackType
accessTypeMatches := subnet.Ipv6AccessType == accessType
Copy link

Choose a reason for hiding this comment

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

out of curiosity: is ipv6AccessType relevant for IPv4 subnet?


func (l4netlb *L4NetLB) serviceSubnetHasExternalIPv4Range() error {
subnetName := l4netlb.getSubnetName()
hasIPv6SubnetRange, err := utils.SubnetHasIPv4Range(l4netlb.cloud, subnetName, subnetExternalAccessType)
Copy link

Choose a reason for hiding this comment

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

ditto: IPv6 on the left, IPv4 on the right

@@ -236,6 +236,15 @@ func (l4netlb *L4NetLB) EnsureFrontend(nodeNames []string, svc *corev1.Service)
}
}

// If service requires IPv6 LoadBalancer -- verify that Subnet with External IPv4 ranges is used.
Copy link

Choose a reason for hiding this comment

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

Suggested change
// If service requires IPv6 LoadBalancer -- verify that Subnet with External IPv4 ranges is used.
// If service requires IPv4 LoadBalancer -- verify that Subnet with External IPv4 ranges is used.

@@ -236,6 +236,15 @@ func (l4netlb *L4NetLB) EnsureFrontend(nodeNames []string, svc *corev1.Service)
}
}

// If service requires IPv6 LoadBalancer -- verify that Subnet with External IPv4 ranges is used.
if l4netlb.enableDualStack && utils.NeedsIPv6(svc) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
if l4netlb.enableDualStack && utils.NeedsIPv6(svc) {
if l4netlb.enableDualStack && utils.NeedsIPv4(svc) {

@@ -215,3 +215,19 @@ func (l4 *L4) serviceSubnetHasInternalIPv6Range() error {
}
return nil
}

func (l4 *L4) serviceSubnetHasInternalIPv4Range() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it even called anywhere?

@@ -223,3 +223,19 @@ func (l4netlb *L4NetLB) serviceSubnetHasExternalIPv6Range() error {
}
return nil
}

func (l4netlb *L4NetLB) serviceSubnetHasExternalIPv4Range() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a bit strange to me that function serviceSubnetHasExternalIPv4Range instead of returning bool returns error

reading something like this

err := l4netlb.serviceSubnetHasExternalIPv4Range()

makes you think that error happens when something wrong happened, not when service just doesn't have ExternalIPv4Range

though, I am not strong on this opinion :)

subnet, err := cloud.GetSubnetwork(cloud.Region(), subnetName)
func SubnetHasIPv6Range(gcecloud *gce.Cloud, subnetName, accessType string) (bool, error) {
key := meta.RegionalKey(subnetName, gcecloud.Region())
subnet, err := gcecloud.Compute().AlphaSubnetworks().Get(context.Background(), key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it only available in Alpha?

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants