I have a bunch of bash scripts that call kubectl to get various information about our clusters. I don’t use contexts, I pass the server and token parameters to kubectl under the covers. My interface uses nicknames for each cluster to make that easier to use.
I’d like to examine doing this in golang, using clientcmd. I’m not an experienced gopher at all. I only firehosed a golang book last week and wrote a relatively simple experiment for modifying a specific element of an incoming XML document and outputting it.
the package description for clientcmd implies that the config can be taken from command-line arguments, but I don’t understand how that works. I will get the server and token value either from command-line args or from a small configuration file (nickname lookup). Could someone show in golang pseudocode how this could work?