Documentation ¶
Overview ¶
Package util provides various utility functions for Kubernetes resources.
Index ¶
- Constants
- Variables
- func BuildRestMapper(restConfig *rest.Config) (meta.RESTMapper, error)
- func ConditionsFromUnstructured(from *unstructured.Unstructured, fields ...string) []metav1.Condition
- func ConditionsToUnstructured(conditions []metav1.Condition, to *unstructured.Unstructured, fields ...string)
- func CopyImmutableMetadata(from, to *unstructured.Unstructured) *unstructured.Unstructured
- func CreateAnew(ctx context.Context, client resource.Interface, obj runtime.Object, ...) (runtime.Object, error)
- func FindGroupVersionResource(from *unstructured.Unstructured, restMapper meta.RESTMapper) (*schema.GroupVersionResource, error)
- func GetMetadata(from *unstructured.Unstructured) map[string]interface{}
- func GetNestedField(obj *unstructured.Unstructured, fields ...string) interface{}
- func GetSpec(obj *unstructured.Unstructured) interface{}
- func MustUpdate(ctx context.Context, client resource.Interface, obj runtime.Object, ...) error
- func SetBackoff(b wait.Backoff) wait.Backoff
- func SetNestedField(to map[string]interface{}, value interface{}, fields ...string)
- func ToUnstructuredResource(from runtime.Object, restMapper meta.RESTMapper) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
- func TryAppendCondition(conditions []metav1.Condition, newCondition *metav1.Condition) []metav1.Condition
- func Update(ctx context.Context, client resource.Interface, obj runtime.Object, ...) error
- type MutateFn
- type OperationResult
Constants ¶
View Source
const ( MetadataField = "metadata" LabelsField = "labels" AnnotationsField = "annotations" StatusField = "status" )
Variables ¶
View Source
var EndpointSliceKind = "EndpointSlice"
View Source
var EndpointSliceResource = "endpointslices"
View Source
var ErrMapperNotsupported = "no matches for kind"
Functions ¶
func BuildRestMapper ¶
func BuildRestMapper(restConfig *rest.Config) (meta.RESTMapper, error)
func ConditionsFromUnstructured ¶
func ConditionsFromUnstructured(from *unstructured.Unstructured, fields ...string) []metav1.Condition
func ConditionsToUnstructured ¶
func ConditionsToUnstructured(conditions []metav1.Condition, to *unstructured.Unstructured, fields ...string)
func CopyImmutableMetadata ¶
func CopyImmutableMetadata(from, to *unstructured.Unstructured) *unstructured.Unstructured
CopyImmutableMetadata copies the static metadata fields (except Labels and Annotations) from one resource to another.
func CreateAnew ¶
func CreateAnew(ctx context.Context, client resource.Interface, obj runtime.Object, createOptions metav1.CreateOptions, deleteOptions metav1.DeleteOptions, ) (runtime.Object, error)
CreateAnew creates a resource, first deleting an existing instance if one exists. If the delete options specify that deletion should be propagated in the foreground, this will wait for the deletion to be complete before creating the new object: with foreground propagation, Get will continue to return the object being deleted and Create will fail with “already exists” until deletion is complete.
func FindGroupVersionResource ¶
func FindGroupVersionResource(from *unstructured.Unstructured, restMapper meta.RESTMapper) (*schema.GroupVersionResource, error)
func GetMetadata ¶
func GetMetadata(from *unstructured.Unstructured) map[string]interface{}
func GetNestedField ¶
func GetNestedField(obj *unstructured.Unstructured, fields ...string) interface{}
func GetSpec ¶
func GetSpec(obj *unstructured.Unstructured) interface{}
func MustUpdate ¶
func SetNestedField ¶
func ToUnstructuredResource ¶
func ToUnstructuredResource(from runtime.Object, restMapper meta.RESTMapper, ) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
Types ¶
type OperationResult ¶
type OperationResult string
const ( OperationResultNone OperationResult = "unchanged" OperationResultCreated OperationResult = "created" OperationResultUpdated OperationResult = "updated" )
Click to show internal directories.
Click to hide internal directories.