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

Redact sensitive information from the karmadactl init command output #5714

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhzhuang-zju
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
The karmadactl init command, at the end of the initializtaion, writes some sensitive information in the stdout, like token, in its karmadactl register example. This will bring up two issues:

  • data leak, for instance in CI/CD logs
    image

  • The token's validity period is one day. Users may not join the pull mode member clusters immediately after installing Karmada, causing the secret to expire.

I hope the command output to be how to do rather than what to do. Users can follow the steps in the command output as needed.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
Modified command output:

Register cluster with 'Pull' mode

Step 1: Create bootstrap tokens and get the full 'karmadactl register' flag needed to register the member cluster using the token.
(In karmada)~# karmadactl token create --print-register-command --kubeconfig /etc/init/members/karmada-apiserver.config
karmadactl register [karmada-apiserver-endpoint] --token [token] --discovery-token-ca-cert-hash [ca-cert-hash]

Step 2: Use the output result from step 1 to register the cluster to Karmada control plane. "--cluster-name" is set to cluster of current-context by default.
(In member cluster)~# karmadactl register [karmada-apiserver-endpoint] --token [token] --discovery-token-ca-cert-hash [ca-cert-hash]

Step 3: Show members of karmada
(In karmada)~# karmadactl --kubeconfig /etc/init/members/karmada-apiserver.config get clusters

Does this PR introduce a user-facing change?:


@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 19, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign prodanlabs for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 19, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 39.76%. Comparing base (517cb0d) to head (79840e8).

Files with missing lines Patch % Lines
pkg/karmadactl/cmdinit/kubernetes/deploy.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5714      +/-   ##
==========================================
+ Coverage   39.75%   39.76%   +0.01%     
==========================================
  Files         650      650              
  Lines       55147    55123      -24     
==========================================
- Hits        21924    21922       -2     
+ Misses      31815    31791      -24     
- Partials     1408     1410       +2     
Flag Coverage Δ
unittests 39.76% <90.90%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants