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

JobSink: Delete secrets associated with jobs when jobs are deleted #8331

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented Nov 18, 2024

As reported in #8323 old
JobSink secrets lead to processing old events again while new events
are lost, even though this should not happen because distinct events
must have different id or source, it's a valid issue as it leaves orphan
secrets.

Using OwnerReference and k8s garbage collection, now a secret created
for a given event is bound to a given Job lifecycle, so that when a job is
deleted, the associated secret will be deleted.

Fixes #8323

Proposed Changes

  • JobSink: Delete secrets associated with jobs when jobs are deleted
  • Create Job before Secret to bind the secret to the Job lifecycle via owner reference

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

JobSink: bind secrets lifecycle to associated jobs lifecycle. Using OwnerReference and k8s garbage collection, now a secret created for a given event is bound to a given Job lifecycle, so that when a job is deleted, the associated secret will be deleted.

Docs

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 18, 2024
@knative-prow knative-prow bot requested review from aliok and mgencur November 18, 2024 10:47
@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test-and-release Test infrastructure, tests or release labels Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 4.34783% with 66 lines in your changes missing coverage. Please review.

Project coverage is 64.58%. Comparing base (bc6e878) to head (97acec1).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/jobsink/main.go 4.34% 66 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8331      +/-   ##
==========================================
- Coverage   64.58%   64.58%   -0.01%     
==========================================
  Files         373      373              
  Lines       22619    22666      +47     
==========================================
+ Hits        14609    14639      +30     
- Misses       7244     7260      +16     
- Partials      766      767       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@pierDipi
Copy link
Member Author

/test unit-tests

As reported in knative#8323 old
JobSink secrets lead to processing old events again while new events
are lost.

Using OwnerReference and k8s garbage collection, now a secret created
for a given event is bound to a given Job lifecycle, so that when a job
is deleted, the associated secret will be deleted.

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
@pierDipi pierDipi changed the title [WIP] JobSink: Delete secrets associated with jobs when jobs are deleted JobSink: Delete secrets associated with jobs when jobs are deleted Nov 19, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 19, 2024
@pierDipi
Copy link
Member Author

/cc @creydr @matzew

@knative-prow knative-prow bot requested review from creydr and matzew November 19, 2024 06:00
@pierDipi
Copy link
Member Author

/cherry-pick release-1.16

@pierDipi
Copy link
Member Author

/cherry-pick release-1.15

@knative-prow-robot
Copy link
Contributor

@pierDipi: once the present PR merges, I will cherry-pick it on top of release-1.16 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.16

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-sigs/prow repository.

@knative-prow-robot
Copy link
Contributor

@pierDipi: once the present PR merges, I will cherry-pick it on top of release-1.15 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.15

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-sigs/prow repository.

Copy link
Member

@matzew matzew 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

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2024
Copy link

knative-prow bot commented Nov 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, pierDipi

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

@knative-prow knative-prow bot merged commit 7abb04d into knative:main Nov 19, 2024
34 of 36 checks passed
@knative-prow-robot
Copy link
Contributor

@pierDipi: new pull request created: #8332

In response to this:

/cherry-pick release-1.16

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-sigs/prow repository.

@knative-prow-robot
Copy link
Contributor

@pierDipi: new pull request created: #8333

In response to this:

/cherry-pick release-1.15

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-sigs/prow 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. area/test-and-release Test infrastructure, tests or release 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.

Old JobSink secrets lead to processing old events again while new events are lost
3 participants