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

package fieldmanager

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

Index

Constants

const InvalidManagedFieldsAfterMutatingAdmissionWarningFormat = "" /* 162 byte string literal not displayed */

InvalidManagedFieldsAfterMutatingAdmissionWarningFormat is the warning that a client receives when a create/update/patch request results in invalid managedFields after going through the admission chain.

Functions

func IgnoreManagedFieldsTimestampsTransformer

func IgnoreManagedFieldsTimestampsTransformer(
	_ context.Context,
	newObj runtime.Object,
	oldObj runtime.Object,
) (res runtime.Object, err error)

IgnoreManagedFieldsTimestampsTransformer reverts timestamp updates if the non-managed parts of the object are equivalent

func NewManagedFieldsValidatingAdmissionController

func NewManagedFieldsValidatingAdmissionController(wrap admission.Interface) admission.Interface

NewManagedFieldsValidatingAdmissionController validates the managedFields after calling the provided admission and resets them to their original state if they got changed to an invalid value

func ValidateManagedFields

func ValidateManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) error

Types

type FieldManager

type FieldManager = internal.FieldManager

FieldManager updates the managed fields and merges applied configurations.

func NewDefaultCRDFieldManager

func NewDefaultCRDFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (_ *FieldManager, err error)

NewDefaultCRDFieldManager creates a new FieldManager specifically for CRDs. This allows for the possibility of fields which are not defined in models, as well as having no models defined at all.

func NewDefaultFieldManager

func NewDefaultFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (*FieldManager, error)

NewDefaultFieldManager creates a new FieldManager that merges apply requests and update managed fields for other types of requests.

type ResourcePathMappings

type ResourcePathMappings map[string]fieldpath.Path

ResourcePathMappings maps a group/version to its replicas path. The assumption is that all the paths correspond to leaf fields.

type ScaleHandler

type ScaleHandler struct {
	// contains filtered or unexported fields
}

ScaleHandler manages the conversion of managed fields between a main resource and the scale subresource

func NewScaleHandler

func NewScaleHandler(parentEntries []metav1.ManagedFieldsEntry, groupVersion schema.GroupVersion, mappings ResourcePathMappings) *ScaleHandler

NewScaleHandler creates a new ScaleHandler

func (*ScaleHandler) ToParent

func (h *ScaleHandler) ToParent(scaleEntries []metav1.ManagedFieldsEntry) ([]metav1.ManagedFieldsEntry, error)

ToParent merges `scaleEntries` with the entries of the main resource and transforms them accordingly

func (*ScaleHandler) ToSubresource

func (h *ScaleHandler) ToSubresource() ([]metav1.ManagedFieldsEntry, error)

ToSubresource filter the managed fields of the main resource and convert them so that they can be handled by scale. For the managed fields that have a replicas path it performs two changes:

  1. APIVersion is changed to the APIVersion of the scale subresource
  2. Replicas path of the main resource is transformed to the replicas path of the scale subresource

type TypeConverter

type TypeConverter = internal.TypeConverter

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

func NewDeducedTypeConverter

func NewDeducedTypeConverter() TypeConverter

NewDeducedTypeConverter creates 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).

func NewTypeConverter

func NewTypeConverter(openapiSpec map[string]*spec.Schema, preserveUnknownFields bool) (TypeConverter, error)

NewTypeConverter builds a TypeConverter from a map of OpenAPIV3 schemas. This will automatically find the proper version of the object, and the corresponding schema information. The keys to the map must be consistent with the names used by Refs within the schemas. The schemas should conform to the Kubernetes Structural Schema OpenAPI restrictions found in docs: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema

Source Files

admission.go equality.go fieldmanager.go scalehandler.go typeconverter.go

Directories

PathSynopsis
pkg/endpoints/handlers/fieldmanager/fieldmanagertest
pkg/endpoints/handlers/fieldmanager/internal
Version
v0.27.0-alpha.3
Published
Mar 3, 2023
Platform
js/wasm
Imports
21 packages
Last checked
12 minutes ago

Tools for package owners.