resource

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package resource contains shared utility methods for resource management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGlobalAnnotations

func AddGlobalAnnotations(obj metav1.Object)

AddGlobalAnnotations adds the global annotations to the given object's annotations. If the object's annotations is nil, it will be initialized.

func AddGlobalLabels

func AddGlobalLabels(obj metav1.Object)

AddGlobalLabels adds the global labels to the given object's labels. If the object's labels is nil, it will be initialized.

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object,
	mutateFn func() error) (controllerutil.OperationResult, error)

CreateOrUpdate is a wrapper around controllerutil.CreateOrUpdate that automatically adds global labels and annotations. It takes the same parameters as controllerutil.CreateOrUpdate plus an optional list of additional labels to merge.

func GetGlobalAnnotations

func GetGlobalAnnotations() map[string]string

GetGlobalAnnotations returns a copy of the current global annotations.

func GetGlobalLabels

func GetGlobalLabels() map[string]string

GetGlobalLabels returns a copy of the current global labels.

func SetGlobalAnnotations

func SetGlobalAnnotations(annotations map[string]string)

SetGlobalAnnotations sets the global annotations that should be added to all resources.

func SetGlobalLabels

func SetGlobalLabels(labels map[string]string)

SetGlobalLabels sets the global labels that should be added to all resources.

Types

This section is empty.

Jump to

Keyboard shortcuts

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