-
Notifications
You must be signed in to change notification settings - Fork 19
fix: Initialize TUF repository with user-provided PVC #1135
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
Conversation
Reviewer's GuideRefactors the TUF init job controller to leverage label-based job discovery with modular handlers, adjusts job resource creation for GenerateName and correct controller references, wraps init script execution in a bash exit-code handler, and adds end-to-end tests validating PVC-backed repository initialization. Sequence Diagram for TUF Initialization Job Handling LogicsequenceDiagram
participant C as TUF Controller (initJobAction)
participant K8s as Kubernetes API
C->>K8s: List Jobs (using label selector for Tuf instance)
K8s-->>C: JobList or Error
alt Error listing jobs
C-->>C: Handle error, update Tuf Status
else JobList received
alt Multiple init jobs found (len(JobList.Items) > 1)
C-->>C: Handle error (multiple jobs), update Tuf Status (Error)
else Exactly one init job found (len(JobList.Items) == 1)
C-->>C: Call jobPresent(job) // Check existing job's status
alt Job Succeeded (jobUtils.IsCompleted & !jobUtils.IsFailed)
C->>K8s: Update Tuf Status (RepositoryCondition=True, Ready)
else Job Failed (jobUtils.IsCompleted & jobUtils.IsFailed)
C->>K8s: Update Tuf Status (RepositoryCondition=False, Failure)
else Job In Progress
C-->>C: Requeue reconcile
end
else No init job found (len(JobList.Items) == 0)
C-->>C: Call ensureInitJob() // Create new job
C->>K8s: Create Job (metadata.generateName, ownerReferences: Tuf CR, labels)
alt Job Creation Failed
C-->>C: Handle error, update Tuf Status
else Job Creation Succeeded
C-->>C: Requeue reconcile (to monitor new job)
end
end
end
Class Diagram for
|
Change | Details | Files |
---|---|---|
Refactor TUF init job handling to use label selectors and modular helpers |
|
internal/controller/tuf/actions/tuf_init_job.go |
Adjust job creation parameters for uniqueness and proper ownership |
|
internal/controller/tuf/actions/tuf_init_job.go |
Enhance init container invocation with exit-code wrapper |
|
internal/controller/tuf/utils/tuf_init_job.go |
Add integration tests for user-provided PVC TUF initialization |
|
test/e2e/securesign_1855_test.go test/e2e/support/kubernetes/pod.go |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai review
on the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issue
to create an issue from it. - Generate a pull request title: Write
@sourcery-ai
anywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai title
on the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summary
anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summary
on the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guide
on the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolve
on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismiss
on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai review
to trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @bouskaJ - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
0d780af
to
eb47f3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current commit message doesn't follow the Conventional Commits standard. A chore commit type is intended for routine maintenance and tasks that don't modify production code, so feat or fix would be more appropriate here. Please rewrite the commit message to reflect the nature of the changes.
eb47f3b
to
f453ef0
Compare
Signed-off-by: Jan Bouska <[email protected]>
5de3ee6
to
e7bf1f9
Compare
Summary by Sourcery
Enable TUF repository initialization on a user-supplied PVC by overhauling the init job creation and detection logic, refining exit code handling in the job container, and covering the new workflow with integration tests.
New Features:
Enhancements:
Tests: