-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Use vcluster auth when passing vcluster flag to user create #86
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: main
Are you sure you want to change the base?
Conversation
Changed Files
|
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.
PR Summary
This PR adds vcluster authentication support to the CLI through a new --vcluster
flag for cluster user management commands.
- Added null check and filtering in
createKubeconfig
to prevent invalid context entries when no user is available for a cluster - Implemented
--vcluster
flag inclusters users add
andclusters config
commands - Added kubectl integration to retrieve vcluster configuration from Kubernetes clusters
- Modified vcluster config to maintain original cluster API URL while using vcluster authentication
- Added fallback mechanism to regular kubeconfig generation if vcluster config retrieval fails
2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
src/lib/clusters/clusters.tsx
Outdated
const { execSync } = require("node:child_process"); | ||
const vclusterConfig = execSync( | ||
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`, | ||
{ encoding: "utf-8" } | ||
); |
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.
style: Using require("node:child_process")
dynamically introduces a runtime dependency that might not be checked at build time. Consider importing at the top of the file.
src/lib/clusters/clusters.tsx
Outdated
const { execSync } = require("node:child_process"); | ||
const vclusterConfig = execSync( | ||
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`, | ||
{ encoding: "utf-8" } | ||
); |
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.
logic: This introduces a hard dependency on kubectl being installed and in the PATH. Need to check for kubectl presence before attempting to use it.
src/lib/clusters/clusters.tsx
Outdated
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`, | ||
{ encoding: "utf-8" } |
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.
style: This command will fail if the user doesn't have permissions to access the secret in the namespace. Add error handling for permission issues.
ef27a97
to
1185797
Compare
No description provided.