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

Fix reconciliation of user managed public IPs in flow #1052

Merged
merged 5 commits into from
Mar 4, 2025

Conversation

hebelsan
Copy link
Contributor

How to categorize this PR?

/area quality
/kind bug
/platform azure

What this PR does / why we need it:
This PR prevents the deletion of certain user managed public IPs during flow reconciliation after Terraform migration.
It adds a tag to IPs that reside in the shoot namespace and have the shoot prefix but should not be touched by us.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

This PR prevents the deletion of certain user managed public IPs during flow reconciliation after Terraform migration

@gardener-robot gardener-robot added area/quality Output qualification (tests, checks, scans, automation in general, etc.) related kind/bug Bug platform/azure Microsoft Azure platform/infrastructure needs/review Needs review size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) labels Dec 27, 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) 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 Dec 27, 2024
Comment on lines 544 to 584
// TODO(hebelsan) remove in later release because we add the key when creating the object.
if _, ok := target.Tags[ManagedByGardenerTag]; !ok {
target.Tags[ManagedByGardenerTag] = to.Ptr("true")
}

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer a merge of target.Tags into base.Tags in l.541.

@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 Dec 27, 2024
@hebelsan hebelsan marked this pull request as ready for review December 30, 2024 14:15
@hebelsan hebelsan requested review from a team as code owners December 30, 2024 14:15
@hebelsan
Copy link
Contributor Author

Tested migration from terraform to flow with customer managed public IP and shoot prefix name.
The IP is no longer deleted by the flow.

@gardener-robot
Copy link

@hebelsan You need rebase this pull request with latest master branch. Please check.

@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 Jan 14, 2025
@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 Jan 14, 2025
@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 Jan 14, 2025
@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 Jan 14, 2025
@hebelsan
Copy link
Contributor Author

Successfully tested that the public IP stays the same after switching to this controller version.

@gardener-robot gardener-robot added size/s Size of pull request is small (see gardener-robot robot/bots/size.py) and removed size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) labels Mar 3, 2025
@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 Mar 3, 2025
@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 Mar 3, 2025
@kon-angelo
Copy link
Contributor

/test

@testmachinery
Copy link

testmachinery bot commented Mar 3, 2025

Testrun: e2e-qlb6r
Workflow: e2e-qlb6r-wf
Phase: Succeeded

+---------------------+---------------------------+-----------+----------+
|        NAME         |           STEP            |   PHASE   | DURATION |
+---------------------+---------------------------+-----------+----------+
| infrastructure-test | infrastructure-test       | Succeeded | 27m38s   |
| infrastructure-test | infra-flow-test           | Succeeded | 25m49s   |
| infrastructure-test | infra-flow-migration-test | Succeeded | 29m20s   |
| bastion-test        | bastion-test              | Succeeded | 13m35s   |
+---------------------+---------------------------+-----------+----------+

@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 Mar 3, 2025
Copy link
Contributor Author

@hebelsan hebelsan left a comment

Choose a reason for hiding this comment

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

just a few formatting notes

(address.Tags[azure.CCMServiceTagKey] == nil && address.Tags[azure.CCMLegacyServiceTagKey] == nil)
ptr.Deref(address.Tags[TagManagedByGardener], "") == "true" &&
ptr.Deref(address.Tags[TagShootName], "") == fctx.adapter.TechnicalName()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change

@@ -424,6 +427,13 @@ func (fctx *FlowContext) ensurePublicIps(ctx context.Context) error {
// delete all the resources that are not in the list of target resources
pipCfg, ok := desiredConfiguration[name]
if !ok {
// skip deletion of IPs that may fit our criteria, but are referenced explicitly in the shoot spec.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// skip deletion of IPs that may fit our criteria, but are referenced explicitly in the shoot spec.
// skip deletion of IPs that may fit our criteria, but are referenced explicitly in the shoot spec.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be fixed with latest commit. PTAL :)

@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 Mar 3, 2025
Copy link
Contributor

@kon-angelo kon-angelo left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -21,4 +21,7 @@ const (
ChildKeyMigration = "migration"
// ChildKeyComplete is a key to indicate whether a task is complete.
ChildKeyComplete = "complete"

// ManagedByGardenerTag is the tag used to mark resources managed by Gardener.
ManagedByGardenerTag = "managedByGardener"
Copy link
Contributor

Choose a reason for hiding this comment

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

Following CCM standards we could use kebab-case instead.

@@ -424,6 +427,13 @@ func (fctx *FlowContext) ensurePublicIps(ctx context.Context) error {
// delete all the resources that are not in the list of target resources
pipCfg, ok := desiredConfiguration[name]
if !ok {
// skip deletion of IPs that may fit our criteria, but are referenced explicitly in the shoot spec.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be fixed with latest commit. PTAL :)

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/rebase Needs git rebase needs/review Needs review labels Mar 4, 2025
@kon-angelo kon-angelo merged commit 0cf0003 into gardener:master Mar 4, 2025
11 checks passed
@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 Mar 4, 2025
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/quality Output qualification (tests, checks, scans, automation in general, etc.) related kind/bug Bug needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) platform/azure Microsoft Azure platform/infrastructure reviewed/lgtm Has approval for merging reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/s Size of pull request is small (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants