-
Notifications
You must be signed in to change notification settings - Fork 1k
feature(karmadactl): support split secret layout in init command #6788
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary of ChangesHello @tiansuo114, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant enhancement to the Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Pull Request Overview
This PR adds support for a split secret layout in the karmadactl init
command, allowing Karmada components to be deployed with per-component TLS secrets instead of a single aggregated secret. This provides more granular and secure certificate management.
Key changes:
- Added
--secret-layout
flag to control certificate secret organization (legacy vs split) - Implemented split layout certificate generation creating separate TLS secrets per component
- Updated deployment manifests to mount appropriate secrets based on layout mode
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pkg/karmadactl/cmdinit/cmdinit.go | Added --secret-layout command line flag |
pkg/karmadactl/cmdinit/config/types.go | Added SecretLayout field to KarmadaInitSpec configuration |
pkg/karmadactl/cmdinit/kubernetes/deploy.go | Implemented split certificate secret creation logic |
pkg/karmadactl/cmdinit/kubernetes/deployments.go | Updated deployments to support split secret mounting |
pkg/karmadactl/cmdinit/kubernetes/statefulset.go | Modified etcd StatefulSet for split secret layout |
pkg/cert/constants.go | New file defining TLS secret names and key constants |
pkg/karmadactl/cmdinit/kubernetes/deployments_test.go | Added comprehensive tests for split layout functionality |
pkg/karmadactl/cmdinit/kubernetes/statefulset_test.go | Added tests for etcd split secret configuration |
hack/cli-testing-environment-split-secret.sh | Test script for split secret environment setup |
.github/workflows/installation-cli.yaml | Added CI workflow for split secret testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
83879fa
to
93d9670
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.
Code Review
This pull request introduces a --secret-layout
flag to the karmadactl init
command, allowing for a split-style secret layout. This is a valuable feature for improving security and manageability by creating per-component TLS secrets instead of a single aggregated one. The implementation is well-structured, with clear separation for the new 'split' layout and the 'legacy' layout, ensuring backward compatibility. The addition of pkg/cert/constants.go
is a good practice for centralizing constants. The changes are also accompanied by thorough tests.
My main feedback revolves around significant code duplication in several functions that generate container commands for Karmada components. Refactoring these functions to eliminate duplication would greatly improve the code's maintainability. I've provided specific suggestions for these areas.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6788 +/- ##
==========================================
- Coverage 45.77% 45.62% -0.15%
==========================================
Files 689 689
Lines 57161 57360 +199
==========================================
+ Hits 26164 26173 +9
- Misses 29371 29517 +146
- Partials 1626 1670 +44
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0a8d2b4
to
f1efd61
Compare
Signed-off-by: tiansuo <[email protected]>
f1efd61
to
6ffe7a3
Compare
The code passed CI/CD and works locally. I'm primarily interested in your feedback regarding scalability and design patterns. What is your opinion on the current architecture? @zhzhuang-zju |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Part of #6670
Which issue(s) this PR fixes:
Fixes #6670
This commit introduces the capability for the
karmadactl init
command to deploy Karmada components using a split-style secret layout.This change is part of a larger effort to refactor the certificate deployment mechanism within the
karmadactl
tool. It allows for a more granular and secure management of component certificates.Special notes for your reviewer:
@chaosi-zju
@zhzhuang-zju
@XiShanYongYe-Chang
Does this PR introduce a user-facing change?: