shared

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PodNamespaceFile the file path and name for pod namespace
	PodNamespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
)

Variables

View Source
var ErrExit = fmt.Errorf("exit")

ErrExit may be passed to CheckError to instruct it to output nothing but exit with status code 1.

Functions

func CheckErr added in v0.0.44

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.

This method is generic to the command in use and may be used by non-Kubectl commands.

func CurrentContext added in v0.0.36

func CurrentContext(config *api.Config) *api.Context

CurrentContext returns the current context

func CurrentNamespace added in v0.0.36

func CurrentNamespace() string

CurrentNamespace returns the current namespace in the context

func Fatal added in v0.0.44

func Fatal(msg string, code int)

Fatal prints the message (if provided) and then exits. If V(2) or greater, glog.Logger().Fatal is invoked for extended information.

func LoadConfig added in v0.0.36

func LoadConfig() (*api.Config, *clientcmd.PathOptions, error)

LoadConfig loads the Kubernetes configuration

func StandardErrorMessage added in v0.0.44

func StandardErrorMessage(err error) (string, bool)

StandardErrorMessage translates common errors into a human readable message, or returns false if the error is not one of the recognized types. It may also log extended information to glog.

This method is generic to the command in use and may be used by non-Kubectl commands.

Types

type Factory

type Factory interface {
	// CreateKubeConfig creates the kubernetes configuration
	CreateKubeConfig() (*rest.Config, error)
}

Factory is the interface defined for Kubernetes, Jenkins X, and Tekton REST APIs

func NewFactory

func NewFactory() Factory

NewFactory creates a factory with the default Kubernetes resources defined

Jump to

Keyboard shortcuts

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