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

Add ipv6 support. #1024

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add ipv6 support. #1024

wants to merge 12 commits into from

Conversation

axel7born
Copy link
Contributor

How to categorize this PR?

/area networking
/kind enhancement
/platform aws

What this PR does / why we need it:
The PR adds required infrastructure changes to deploy IPv6 shoots.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Add ipv6 support to deploy IPv6 shoots.

@axel7born axel7born requested review from a team as code owners August 5, 2024 15:16
@gardener-robot gardener-robot added the needs/review Needs review label Aug 5, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Aug 5, 2024
@gardener-robot gardener-robot added area/networking Networking related kind/enhancement Enhancement, improvement, extension platform/aws Amazon web services platform/infrastructure size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Aug 5, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Aug 5, 2024
pkg/controller/controlplane/valuesprovider.go Outdated Show resolved Hide resolved
pkg/controller/infrastructure/infraflow/reconcile.go Outdated Show resolved Hide resolved
desired.CidrBlock = *c.config.Networks.VPC.CIDR

if !isIPv4(c.ipFamilies) && c.config.Networks.VPC.CIDR == nil {
desired.CidrBlock = "10.0.0.0/16"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I forgot the outcome of that discussion around this hardcoded IP and it would be nice if here or better in a comment write something about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, it is better not to automatically assign an IPv4 address here and leave that to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though, I need to adapt the validation.

AssignIpv6AddressOnCreation: ptr.To(isIPv6(c.ipFamilies)),
CidrBlock: func(cidr string) string {
if cidr == "" {
return "10.0.32.0/20"
Copy link
Contributor

Choose a reason for hiding this comment

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

also here regarding the "magic IP"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above, it is probably better to let the user configure the CIDR for the public range.

@kon-angelo
Copy link
Contributor

/needs rebase

@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Sep 2, 2024
@@ -1202,6 +1206,79 @@ func (c *Client) DeleteInternetGateway(ctx context.Context, id string) error {
return ignoreNotFound(err)
}

func (c *Client) CreateEgressOnlyInternetGateway(ctx context.Context, gateway *EgressOnlyInternetGateway) (*EgressOnlyInternetGateway, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Public func CreateEgressOnlyInternetGateway should have a describing comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment.

@@ -395,6 +407,18 @@ func generateTerraformInfraConfig(ctx context.Context, infrastructure *extension
dhcpDomainName = fmt.Sprintf("%s.compute.internal", infrastructure.Spec.Region)
}

isIPv4 := true
isIPv6 := false
if sets.New[v1beta1.IPFamily](ipFamilies...).Has(v1beta1.IPFamilyIPv6) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a special reason why we use sets, couldn't we just use slices.Contains() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No special reason, I changed it to slices.Contains().

@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 10, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 11, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 13, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 14, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 19, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 19, 2024
pkg/apis/aws/validation/infrastructure.go Outdated Show resolved Hide resolved
pkg/apis/aws/validation/infrastructure.go Show resolved Hide resolved
pkg/apis/aws/validation/shoot.go Outdated Show resolved Hide resolved
@@ -155,6 +160,7 @@ func NewFlowContext(opts Opts) (*FlowContext, error) {
infra: opts.Infrastructure,
client: opts.AwsClient,
runtimeClient: opts.RuntimeClient,
ipFamilies: opts.IPFamilies,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think you can just do the init here in this func instead of passing it as an opt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get it from c.Shoot.Spec.Networking.IPFamilies, which I don't have here. Or am I missing something?

pkg/controller/infrastructure/infraflow/reconcile.go Outdated Show resolved Hide resolved
Comment on lines 251 to 256
if slices.Contains(c.ipFamilies, v1beta1.IPFamilyIPv6) {
eogw, err := c.client.FindEgressOnlyInternetGatewayByVPC(ctx, vpcID)
if err != nil || eogw == nil {
return fmt.Errorf("Egress-Only Internet Gateway not found for VPC %s", vpcID)
}
c.state.Set(IdentifierEgressOnlyInternetGateway, eogw.EgressOnlyInternetGatewayId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure but you have a separate step for ensure the EOIG, why do it also here.

Also you can add a preflight check in

internetGatewayID, err := awsClient.GetVPCInternetGateway(ctx, vpcID)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The EOIG should be present in case of an existing VPC. In that case the ensure step would not be run. However, I struggle to add it to the preflight check as I don't have Shoot.Spec.Networking.IPFamilies there.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can fetch it with:

	cluster, err := extensionscontroller.GetCluster(ctx, r.client, infrastructure.Namespace)
	if err != nil {
		return reconcile.Result{}, err
	}

pkg/controller/infrastructure/infraflow/reconcile.go Outdated Show resolved Hide resolved
pkg/controller/infrastructure/infraflow/reconcile.go Outdated Show resolved Hide resolved
pkg/controller/infrastructure/infraflow/reconcile.go Outdated Show resolved Hide resolved
@@ -1420,17 +1553,17 @@ func (c *FlowContext) getSubnetKey(item *awsclient.Subnet) (zoneName, subnetKey
for _, key := range []string{IdentifierZoneSubnetWorkers, IdentifierZoneSubnetPublic, IdentifierZoneSubnetPrivate} {
switch key {
case IdentifierZoneSubnetWorkers:
if value == helper.GetSuffixSubnetWorkers() {
if value == fmt.Sprintf("%s-%s", c.namespace, helper.GetSuffixSubnetWorkers()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this value be changed freely ? What happens to existing clusters that have already a state and the key will change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm wondering how this should have worked before. The tag is set here and could have never matched before. Or am I missing something.

@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Sep 24, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 24, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 24, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 25, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 25, 2024
@axel7born
Copy link
Contributor Author

I think I addressed all comments. Could you take a look again, please?

@kon-angelo
Copy link
Contributor

/test

@testmachinery
Copy link

testmachinery bot commented Sep 27, 2024

Testrun: e2e-g5zqw
Workflow: e2e-g5zqw-wf
Phase: Failed

+---------------------+-----------------------------+-----------+----------+
|        NAME         |            STEP             |   PHASE   | DURATION |
+---------------------+-----------------------------+-----------+----------+
| bastion-test        | bastion-test                | Succeeded | 9m4s     |
| dnsrecord-test      | dnsrecord-test              | Succeeded | 5m47s    |
| infrastructure-test | infrastructure-test-tf      | Succeeded | 35m6s    |
| infrastructure-test | infrastructure-test-flow    | Failed    | 26m28s   |
| infrastructure-test | infrastructure-test-migrate | Omitted   | 0s       |
| infrastructure-test | infrastructure-test-recover | Omitted   | 0s       |
+---------------------+-----------------------------+-----------+----------+

@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 27, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 27, 2024
@kon-angelo
Copy link
Contributor

/test

@testmachinery
Copy link

testmachinery bot commented Sep 30, 2024

Testrun: e2e-sfpkj
Workflow: e2e-sfpkj-wf
Phase: Failed

+---------------------+-----------------------------+-----------+----------+
|        NAME         |            STEP             |   PHASE   | DURATION |
+---------------------+-----------------------------+-----------+----------+
| bastion-test        | bastion-test                | Succeeded | 8m6s     |
| dnsrecord-test      | dnsrecord-test              | Succeeded | 5m54s    |
| infrastructure-test | infrastructure-test-tf      | Succeeded | 34m54s   |
| infrastructure-test | infrastructure-test-flow    | Succeeded | 26m20s   |
| infrastructure-test | infrastructure-test-migrate | Failed    | 39m42s   |
| infrastructure-test | infrastructure-test-recover | Omitted   | 0s       |
+---------------------+-----------------------------+-----------+----------+

@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking Networking related kind/enhancement Enhancement, improvement, extension needs/changes Needs (more) changes needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/rebase Needs git rebase needs/review Needs review needs/second-opinion Needs second review by someone else platform/aws Amazon web services platform/infrastructure size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants