kube

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPEMData     = errors.New("No PEM data found in config for server CA.")
	ErrNoPEMFile     = errors.New("No PEM file for server CA.")
	ErrInvalidCAData = errors.New("Couldn't parse CA data for cluster.")
)
View Source
var (
	ErrContextNotFound = errors.New("Context not found in kube config")
	ErrUserNotFound    = errors.New("User not found in kube config")
	ErrClusterNotFound = errors.New("Cluster not found in kube config")
)

Functions

func New

func New(path, contextName string) (config.Config, error)

Types

type Cluster

type Cluster struct {
	Name        string
	ClusterData `yaml:"cluster"`
}

func (*Cluster) AddCertsFromData

func (cl *Cluster) AddCertsFromData(pool *x509.CertPool) error

func (*Cluster) AddCertsFromFile

func (cl *Cluster) AddCertsFromFile(pool *x509.CertPool) error

type ClusterData

type ClusterData struct {
	Server                   string
	CertificateAuthorityData string `yaml:"certificate-authority-data"`
	CertificateAuthority     string `yaml:"certificate-authority"`
}

type Clusters

type Clusters []Cluster

func (Clusters) Lookup

func (cls Clusters) Lookup(name string) (*Cluster, bool)

type Context

type Context struct {
	Name    string
	Context ContextData
}

context represents the raw context data, before the relevant user/cluster information has been looked up.

type ContextData

type ContextData struct {
	Cluster string
	User    string `yaml:"user"`
}

type Contexts

type Contexts []Context

func (Contexts) Lookup

func (ctxs Contexts) Lookup(name string) (*Context, bool)

type ExecCredential added in v0.2.2

type ExecCredential struct {
	Kind       string
	ApiVersion string
	Status     struct {
		Token               string
		ExpirationTimestamp time.Time
	}
}

ExecCredential is the expected format returned by executing a "UserExec".

type ExecTripper added in v0.2.2

type ExecTripper struct {
	// contains filtered or unexported fields
}

ExecTripper is an http.RoundTripper that will inject the credentials returned by running "exec" into the request. The request will then be forwarded to "next".

func NewExecTripper added in v0.2.2

func NewExecTripper(exec UserExec, next http.RoundTripper) *ExecTripper

func (*ExecTripper) RoundTrip added in v0.2.2

func (et *ExecTripper) RoundTrip(r *http.Request) (*http.Response, error)

type KubeContext

type KubeContext struct {
	Cluster Cluster
	User    User
}

KubeContext manages configuration from a .kube/config context and implements config.Config.

func (*KubeContext) Client

func (kc *KubeContext) Client(opts ...ezk8s.Opt) (*ezk8s.Client, error)

Client builds a new ezk8s client with the options acquired from ClientOpts.

func (*KubeContext) ClientOpts

func (kc *KubeContext) ClientOpts() (opts []ezk8s.Opt, err error)

ClientOpts returns the list of options that should be past to ezk8s.New to correctly configure the client.

type User

type User struct {
	Name     string
	UserData `yaml:"user"`
}

type UserData

type UserData struct {
	ClientCertificate string `yaml:"client-certificate"`
	ClientKey         string `yaml:"client-key"`

	ClientCertificateData string `yaml:"client-certificate-data"`
	ClientKeyData         string `yaml:"client-key-data"`

	Exec *UserExec
}

type UserExec added in v0.2.2

type UserExec struct {
	Command string
	Args    []string
	Env     map[string]string
}

type Users

type Users []User

func (Users) Lookup

func (us Users) Lookup(name string) (*User, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL