mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-12 05:48:56 +00:00
Structural refactoring for multiple kubeconfig support (#219)
This commit is contained in:
@@ -15,7 +15,7 @@ type ReadWriteResetCloser interface {
|
||||
}
|
||||
|
||||
type Loader interface {
|
||||
Load() (ReadWriteResetCloser, error)
|
||||
Load() ([]ReadWriteResetCloser, error)
|
||||
}
|
||||
|
||||
type Kubeconfig struct {
|
||||
@@ -38,11 +38,14 @@ func (k *Kubeconfig) Close() error {
|
||||
}
|
||||
|
||||
func (k *Kubeconfig) Parse() error {
|
||||
f, err := k.loader.Load()
|
||||
files, err := k.loader.Load()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to load")
|
||||
}
|
||||
|
||||
// TODO since we don't support multiple kubeconfig files at the moment, there's just 1 file
|
||||
f := files[0]
|
||||
|
||||
k.f = f
|
||||
var v yaml.Node
|
||||
if err := yaml.NewDecoder(f).Decode(&v); err != nil {
|
||||
|
Reference in New Issue
Block a user