Move kubeconfig utility to a shared pkg

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan
2020-04-12 18:19:38 -07:00
parent d5546f062d
commit bef0a4cca7
16 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,17 @@
package kubeconfig
// GetCurrentContext returns "current-context" value in given
// kubeconfig object Node, or returns "" if not found.
func (k *Kubeconfig) GetCurrentContext() string {
v := valueOf(k.rootNode, "current-context")
if v == nil {
return ""
}
return v.Value
}
func (k *Kubeconfig) UnsetCurrentContext() error {
curCtxValNode := valueOf(k.rootNode, "current-context")
curCtxValNode.Value = ""
return nil
}