Skip to content

[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

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

Conversation

romiphadte
Copy link
Contributor

No description provided.

Copy link

semanticdiff-com bot commented Mar 2, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/clusters/clusters.tsx  10% smaller
  src/lib/clusters/kubeconfig.ts  1% smaller

@romiphadte romiphadte changed the title Use vcluster auth when passing vcluster flag to user create [WIP] Use vcluster auth when passing vcluster flag to user create Mar 2, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 in clusters users add and clusters 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

Comment on lines 552 to 556
const { execSync } = require("node:child_process");
const vclusterConfig = execSync(
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`,
{ encoding: "utf-8" }
);
Copy link
Contributor

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.

Comment on lines 552 to 556
const { execSync } = require("node:child_process");
const vclusterConfig = execSync(
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`,
{ encoding: "utf-8" }
);
Copy link
Contributor

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.

Comment on lines 554 to 555
`kubectl get secret ${vclusterName} -n ${namespace} --template={{.data.config}} | base64 --decode`,
{ encoding: "utf-8" }
Copy link
Contributor

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.

@romiphadte romiphadte force-pushed the user/rphadte/use-vcluster-auth branch from ef27a97 to 1185797 Compare March 2, 2025 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant