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

Recreate managed resource secrets that have deletion timestamp #8812

Merged
merged 8 commits into from
Nov 15, 2023

Conversation

dimityrmirchev
Copy link
Member

How to categorize this PR?

/area quality
/kind cleanup

What this PR does / why we need it:
In #8398 a fix for unwanted garbage collection of MR secrets was provided, but in some systems there are still such secrets that have deletion timestamp. After #8745 the finalizer that protects them will be gone. This PR introduces a recreation step so gardenlet can recreate these secrets on startup.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
/invite @rfranzke

Thanks for reporting!

Release note:

NONE

@gardener-prow gardener-prow bot added area/quality Output qualification (tests, checks, scans, automation in general, etc.) related kind/cleanup Something that is not needed anymore and can be cleaned up labels Nov 14, 2023
@gardener-prow gardener-prow bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 14, 2023
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Show resolved Hide resolved
return fmt.Errorf("failed to patch the original secret %w", err)
}

goneSecret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: secret.Name, Namespace: secret.Namespace}}
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? You could just continue using secret in the WaitUntilResourceDeleted call?

Copy link
Member Author

Choose a reason for hiding this comment

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

WaitUntilResourceDeleted uses the passed object and continuously modifies it via Get calls. The initial thought was to not modify the passed secret to this function. Either way it is called with argument original.DeepCopy so I guess we can apply your suggestion.

cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
cmd/gardenlet/app/app.go Outdated Show resolved Hide resolved
@dimityrmirchev
Copy link
Member Author

@rfranzke thanks for the review. I implemented most of the suggestions. My only concern with the flow.Parallel() is that these can be many (possibly in the hundreds?) secrets that need to be recreated. I see that the current implementation does not provide a setting to set the degree of parallelism. Wouldn't hundreds of goroutines making calls to the API server cause client or server side throttling in which case we might observe failures?

@rfranzke
Copy link
Member

@rfranzke thanks for the review. I implemented most of the suggestions. My only concern with the flow.Parallel() is that these can be many (possibly in the hundreds?) secrets that need to be recreated. I see that the current implementation does not provide a setting to set the degree of parallelism. Wouldn't hundreds of goroutines making calls to the API server cause client or server side throttling in which case we might observe failures?

Well, I assume that the API server can properly handle a few hundred create/update requests to secrets. This is a one time action anyways and only affects the seed API server and nothing else. I wouldn't be so afraid. These operations are fast and simple (no continuous listing required, etc.). If you still want to limit it, you can follow an easy approach like in https://github.com/gardener/gardener/blob/master/pkg/utils/gardener/secretsrotation/etcd.go#L105-L136 with the rate.NewLimiter and then limiter.Wait in the flow task function, but I think it's overkill. For sure, you should introduce the parallelism, please.

@dimityrmirchev
Copy link
Member Author

@rfranzke Thanks for the rate.Limiter hint. I think that the concerns should be addressed now. PTAL

@dimityrmirchev
Copy link
Member Author

/retest-required

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2023
Copy link
Contributor

gardener-prow bot commented Nov 15, 2023

LGTM label has been added.

Git tree hash: 777fe881dd8ffec7c6af4967bc9f9306acbe6733

Copy link
Contributor

gardener-prow bot commented Nov 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rfranzke

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

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2023
@gardener-prow gardener-prow bot merged commit d0b2a83 into gardener:master Nov 15, 2023
16 checks passed
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. area/quality Output qualification (tests, checks, scans, automation in general, etc.) related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/cleanup Something that is not needed anymore and can be cleaned up lgtm Indicates that a PR is ready to be merged. 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.

2 participants