kubernetes

package
v0.0.0-...-cb22ee8 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CfgFromContext

func CfgFromContext(ctx context.Context) *rest.Config

FromContext returns the config stored in context.

func GetCurrentNamespace

func GetCurrentNamespace() (string, error)

GetCurrentNamespace returns the namespace where the pod is running

func GetInClusterKubeClient

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

GetInClusterKubeClient returns the client set for incluster config

func GetKubeConfig

func GetKubeConfig(dir string) (*rest.Config, error)

GetKubeConfig returns rest config for the give kube config directory if directory input is not given its taken from KUBE_CONFIG_DIR env variable if that variable is not present incluster config is considered

func KubernetesCSFromContext

func KubernetesCSFromContext(ctx context.Context) *kubernetes.Clientset

FromContext returns the kubernetes client set stored in context.

func WithContext

func WithContext(ctx context.Context) context.Context

WithContext returns the context with kubernetes client sets and rest config

Types

type ContainerSpec

type ContainerSpec struct {
	Image             string
	Port              int32
	Name              string
	Resources         []Resource
	Secrets           []corev1.VolumeMount
	ConfigMaps        []corev1.VolumeMount
	EnvVariables      []corev1.EnvVar
	User              int64
	EnvFromSecretorCM []EnvFrom
	Cmd               []string
	ServiceAccount    string
}

ContainerSpec - kubernetes core/v1/container

type EnvFrom

type EnvFrom struct {
	Name string
	Type string
}

EnvFrom = env variables

type JobSpec

type JobSpec struct {
	Spec PodSpec
	Name string
}

JobSpec - kubernetes batch/v1/job

type KV

type KV struct {
	Key   string
	Value string
}

KV - generic key/value

type PodSpec

type PodSpec struct {
	Containers []ContainerSpec
}

ContainerSpec - kubernetes core/v1/pod

type Resource

type Resource struct {
	Type string
	CPU  int64
	Mem  int64
}

Resource - container resource constraints

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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