-
Notifications
You must be signed in to change notification settings - Fork 12
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
Change clientset to use config from config.GetConfig() #468
Conversation
Remove GetClientset and GetClientConfig in exec_to_pod.go
/gcbrun |
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.
Great input Janusz!
cmd/manager/main.go
Outdated
@@ -91,7 +91,7 @@ func main() { | |||
os.Exit(1) | |||
} | |||
|
|||
clientset, err := v1alpha1.GetClientset() | |||
clientset, err := v1alpha1.GetClientsetFromConfig(cfg) |
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.
In my opinion you can also delete GetClientsetFromConfig
and move clientset, err := kubernetes.NewForConfig(config)
here. I really don't see a point of having a function that only calls one other function.
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 changed it to kubernetes.NewForConfig(cfg)
.
/gcbrun |
* Change GetClientConfig function to get config from config.GetConfig * Change GetClientset to GetClientsetFromConfig in main.go Remove GetClientset and GetClientConfig in exec_to_pod.go * fix * Delete GetClientsetFromConfig * Update BUILD.bazel
During debugging in VS Code on cluster deployed on AWS, I was getting error that GetClientset function could not locate kubeconfig file despite providing "kubeconfig" flag and "KUBECONFIG" variable in launch.json file. After some digging I found that GetClientset uses getClientConfig function which was simply ignoring this flag and variable. I decided to get clientsert by using more direct function GetClientsetFromConfig and config gathered by config.GetConfig. I also deleted GetConfig function which was not used anywhere.