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(k8sprocessor): owner meta deletion grace period #1256

Merged
merged 10 commits into from
Oct 9, 2023

Conversation

c-kruse
Copy link
Contributor

@c-kruse c-kruse commented Sep 21, 2023

Adds a deferred deletion queue to the owner metadata cache, allowing time for telemetry data to be processed with correct metadata after the owning resource(s) have been deleted.

Closes #1242

Adds a deferred deletion queue to the owner metadata cache, allowing
time for telemetry data to be processed with correct metadata after the
owning resource(s) have been deleted.

Signed-off-by: Christian Kruse <[email protected]>
@c-kruse c-kruse requested a review from a team as a code owner September 21, 2023 17:06
@github-actions github-actions bot added the go label Sep 21, 2023
Signed-off-by: Christian Kruse <[email protected]>
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Sep 21, 2023
Signed-off-by: Christian Kruse <[email protected]>
Copy link
Collaborator

@echlebek echlebek left a comment

Choose a reason for hiding this comment

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

There seems to be a large amount of commented out code in one of the test files that this PR touches. I would suggest deleting it if possible.

Comment on lines 502 to 511
op.deleteMu.Lock()
for i, d := range op.deleteQueue {
if d.ts.Add(gracePeriod).After(now) {
break
}
cutoff = i + 1
}
toDelete := op.deleteQueue[:cutoff]
op.deleteQueue = op.deleteQueue[cutoff:]
op.deleteMu.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel this is worth its own method, and then the Unlock can be deferred

Signed-off-by: Christian Kruse <[email protected]>
Signed-off-by: Christian Kruse <[email protected]>
@c-kruse
Copy link
Contributor Author

c-kruse commented Sep 21, 2023

@swiatekm-sumo you cool with yanking the commented out benchmarks? They had drifted a bit even before this CL. Saw that you had been "using" them in earlier PR/issue discussion.

@sumo-drosiek sumo-drosiek changed the title fix(k8sprocessor) owner meta deletion grace period fix(k8sprocessor): owner meta deletion grace period Sep 22, 2023
Copy link

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

The overall approach looks good to me. I'd like:

  1. Comments for the new functions
  2. A test that actually measures the deletion delay
  3. Maybe a manual E2E test in Kubernetes to make sure this is ok? I'm not sure this is necessary, but it's not too difficult to do using the Helm Chart integration tests. Let me know if you want to try it, but if not, I'm ok merging this change as-is.

@c-kruse
Copy link
Contributor Author

c-kruse commented Oct 6, 2023

@swiatekm-sumo Updated godocs and tests with assertions on honoring the grace period.

Have dug into the E2E tests and may yet manually validate the change, but had to fight with the test suite a bit to get it up and running.

Signed-off-by: Christian Kruse <[email protected]>
@c-kruse c-kruse merged commit 3e9257f into main Oct 9, 2023
@c-kruse c-kruse deleted the ck/k8sprocessor-owner-meta-deletion branch October 9, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[k8sprocessor] Owner metadata should have a grace period after deletion
3 participants