k8sutil

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package k8sutil for Kubernetes helpers.

Package k8sutil for Kubernetes helpers.

Package k8sutil for Kubernetes helpers.

Package k8sutil for Kubernetes helpers.

Package k8sutil for Kubernetes helpers.

Package k8sutil for Kubernetes helpers.

Index

Constants

View Source
const (
	// V1Alpha1 version for kubernetes resources
	V1Alpha1 = "v1alpha1"

	// V1Beta1 version for kubernetes resources
	V1Beta1 = "v1beta1"

	// V1 version for kubernetes resources
	V1 = "v1"
)
View Source
const (
	// Namespace for rook
	Namespace = "rook"
	// CustomResourceGroup for rook CRD
	CustomResourceGroup = "rook.io"
	// DefaultNamespace for the cluster
	DefaultNamespace = "default"
	// DataDirVolume data dir volume
	DataDirVolume = "rook-data"
	// DataDir folder
	DataDir = "/var/lib/rook"
	// RookType for the CRD
	RookType = "kubernetes.io/rook"
	// PodNameEnvVar is the env variable for getting the pod name via downward api
	PodNameEnvVar = "POD_NAME"
	// PodNamespaceEnvVar is the env variable for getting the pod namespace via downward api
	PodNamespaceEnvVar = "POD_NAMESPACE"
	// NodeNameEnvVar is the env variable for getting the node via downward api
	NodeNameEnvVar = "NODE_NAME"
)
View Source
const (
	// AppAttr app label
	AppAttr = "app"
	// ClusterAttr cluster label
	ClusterAttr = "rook_cluster"
	// VersionAttr version label
	VersionAttr = "rook_version"
	// PublicIPEnvVar public IP env var
	PublicIPEnvVar = "ROOK_PUBLIC_IPV4"
	// PrivateIPEnvVar pod IP env var
	PrivateIPEnvVar = "ROOK_PRIVATE_IPV4"

	// DefaultRepoPrefix repo prefix
	DefaultRepoPrefix = "rook"
	// ConfigOverrideName config override name
	ConfigOverrideName = "rook-config-override"
	// ConfigOverrideVal config override value
	ConfigOverrideVal = "config"
)

Variables

This section is empty.

Functions

func ConfigDirEnvVar added in v0.4.0

func ConfigDirEnvVar() v1.EnvVar

ConfigDirEnvVar config dir env var

func ConfigOverrideEnvVar added in v0.5.0

func ConfigOverrideEnvVar() v1.EnvVar

ConfigOverrideEnvVar config override env var

func ConfigOverrideMount added in v0.5.0

func ConfigOverrideMount() v1.VolumeMount

ConfigOverrideMount is an override mount

func ConfigOverrideVolume added in v0.5.0

func ConfigOverrideVolume() v1.Volume

ConfigOverrideVolume is an override volume

func DeleteDaemonset added in v0.6.0

func DeleteDaemonset(clientset kubernetes.Interface, namespace, name string) error

DeleteDaemonset makes a best effort at deleting a daemonset and its pods, then waits for them to be deleted

func DeleteDeployment added in v0.6.0

func DeleteDeployment(clientset kubernetes.Interface, namespace, name string) error

DeleteDeployment makes a best effort at deleting a deployment and its pods, then waits for them to be deleted

func GetK8SVersion added in v0.6.0

func GetK8SVersion(clientset kubernetes.Interface) (*version.Version, error)

GetK8SVersion gets the version of the running K8S cluster

func MakeClusterRole added in v0.6.0

func MakeClusterRole(clientset kubernetes.Interface, namespace, name string, rules []v1beta1.PolicyRule) error

func MakeRole added in v0.6.0

func MakeRole(clientset kubernetes.Interface, namespace, name string, rules []v1beta1.PolicyRule) error

func MakeRookImage

func MakeRookImage(version string) string

MakeRookImage formats the container name

func NameEnvVar added in v0.6.0

func NameEnvVar() v1.EnvVar

NameEnvVar pod name env var

func NamespaceEnvVar

func NamespaceEnvVar() v1.EnvVar

NamespaceEnvVar namespace env var

func NodeConfigURI added in v0.6.0

func NodeConfigURI() (string, error)

NodeConfigURI returns the node config URI path for this node

func NodeEnvVar added in v0.6.0

func NodeEnvVar() v1.EnvVar

NodeEnvVar node env var

func PathToVolumeName added in v0.4.0

func PathToVolumeName(path string) string

PathToVolumeName converts a path to a valid volume name

func PodIPEnvVar

func PodIPEnvVar(property string) v1.EnvVar

PodIPEnvVar private ip env var

func RepoPrefixEnvVar added in v0.4.0

func RepoPrefixEnvVar() v1.EnvVar

RepoPrefixEnvVar repo prefix env var

func SetPodVersion

func SetPodVersion(pod *v1.Pod, key, version string)

SetPodVersion sets the pod annotation

Types

type ConfigMapKVStore added in v0.6.0

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

func NewConfigMapKVStore added in v0.6.0

func NewConfigMapKVStore(namespace string, clientset kubernetes.Interface) *ConfigMapKVStore

func (*ConfigMapKVStore) ClearStore added in v0.6.0

func (kv *ConfigMapKVStore) ClearStore(storeName string) error

func (*ConfigMapKVStore) GetStore added in v0.6.0

func (kv *ConfigMapKVStore) GetStore(storeName string) (map[string]string, error)

func (*ConfigMapKVStore) GetValue added in v0.6.0

func (kv *ConfigMapKVStore) GetValue(storeName, key string) (string, error)

func (*ConfigMapKVStore) SetValue added in v0.6.0

func (kv *ConfigMapKVStore) SetValue(storeName, key, value string) error

type Placement added in v0.5.0

type Placement struct {
	NodeAffinity    *v1.NodeAffinity    `json:"nodeAffinity,omitempty"`
	PodAffinity     *v1.PodAffinity     `json:"podAffinity,omitempty"`
	PodAntiAffinity *v1.PodAntiAffinity `json:"podAntiAffinity,omitempty"`
	Tolerations     []v1.Toleration     `json:"tolerations,omitemtpy"`
}

Placement encapsulates the various kubernetes options that control where pods are scheduled and executed.

func (Placement) ApplyToPodSpec added in v0.5.0

func (p Placement) ApplyToPodSpec(t *v1.PodSpec)

ApplyToPodSpec adds placement to a pod spec

func (Placement) Merge added in v0.5.0

func (p Placement) Merge(with Placement) Placement

Merge returns a Placement which results from merging the attributes of the original Placement with the attributes of the supplied one. The supplied Placement's attributes will override the original ones if defined.

Jump to

Keyboard shortcuts

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