reconciler

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnySpec

type AnySpec any

type BaseClusterReconciler

type BaseClusterReconciler[T AnySpec] struct {
	BaseReconciler[T]
	// contains filtered or unexported fields
}

func NewBaseClusterReconciler

func NewBaseClusterReconciler[T AnySpec](
	client *client.Client,
	options builder.Options,
	spec T,
) *BaseClusterReconciler[T]

func (*BaseClusterReconciler[T]) AddResource

func (r *BaseClusterReconciler[T]) AddResource(resource Reconciler)

func (*BaseClusterReconciler[T]) GetResources

func (r *BaseClusterReconciler[T]) GetResources() []Reconciler

func (*BaseClusterReconciler[T]) Ready

func (r *BaseClusterReconciler[T]) Ready(ctx context.Context) Result

func (*BaseClusterReconciler[T]) Reconcile

func (r *BaseClusterReconciler[T]) Reconcile(ctx context.Context) Result

func (*BaseClusterReconciler[T]) RegisterResources

func (r *BaseClusterReconciler[T]) RegisterResources(ctx context.Context) error

type BaseReconciler

type BaseReconciler[T AnySpec] struct {
	// Do not use ptr, to avoid other packages to modify the client
	Client  *client.Client
	Options builder.Options
	Spec    T
}

func (*BaseReconciler[T]) GetClient

func (b *BaseReconciler[T]) GetClient() *client.Client

func (*BaseReconciler[T]) GetCtrlClient

func (b *BaseReconciler[T]) GetCtrlClient() ctrlclient.Client

func (*BaseReconciler[T]) GetCtrlScheme

func (b *BaseReconciler[T]) GetCtrlScheme() *runtime.Scheme

func (*BaseReconciler[T]) GetName

func (b *BaseReconciler[T]) GetName() string

func (*BaseReconciler[T]) GetNamespace

func (b *BaseReconciler[T]) GetNamespace() string

func (*BaseReconciler[T]) GetSpec

func (b *BaseReconciler[T]) GetSpec() T

func (*BaseReconciler[T]) Ready

func (b *BaseReconciler[T]) Ready(ctx context.Context) Result

func (*BaseReconciler[T]) Reconcile

func (b *BaseReconciler[T]) Reconcile(ctx context.Context) Result

type BaseRoleReconciler

type BaseRoleReconciler[T AnySpec] struct {
	BaseClusterReconciler[T]
	Options *builder.RoleOptions
}

func NewBaseRoleReconciler

func NewBaseRoleReconciler[T AnySpec](
	client *client.Client,
	roleOptions *builder.RoleOptions,
	spec T,
) *BaseRoleReconciler[T]

func (*BaseRoleReconciler[T]) GetClusterOperation

func (b *BaseRoleReconciler[T]) GetClusterOperation() *apiv1alpha1.ClusterOperationSpec

func (*BaseRoleReconciler[T]) MergeRoleGroupSpec

func (b *BaseRoleReconciler[T]) MergeRoleGroupSpec(roleGroup any)

MergeRoleGroupSpec merge right to left, if field of right not exist in left, add it to left. else skip it. merge will modify left, so left must be a pointer.

func (*BaseRoleReconciler[T]) Ready

func (b *BaseRoleReconciler[T]) Ready(ctx context.Context) Result

type ClusterReconciler

type ClusterReconciler interface {
	Reconciler
	GetClusterOperation() *apiv1alpha1.ClusterOperationSpec
	GetResources() []Reconciler
	AddResource(resource Reconciler)
	RegisterResources(ctx context.Context) error
}

type DeploymentReconciler

type DeploymentReconciler struct {
	GenericResourceReconciler[builder.DeploymentBuilder]
	Options *builder.RoleGroupOptions
}

func NewDeploymentReconciler

func NewDeploymentReconciler(
	client *client.Client,
	options *builder.RoleGroupOptions,
	deployBuilder builder.DeploymentBuilder,
) *DeploymentReconciler

func (*DeploymentReconciler) Ready

func (*DeploymentReconciler) Reconcile

func (r *DeploymentReconciler) Reconcile(ctx context.Context) Result

type GenericResourceReconciler

type GenericResourceReconciler[B builder.Builder] struct {
	BaseReconciler[AnySpec]
	Builder B
}

func NewGenericResourceReconciler

func NewGenericResourceReconciler[B builder.Builder](
	client *client.Client,
	options builder.Options,
	builder B,
) *GenericResourceReconciler[B]

func (*GenericResourceReconciler[B]) GetBuilder

func (r *GenericResourceReconciler[B]) GetBuilder() B

func (*GenericResourceReconciler[b]) GetObjectMeta

func (r *GenericResourceReconciler[b]) GetObjectMeta() metav1.ObjectMeta

func (*GenericResourceReconciler[B]) Ready

func (*GenericResourceReconciler[B]) Reconcile

func (r *GenericResourceReconciler[B]) Reconcile(ctx context.Context) Result

func (*GenericResourceReconciler[B]) ResourceReconcile

func (r *GenericResourceReconciler[B]) ResourceReconcile(ctx context.Context, resource ctrlclient.Object) Result

type GenericServiceReconciler

type GenericServiceReconciler struct {
	GenericResourceReconciler[builder.ServiceBuilder]
}

func NewServiceReconciler

func NewServiceReconciler(
	client *client.Client,
	options builder.Options,
) *GenericServiceReconciler

type Reconciler

type Reconciler interface {
	GetName() string
	GetNamespace() string
	GetClient() *client.Client
	GetCtrlClient() ctrlclient.Client
	GetCtrlScheme() *runtime.Scheme
	Reconcile(ctx context.Context) Result
	Ready(ctx context.Context) Result
}

type ResourceReconciler

type ResourceReconciler[B builder.Builder] interface {
	Reconciler
	GetObjectMeta() metav1.ObjectMeta
	GetBuilder() B
	ResourceReconcile(ctx context.Context, resource ctrlclient.Object) Result
}

type Result

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

func NewResult

func NewResult(requeue bool, requeueAfter time.Duration, err error) Result

func (*Result) RequeueOrNot

func (r *Result) RequeueOrNot() bool

func (*Result) Result

func (r *Result) Result() (ctrl.Result, error)

type RoleReconciler

type RoleReconciler interface {
	ClusterReconciler
}

type SimpleResourceReconciler

type SimpleResourceReconciler[B builder.Builder] struct {
	GenericResourceReconciler[B]
}

func NewSimpleResourceReconciler

func NewSimpleResourceReconciler[B builder.Builder](
	client *client.Client,
	clusterOptions builder.Options,
	builder B,
) *SimpleResourceReconciler[B]

NewSimpleResourceReconciler creates a new resource reconciler with a simple builder that does not require a spec, and can not use the spec.

type StatefulSetReconciler

type StatefulSetReconciler struct {
	GenericResourceReconciler[builder.StatefulSetBuilder]
	Options *builder.RoleGroupOptions
}

func NewStatefulSetReconciler

func NewStatefulSetReconciler(
	client *client.Client,
	options *builder.RoleGroupOptions,
	stsBuilder builder.StatefulSetBuilder,
) *StatefulSetReconciler

func (*StatefulSetReconciler) Ready

func (*StatefulSetReconciler) Reconcile

func (r *StatefulSetReconciler) Reconcile(ctx context.Context) Result

Jump to

Keyboard shortcuts

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