-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WIP: Add option to list all profiles #4512
Conversation
Created a new command `minikube profiles` to list all the available profiles
Hi @djmgit. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can one of the admins verify this patch? |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: djmgit 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 |
I am not sure what is better, something like I could be convinced either way, what others think ? @afbjorklund |
@medyagh I liked the idea of |
} | ||
profiles := make([]string, 0, 4) | ||
for context, _ := range config.Contexts { | ||
profiles = append(profiles, context) |
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.
This is getting all kubecontexts... Inclduing the ones not created by minikube.
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.
@medyagh the contexts which I get via the above way and the profiles present in ~/.minikube/profiles directory. Although it contains the profile created by kubernetes (
minikube
), shouldn't it be shown too? Because it is also there under the profiles directory.
that code will get all the kubectl contexts, so for example if I have a GKE cluster or another k8s cluster, they will be in the list of kubectl config get-contexts, and when you create minikube profile it will create another context.
if you get list of all contexts and show it as list of profiles, it will show my gke cluster or my other k8s cluster as a minikube profile , so it is wrong
@medyagh the contexts which I get via the above way and the profiles present in ~/.minikube/profiles directory. Although it contains the profile created by kubernetes ( |
@medyagh got it, so I should instead list the contents of ~/.minikube/profiles . Will that be the right approach? |
Yes there are a few details :
|
@medyagh Got it.
Does the above look fine? |
Yes that sounds greats, only think to validate the profile I wouldn't just check if config.json is not empty, I would check if it is loadable( parsable to a real config) |
@djmgit this PR needs a rebase, please let me know if you are still working on this PR |
@medyagh I am still on it, got caught up with some other stuff, will update and rebase my PR ASAP. |
no worries, let me know if you need any help on this |
"k8s.io/minikube/pkg/minikube/constants" | ||
) | ||
|
||
// ProfileCmd represents the profile command |
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.
Change "ProfileCmd" to "ProfilesCmd"
return nil, errors.Wrap(err, "Error getting kubeconfig status") | ||
} | ||
profiles := make([]string, 0, 4) | ||
for context, _ := range config.Contexts { |
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.
I guess you are mean: "for _, context := ..." here, is it right?
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.
Pls run make test
before committing the code
Just checking in - would you like any help with moving this PR forward? |
Created a new command
minikube profiles
to listall the available profiles