labels

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(obj runtime.Object, label string) string

Get get the label value of the provided k8s object for the specified label key. Return empty string if the object is not runtime.Object.

func GetAll

func GetAll(obj runtime.Object) map[string]string

GetAll get all labels of the provided k8s object. Return nil if the provided object is not runtime.Object.

func Has

func Has(obj runtime.Object, label string) bool

Has will return true if the k8s object has specified label, otherwise return false. Label key and value separated by "=".

If the provided label only contains label key, then only to check whether the labels of the k8s object contains the label key. If the provided label contains label key and value, then check whether the labels of the k8s object contains the label key and value.

func Remove

func Remove(obj runtime.Object, label ...string) error

Remove will delete the provided label for the k8s object if contains it.

func RemoveAll

func RemoveAll(obj runtime.Object) error

RemoveAll will remove all labels of the k8s object.

func Set

func Set(obj runtime.Object, label ...string) error

Set set labels for the provided k8s object. Label key and value separated by "=". If label already exist, it will update the label. If label not exist, it will add the label.

Types

This section is empty.

Jump to

Keyboard shortcuts

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