Skip to content

FenrirUnbound/kubeconfig-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubeconfig-picker

wercker status Go Report Card

Pick out a subset of Kube config contexts

Build and Install

go install

Usage

Run

kubeconfig-picker

Import

import (
    "fmt"

    konfig "github.com/fenrirunbound/kubeconfig-picker/konfig"
)

func main() {
    k, _ := konfig.NewKonfigFromFile("/home/me/.kube/config")
    
    availableContexts := k.ListContexts()
    // A list of contexts contained in the kube config
    fmt.Printf("%v\n", availableContexts)

    config, _ := k.SelectContextsAsYaml([]string{"context1", "anotherContext"})
    // A kube config with only "context1" and "anotherContext" derived from the main config
    fmt.Printf("%v\n", string(config))
}

About

Pick out a subset of Kube config contexts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published