apiserverk8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanagertest Index | Files

package fieldmanagertest

import "k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanagertest"

Index

Types

type TestFieldManager

type TestFieldManager interface {
	// APIVersion of the object that we're tracking.
	APIVersion() string
	// Reset resets the state of the liveObject by resetting it to an empty object.
	Reset()
	// Live returns a copy of the current liveObject.
	Live() runtime.Object
	// Apply applies the given object on top of the current liveObj, for the
	// given manager and force flag.
	Apply(obj runtime.Object, manager string, force bool) error
	// Update will updates the managed fields in the liveObj based on the
	// changes performed by the update.
	Update(obj runtime.Object, manager string) error
	// ManagedFields returns the list of existing managed fields for the
	// liveObj.
	ManagedFields() []metav1.ManagedFieldsEntry
}

TestFieldManager is a FieldManager that can be used in test to simulate the behavior of Server-Side Apply and field tracking. This also has a few methods to get a sense of the state of the object.

This TestFieldManager uses a series of "fake" objects to simulate some behavior which come with the limitation that you can only use one version since there is no version conversion logic.

You can use this rather than NewDefaultTestFieldManager if you want to specify either a sub-resource, or a set of modified Manager to test them specifically.

func NewTestFieldManager

func NewTestFieldManager(typeConverter fieldmanager.TypeConverter, gvk schema.GroupVersionKind) TestFieldManager

NewTestFieldManager returns a new TestFieldManager built for the given gvk, on the main resource.

func NewTestFieldManagerSubresource

func NewTestFieldManagerSubresource(typeConverter fieldmanager.TypeConverter, gvk schema.GroupVersionKind, subresource string) TestFieldManager

NewTestFieldManagerSubresource returns a new TestFieldManager built for the given gvk, on the given sub-resource.

Source Files

testfieldmanager.go

Version
v0.27.0-alpha.1
Published
Jan 25, 2023
Platform
js/wasm
Imports
5 packages
Last checked
20 minutes ago

Tools for package owners.