Documentation
¶
Index ¶
- Variables
- func CompareObjectMeta(t *testing.T, got, want metav1.ObjectMeta)
- func GetInterceptorsWithObjects() interceptor.Funcs
- func GetTestClientWithObjects(predefinedObjects []runtime.Object) client.Client
- func GetTestClientWithObjectsAndInterceptors(predefinedObjects []runtime.Object, fns interceptor.Funcs) client.Client
- func IsFSGroupChangePolicySupported() bool
- func ListObjectsByNamespace[T any, PT listing[T]](ctx context.Context, rclient client.Client, nss []string, collect func(PT), ...) error
- func MergePatchContainers(base, patches []corev1.Container) ([]corev1.Container, error)
- func NewActionRecordingInterceptor(actions *[]ClientAction, wrapped *interceptor.Funcs) interceptor.Funcs
- func NewObjectWatcherForNamespaces[T any, PT listing[T]](ctx context.Context, rclient client.WithWatch, crdTypeName string, ...) (watch.Interface, error)
- func NewReadyDeployment(name, namespace string) *appsv1.Deployment
- func RenderPlaceholders[T any](resource *T, placeholders map[string]string) (*T, error)
- func SanitizeVolumeName(name string) string
- func SetKubernetesVersionWithDefaults(vi *version.Info, defaultMinor, defaultMajor uint64) error
- func UpdatePodAnnotations(ctx context.Context, rclient client.Client, selector map[string]string, ...) error
- func VisitSelected[T any, PT listing[T]](ctx context.Context, rclient client.Client, s *SelectorOpts, cb func(PT)) error
- type ClientAction
- type ClientWithActions
- type ObjectWatcherForNamespaces
- type SelectorOpts
Constants ¶
This section is empty.
Variables ¶
var ( // ServerMajorVersion defines major number for current kubernetes API server version ServerMajorVersion uint64 // ServerMinorVersion defines minor number for current kubernetes API server version ServerMinorVersion uint64 )
Functions ¶
func CompareObjectMeta ¶
func CompareObjectMeta(t *testing.T, got, want metav1.ObjectMeta)
CompareObjectMeta compares metadata objects
func GetInterceptorsWithObjects ¶ added in v0.68.2
func GetInterceptorsWithObjects() interceptor.Funcs
GetInterceptorsWithObjects returns interceptors for objects
func GetTestClientWithObjects ¶
GetTestClientWithObjects returns testing client with optional predefined objects
func GetTestClientWithObjectsAndInterceptors ¶ added in v0.68.0
func GetTestClientWithObjectsAndInterceptors(predefinedObjects []runtime.Object, fns interceptor.Funcs) client.Client
GetTestClientWithObjectsAndInterceptors returns testing client with optional predefined objects and interceptors
func IsFSGroupChangePolicySupported ¶
func IsFSGroupChangePolicySupported() bool
IsFSGroupChangePolicySupported checks if `fsGroupChangePolicy` is supported, Supported since 1.20 https://kubernetes.io/blog/2020/12/14/kubernetes-release-1.20-fsgroupchangepolicy-fsgrouppolicy/#allow-users-to-skip-recursive-permission-changes-on-mount
func ListObjectsByNamespace ¶
func ListObjectsByNamespace[T any, PT listing[T]](ctx context.Context, rclient client.Client, nss []string, collect func(PT), opts ...client.ListOption) error
ListObjectsByNamespace performs object list for given namespaces
func MergePatchContainers ¶
MergePatchContainers adds patches to base using a strategic merge patch and iterating by container name, failing on the first error
func NewActionRecordingInterceptor ¶ added in v0.68.2
func NewActionRecordingInterceptor(actions *[]ClientAction, wrapped *interceptor.Funcs) interceptor.Funcs
NewActionRecordingInterceptor returns an interceptor that records actions to the provided slice pointer. It wraps an existing interceptorFuncs if provided.
func NewObjectWatcherForNamespaces ¶
func NewObjectWatcherForNamespaces[T any, PT listing[T]](ctx context.Context, rclient client.WithWatch, crdTypeName string, namespaces []string) (watch.Interface, error)
NewObjectWatcherForNamespaces returns a watcher for events at multiple namespaces for given object in case of empty namespaces, performs cluster wide watch
func NewReadyDeployment ¶
func NewReadyDeployment(name, namespace string) *appsv1.Deployment
NewReadyDeployment returns a new deployment with ready status condition
func RenderPlaceholders ¶
RenderPlaceholders replaces placeholders at resource with given values placeholder must be in %NAME% format resource must be reference to json serializable struct
func SanitizeVolumeName ¶
SanitizeVolumeName replaces all incompatible with k8s characters with -
func SetKubernetesVersionWithDefaults ¶
SetKubernetesVersionWithDefaults parses kubernetes version response with given default versions
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
func VisitSelected ¶ added in v0.60.0
func VisitSelected[T any, PT listing[T]](ctx context.Context, rclient client.Client, s *SelectorOpts, cb func(PT)) error
VisitSelected applies given function to any T child object matched by selectors defined in parent obj selectors
Types ¶
type ClientAction ¶ added in v0.68.2
type ClientAction struct {
Verb string
Kind string
Resource types.NamespacedName
}
ClientAction represents a client action
type ClientWithActions ¶ added in v0.68.2
type ClientWithActions struct {
client.Client
Actions []ClientAction
}
ClientWithActions is a client that tracks actions
func GetTestClientWithActions ¶ added in v0.68.2
func GetTestClientWithActions(predefinedObjects []runtime.Object) *ClientWithActions
GetTestClientWithActions returns a client that tracks actions
func GetTestClientWithActionsAndObjects ¶ added in v0.68.2
func GetTestClientWithActionsAndObjects(predefinedObjects []runtime.Object) *ClientWithActions
GetTestClientWithActionsAndObjects returns a client that tracks actions and updates status/objects
type ObjectWatcherForNamespaces ¶
type ObjectWatcherForNamespaces struct {
// contains filtered or unexported fields
}
ObjectWatcherForNamespaces performs a watch operation for multiple namespaces without using cluster wide permissions with empty namespaces uses cluster wide mode
func (*ObjectWatcherForNamespaces) ResultChan ¶
func (ow *ObjectWatcherForNamespaces) ResultChan() <-chan watch.Event
ResultChan returns a channel with events
func (*ObjectWatcherForNamespaces) Stop ¶
func (ow *ObjectWatcherForNamespaces) Stop()
Stop performs a stop on all watchers and waits for it's finish
type SelectorOpts ¶ added in v0.60.0
type SelectorOpts struct {
SelectAll bool
NamespaceSelector *metav1.LabelSelector
ObjectSelector *metav1.LabelSelector
DefaultNamespace string
}
SelectorOpts defines object query objects for given selectors