kube

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NamespaceEnv = "NAMESPACE"

NamespaceEnv is the environment variable for setting the k8s namespace

Variables

This section is empty.

Functions

func GetClient

func GetClient() (client.Client, error)

GetClient returns a Kubernetes client

func GetClientset

func GetClientset() (*kubernetes.Clientset, error)

GetClientset returns a Kubernetes clientset

func GetRestConfig

func GetRestConfig() (*rest.Config, error)

GetRestConfig returns the Kubernetes REST API configuration

Types

type API

type API interface {
	// Namespace returns the Kubernetes namespace
	Namespace() string

	// Config returns the Kubernetes REST configuration
	Config() *rest.Config

	// Client returns the Kubernetes controller runtime client
	Client() client.Client

	// Clientset returns the Kubernetes Go clientset
	Clientset() *kubernetes.Clientset
}

API exposes the Kubernetes API to tests

func GetAPI

func GetAPI(namespace string) (API, error)

GetAPI returns the Kubernetes API for the given namespace

func GetAPIFromEnv

func GetAPIFromEnv() (API, error)

GetAPIFromEnv returns the Kubernetes API for the current environment

func GetAPIFromEnvOrDie

func GetAPIFromEnvOrDie() API

GetAPIFromEnvOrDie returns the Kubernetes API for the current environment and panics if no API could be found

func GetAPIOrDie

func GetAPIOrDie(namespace string) API

GetAPIOrDie returns the Kubernetes API for the given namespace and panics if no configuration is found

type APIProvider

type APIProvider interface {
	// API returns the API
	API() API
}

APIProvider is an interface for types to provide the Kubernetes API

Jump to

Keyboard shortcuts

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