controllers

package
v0.0.0-...-62a7c26 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvSkipRecert = "SEEDGEN_SKIP_RECERT"
)

Variables

View Source
var (
	PrepPhaseStateroot = "Stateroot"
	PrepPhasePrecache  = "Precache"
)

Used to start and end phases in the Prep stage. Each of them must be used in exactly two places

View Source
var (
	UpgradePhasePrepivot  = "PrePivot"
	UpgradePhasePostpivot = "PostPivot"
)

Used to start and end phases in the Upgrade stage. Each of them must be used in exactly two places

CheckHealth helper func to call HealthChecks

Functions

func CleanupUnbootedStateroots

func CleanupUnbootedStateroots(log logr.Logger, ops ops.Ops, ostreeClient ostreeclient.IClient, rpmOstreeClient rpmostreeclient.IClient) error

func GetSeedImage

func GetSeedImage(c client.Client, ctx context.Context, ibu *ibuv1.ImageBasedUpgrade, log logr.Logger, ops ops.Execute) error

Types

type ImageBasedUpgradeReconciler

type ImageBasedUpgradeReconciler struct {
	client.Client
	NoncachedClient client.Reader
	UpgradeHandler  UpgradeHandler
	Log             logr.Logger
	Scheme          *runtime.Scheme
	Recorder        record.EventRecorder
	Precache        *precache.PHandler
	BackupRestore   backuprestore.BackuperRestorer
	ExtraManifest   extramanifest.EManifestHandler
	RPMOstreeClient rpmostreeclient.IClient
	Executor        ops.Execute
	OstreeClient    ostreeclient.IClient
	Ops             ops.Ops
	RebootClient    reboot.RebootIntf
	Mux             *sync.Mutex
	Clientset       *kubernetes.Clientset

	// Image Management client, used for container storage cleanup
	ImageMgmtClient imagemgmt.ImageMgmtIntf

	// Cluster data retrieved once, during init
	ContainerStorageMountpointTarget string
}

ImageBasedUpgradeReconciler reconciles a ImageBasedUpgrade object

func (*ImageBasedUpgradeReconciler) Reconcile

func (r *ImageBasedUpgradeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (nextReconcile ctrl.Result, err error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*ImageBasedUpgradeReconciler) SetupWithManager

func (r *ImageBasedUpgradeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SeedGeneratorReconciler

type SeedGeneratorReconciler struct {
	client.Client
	NoncachedClient client.Reader
	Log             logr.Logger
	Scheme          *runtime.Scheme
	Recorder        record.EventRecorder
	BackupRestore   backuprestore.BackuperRestorer
	Executor        ops.Execute
	Mux             *sync.Mutex

	// Cluster data retrieved once, during init
	ContainerStorageMountpointTarget string
}

SeedGeneratorReconciler reconciles a SeedGenerator object

func (*SeedGeneratorReconciler) Reconcile

func (r *SeedGeneratorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (nextReconcile ctrl.Result, rc error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*SeedGeneratorReconciler) SetupWithManager

func (r *SeedGeneratorReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type UpgHandler

type UpgHandler struct {
	client.Client
	NoncachedClient client.Reader
	Log             logr.Logger
	BackupRestore   backuprestore.BackuperRestorer
	ExtraManifest   extramanifest.EManifestHandler
	ClusterConfig   clusterconfig.UpgradeClusterConfigGatherer
	Executor        ops.Execute
	Ops             ops.Ops
	Recorder        record.EventRecorder
	RPMOstreeClient rpmostreeclient.IClient
	OstreeClient    ostreeclient.IClient
	RebootClient    reboot.RebootIntf
}

func (*UpgHandler) HandleBackup

func (u *UpgHandler) HandleBackup(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)

HandleBackup manages backup flow and returns with possible requeue

func (*UpgHandler) HandleRestore

func (u *UpgHandler) HandleRestore(ctx context.Context) (ctrl.Result, error)

func (*UpgHandler) PostPivot

func (u *UpgHandler) PostPivot(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)

PostPivot executes all the post-upgrade steps after the cluster is rebooted to the new stateroot.

Note: All decisions, including reconciles and failures, should be made within this function. The caller will simply return what this function returns.

func (*UpgHandler) PrePivot

func (u *UpgHandler) PrePivot(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)

prePivot executes all the pre-upgrade steps and initiates a cluster reboot.

Note: All decisions, including reconciles and failures, should be made within this function. The caller will simply return what this function returns.

type UpgradeHandler

type UpgradeHandler interface {
	HandleBackup(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)
	HandleRestore(ctx context.Context) (ctrl.Result, error)
	PostPivot(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)
	PrePivot(ctx context.Context, ibu *ibuv1.ImageBasedUpgrade) (ctrl.Result, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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