-
Notifications
You must be signed in to change notification settings - Fork 1.3k
previewctl: Wrap shell script that list VMs #10771
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
Conversation
started the job as gitpod-build-as-preview-list-vms.2 because the annotations in the pull request description changed |
@@ -89,3 +95,46 @@ func (p *Preview) GetPreviewName() string { | |||
|
|||
return sanitizedBranch | |||
} | |||
|
|||
func ListAllPreviews() error { | |||
configLoadingRules := &clientcmd.ClientConfigLoadingRules{ExplicitPath: "/home/gitpod/.kube/config"} |
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 think it's safer to use the default rule. If you really want to use this explicit one - then still merging with the default one is a safer option.
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.
Yeah I agree, for some reason it didn't work though 🤔
I tried using:
- ~/.kube/config
- ${HOME}/.kube/config
- $HOME/.kube/config
They all fail with the same error: stat <filepath>: file or directory does not exist
The only way I was able to make this run was by using the explicit path :(
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.
The default path should be in $KUBECONFIG
, but the package provides a way to load from well-known paths. Have a look at the godocs and the examples: https://pkg.go.dev/k8s.io/client-go/tools/clientcmd
Ultimately have one rule loading the default + this one with the explicit and then merge them together.
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.
Ah nice, I was not aware of those defaults. Changed the PR to use them :)
Signed-off-by: ArthurSens <[email protected]>
593d1ff
to
cfd1185
Compare
Signed-off-by: ArthurSens [email protected]
Description
Add command
previewctl list
, which lists all existing preview environments.It is done by re-implementing the shell script
dev/preview/list-vms.sh
but with go and native Kubernetes go clients.Related Issue(s)
Looks like we don't have an issue for this one, but we did agree on working on this during our team-sync.
How to test
Run the command
previewctl list
Release Notes
Documentation
Werft options: