crdmigrator

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Overview

Package crdmigrator contains the CRD migrator implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByObjectConfig

type ByObjectConfig struct {
	// UseCache configures if the cached client should be used for Get & List calls for this object.
	// Get & List calls on the cached client automatically trigger the creation of an informer which
	// requires a significant amount of memory.
	// Thus it is only recommended to enable this setting for objects for which the controller already uses the cache.
	// Note: If this is enabled, we will use the corresponding Go type of the object for Get & List calls to avoid
	// creating additional informers for UnstructuredList/PartialObjectMetadataList.
	UseCache bool

	// UseStatusForStorageVersionMigration configures if the storage version migration for this CRD should
	// be triggered via the status endpoint instead of an update on the CRs directly (which is the default).
	// As mutating and validating webhooks are usually not configured on the status subresource this can help to
	// avoid mutating & validation webhook errors that would block the no-op updates and thus the storage migration.
	UseStatusForStorageVersionMigration bool
}

ByObjectConfig contains object-specific config for the CRD migration.

type CRDMigrator

type CRDMigrator struct {
	// Client is a cached client that is used:
	// * for all cached Get & List calls
	// * for all Patch calls
	Client client.Client

	// APIReader is a live client that is used:
	// * for all live Get & List calls
	APIReader client.Reader

	// Comma-separated list of CRD migration phases to skip.
	// Valid values are: All, StorageVersionMigration, CleanupManagedFields.
	SkipCRDMigrationPhases []Phase

	// Config allows to configure which objects should be migrated.
	Config map[client.Object]ByObjectConfig
	// contains filtered or unexported fields
}

CRDMigrator migrates CRDs.

func (*CRDMigrator) Reconcile

func (r *CRDMigrator) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

func (*CRDMigrator) SetupWithManager

func (r *CRDMigrator) SetupWithManager(ctx context.Context, mgr ctrl.Manager, controllerOptions controller.Options) error

type Phase

type Phase string

Phase is a phase of the CRD migration.

var (
	// StorageVersionMigrationPhase is the phase in which the storage version is migrated.
	// This means if the .status.storedVersions field of a CRD is not equal to [storageVersion],
	// a no-op patch is applied to all custom resources of the CRD to ensure they are all stored in
	// the current storageVersion in etcd. Afterward .status.storedVersions is set to [storageVersion].
	// For more information see:
	// https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/
	StorageVersionMigrationPhase Phase = "StorageVersionMigration"

	// CleanupManagedFieldsPhase is the phase in which managedFields are cleaned up.
	// This means for all custom resources of a CRD, managedFields that contain apiVersions that
	// are not served anymore are removed.
	// For more information see:
	// https://github.com/kubernetes/kubernetes/issues/111937
	CleanupManagedFieldsPhase Phase = "CleanupManagedFields"
)

Directories

Path Synopsis
test
t1/v1beta1
Package v1beta1 contains test types.
Package v1beta1 contains test types.
t2/v1beta1
Package v1beta1 contains test types.
Package v1beta1 contains test types.
t2/v1beta2
Package v1beta2 contains test types.
Package v1beta2 contains test types.
t3/v1beta1
Package v1beta1 contains test types.
Package v1beta1 contains test types.
t3/v1beta2
Package v1beta2 contains test types.
Package v1beta2 contains test types.
t4/v1beta2
Package v1beta2 contains test types.
Package v1beta2 contains test types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳