internal

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Field indicates that the content of this path element is a field's name
	Field = "f"

	// Value indicates that the content of this path element is a field's value
	Value = "v"

	// Index indicates that the content of this path element is an index in an array
	Index = "i"

	// Key indicates that the content of this path element is a key value map
	Key = "k"

	// Separator separates the type of a path element from the contents
	Separator = ":"
)

Variables

This section is empty.

Functions

func BuildManagerIdentifier

func BuildManagerIdentifier(encodedManager *metav1.ManagedFieldsEntry) (manager string, err error)

BuildManagerIdentifier creates a manager identifier string from a ManagedFieldsEntry

func DecodeObjectManagedFields

func DecodeObjectManagedFields(from runtime.Object) (fieldpath.ManagedFields, error)

DecodeObjectManagedFields extracts and converts the objects ManagedFields into a fieldpath.ManagedFields.

func EncodeObjectManagedFields

func EncodeObjectManagedFields(obj runtime.Object, fields fieldpath.ManagedFields) error

EncodeObjectManagedFields converts and stores the fieldpathManagedFields into the objects ManagedFields

func FieldsToSet

func FieldsToSet(f metav1.Fields) (fieldpath.Set, error)

FieldsToSet creates a set paths from an input trie of fields

func NewCRDVersionConverter

func NewCRDVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter

NewCRDVersionConverter builds a VersionConverter for CRDs from a TypeConverter and an ObjectConvertor.

func NewConflictError

func NewConflictError(conflicts merge.Conflicts) *errors.StatusError

NewConflictError returns an error including details on the requests apply conflicts

func NewPathElement

func NewPathElement(s string) (fieldpath.PathElement, error)

NewPathElement parses a serialized path element

func NewVersionConverter

NewVersionConverter builds a VersionConverter from a TypeConverter and an ObjectConvertor.

func PathElementString

func PathElementString(pe fieldpath.PathElement) (string, error)

PathElementString serializes a path element

func RemoveObjectManagedFields

func RemoveObjectManagedFields(obj runtime.Object)

RemoveObjectManagedFields removes the ManagedFields from the object before we merge so that it doesn't appear in the ManagedFields recursively.

func SetToFields

func SetToFields(s fieldpath.Set) (metav1.Fields, error)

SetToFields creates a trie of fields from an input set of paths

Types

type DeducedTypeConverter

type DeducedTypeConverter struct{}

DeducedTypeConverter is a TypeConverter for CRDs that don't have a schema. It does implement the same interface though (and create the same types of objects), so that everything can still work the same. CRDs are merged with all their fields being "atomic" (lists included).

Note that this is not going to be sufficient for converting to/from CRDs that have a schema defined (we don't support that schema yet). TODO(jennybuckley): Use the schema provided by a CRD if it exists.

func (DeducedTypeConverter) ObjectToTyped

func (DeducedTypeConverter) ObjectToTyped(obj runtime.Object) (typed.TypedValue, error)

ObjectToTyped converts an object into a TypedValue with a "deduced type".

func (DeducedTypeConverter) TypedToObject

func (DeducedTypeConverter) TypedToObject(value typed.TypedValue) (runtime.Object, error)

TypedToObject transforms the typed value into a runtime.Object. That is not specific to deduced type.

func (DeducedTypeConverter) YAMLToTyped

func (DeducedTypeConverter) YAMLToTyped(from []byte) (typed.TypedValue, error)

YAMLToTyped parses a yaml object into a TypedValue with a "deduced type".

type TypeConverter

type TypeConverter interface {
	ObjectToTyped(runtime.Object) (typed.TypedValue, error)
	YAMLToTyped([]byte) (typed.TypedValue, error)
	TypedToObject(typed.TypedValue) (runtime.Object, error)
}

TypeConverter allows you to convert from runtime.Object to typed.TypedValue and the other way around.

func NewTypeConverter

func NewTypeConverter(models proto.Models) (TypeConverter, error)

NewTypeConverter builds a TypeConverter from a proto.Models. This will automatically find the proper version of the object, and the corresponding schema information.

Jump to

Keyboard shortcuts

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