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

Save Nat Gateways IPs to status on every reconciliation #4508

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

fiunchinho
Copy link
Contributor

@fiunchinho fiunchinho commented Sep 18, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

When we first create the nat gateways, they go to the Pending state. At that point, they don't have a PublicIP just yet. So if we only save the nat gateway public IP to the status field right after creating the nat gateway, we won't have the public IP available, meaning we won't be able to save it to the status.

Now the logic is changed so we always save the NAT Gateways IPs to the status field.

Special notes for your reviewer:

I've tested this version in our management clusters, adding our custom ingress rules and it all worked fine.

There was a missmatch in how the ingress rules were modeled in CAPA and the SDK, making the controller to keep reconciliating the same AWSCluster because the SecurityGroups saved in the field .status.networkStatus.securityGroups never matched the security groups returned by the AWS SDK. Now they match and no extra reconciliations are needed.

Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

Fix how NAT gateways IPs are saved in the status field

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 18, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @fiunchinho. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 18, 2023
Copy link
Member

@AverageMarcus AverageMarcus left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 18, 2023
@fiunchinho fiunchinho changed the title Save natgateways on every reconciliation Save Nat Gateways IPs to status on every reconciliation Sep 18, 2023
@@ -69,6 +69,7 @@ func (s *Service) reconcileNatGateways() error {
return err
}

var natGatewaysIPs []string
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the next line

Suggested change
var natGatewaysIPs []string
natGatewaysIPs := []string{}

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively, the line could change to the var declaration. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Especially because it looks like it could be empty, so no need to pre-initialize 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.

Why is one way preferred over the other? Isn't it a empty slice in both cases?

@fiunchinho
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e-eks

@Ankitasw
Copy link
Member

/test pull-cluster-api-provider-aws-e2e

@Ankitasw
Copy link
Member

@fiunchinho did you test locally to check the status field for NAT gateway IP?

@fiunchinho
Copy link
Contributor Author

Yes, it's saving the IPs on the status field. But the controller is logging errors, because the ingress rules are being wrongly modified by a bug that it's fixed here #4359

@fiunchinho fiunchinho force-pushed the fix-natgateway-status branch 2 times, most recently from 212e934 to 0413cf5 Compare September 21, 2023 15:32
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 21, 2023
@fiunchinho fiunchinho force-pushed the fix-natgateway-status branch from 0413cf5 to c27e4fd Compare September 25, 2023 09:52
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2023
@fiunchinho
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e
/test pull-cluster-api-provider-aws-e2e-eks

@fiunchinho
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e

@k8s-ci-robot
Copy link
Contributor

@fiunchinho: 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
pull-cluster-api-provider-aws-e2e c27e4fd link false /test pull-cluster-api-provider-aws-e2e

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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/test-infra repository. I understand the commands that are listed here.

@Ankitasw
Copy link
Member

@fiunchinho we can ignore this test failure, it's not related to your change

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ankitasw

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2023
@k8s-ci-robot k8s-ci-robot merged commit d26358f into kubernetes-sigs:main Sep 26, 2023
9 checks passed
@richardcase
Copy link
Member

/cherrypick release-2.2

@k8s-infra-cherrypick-robot

@richardcase: new pull request created: #4520

In response to this:

/cherrypick release-2.2

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/test-infra repository.

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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants