k8stools

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerMajorVersion uint64
	ServerMinorVersion uint64
)

Functions

func CompareObjectMeta

func CompareObjectMeta(t *testing.T, got, want metav1.ObjectMeta)

func GetTestClientWithObjects

func GetTestClientWithObjects(predefinedObjects []runtime.Object) client.Client

func HandleDeployUpdate added in v0.22.1

func HandleDeployUpdate(ctx context.Context, rclient client.Client, newDeploy *appsv1.Deployment) error

func HandleSTSUpdate added in v0.20.0

func HandleSTSUpdate(ctx context.Context, rclient client.Client, cr STSOptions, newSts, currentSts *appsv1.StatefulSet, c *config.BaseOperatorConf) error

func IsPDBV1APISupported added in v0.23.0

func IsPDBV1APISupported() bool

IsPDBV1APISupported check if new v1 API is supported by kubernetes API server deprecated since 1.21 https://kubernetes.io/docs/reference/using-api/deprecation-guide/#poddisruptionbudget-v125

func IsPSPSupported added in v0.23.0

func IsPSPSupported() bool

IsPSPSupported check if PodSecurityPolicy is supported by kubernetes API server https://kubernetes.io/docs/reference/using-api/deprecation-guide/#psp-v125

func MergeAnnotations added in v0.22.0

func MergeAnnotations(prev, current map[string]string) map[string]string

MergeAnnotations adds annotations with kubernetes.io/ to the current map from prev It's needed for kubectl restart, correct updates such annotations managed by kubernetes controller and shouldn't be changed by operator

func MergePatchContainers

func MergePatchContainers(base, patches []v1.Container) ([]v1.Container, error)

MergePatchContainers adds patches to base using a strategic merge patch and iterating by container name, failing on the first error

func PodIsReady added in v0.20.0

func PodIsReady(pod corev1.Pod) bool

func SanitizeVolumeName

func SanitizeVolumeName(name string) string

func TrySetKubernetesServerVersion added in v0.23.0

func TrySetKubernetesServerVersion(vi *version.Info) error

TrySetKubernetesServerVersion parses kubernetes

func UpdatePodAnnotations

func UpdatePodAnnotations(ctx context.Context, rclient client.Client, selector map[string]string, ns string) error

UpdatePodAnnotations - updates configmap-sync-time annotation it triggers config rules reload for vmalert

Types

type STSOptions added in v0.20.0

type STSOptions struct {
	SelectorLabels func() map[string]string
	VolumeName     func() string
	UpdateStrategy func() appsv1.StatefulSetUpdateStrategyType
}

Jump to

Keyboard shortcuts

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