Documentation ¶
Index ¶
- Variables
- type AnySpec
- type BaseCluster
- func (r *BaseCluster[T]) AddResource(resource Reconciler)
- func (r *BaseCluster[T]) GetClusterOperation() *apiv1alpha1.ClusterOperationSpec
- func (r *BaseCluster[T]) GetName() string
- func (r *BaseCluster[T]) GetResources() []Reconciler
- func (r *BaseCluster[T]) Paused(ctx context.Context) bool
- func (r *BaseCluster[T]) Ready(ctx context.Context) *Result
- func (r *BaseCluster[T]) Reconcile(ctx context.Context) *Result
- func (r *BaseCluster[T]) RegisterResources(ctx context.Context) error
- type BaseReconciler
- func (b *BaseReconciler[T]) GetClient() *client.Client
- func (b *BaseReconciler[T]) GetName() string
- func (b *BaseReconciler[T]) GetNamespace() string
- func (b *BaseReconciler[T]) GetSpec() T
- func (b *BaseReconciler[T]) Ready(ctx context.Context) *Result
- func (b *BaseReconciler[T]) Reconcile(ctx context.Context) *Result
- type BaseRoleReconciler
- func (r *BaseRoleReconciler[T]) GetFullName() string
- func (r *BaseRoleReconciler[T]) GetName() string
- func (r *BaseRoleReconciler[T]) GetRoleGroups() (map[string]AnySpec, error)
- func (b *BaseRoleReconciler[T]) MergeRoleGroupSpec(roleGroup AnySpec) AnySpec
- func (r *BaseRoleReconciler[T]) RegisterResources(ctx context.Context) error
- type ClusterInfo
- func (i *ClusterInfo) AddAnnotation(key, value string)
- func (i *ClusterInfo) AddLabel(key, value string)
- func (i *ClusterInfo) GetAnnotations() map[string]string
- func (i *ClusterInfo) GetClusterName() string
- func (i *ClusterInfo) GetFullName() string
- func (i *ClusterInfo) GetLabels() map[string]string
- type ClusterReconciler
- type Deployment
- type GenericResourceReconciler
- func (r *GenericResourceReconciler[B]) GetBuilder() B
- func (r *GenericResourceReconciler[B]) GetName() string
- func (r *GenericResourceReconciler[b]) GetObjectMeta() metav1.ObjectMeta
- func (r *GenericResourceReconciler[B]) Ready(ctx context.Context) *Result
- func (r *GenericResourceReconciler[B]) Reconcile(ctx context.Context) *Result
- func (r *GenericResourceReconciler[B]) ResourceReconcile(ctx context.Context, resource ctrlclient.Object) *Result
- type Reconciler
- type ResourceReconciler
- type Result
- type RoleGroupInfo
- type RoleGroupResourceReconcilersGetter
- type RoleInfo
- type RoleReconciler
- type Service
- type SimpleResourceReconciler
- type StatefulSet
Constants ¶
This section is empty.
Variables ¶
var (
ErrRoleSpecNotPointer = errors.New("role spec must be a pointer")
)
Functions ¶
This section is empty.
Types ¶
type BaseCluster ¶ added in v0.8.0
type BaseCluster[T AnySpec] struct { BaseReconciler[T] ClusterOperation *apiv1alpha1.ClusterOperationSpec ClusterInfo ClusterInfo // contains filtered or unexported fields }
func NewBaseCluster ¶ added in v0.8.0
func NewBaseCluster[T AnySpec]( client *client.Client, clusterInfo ClusterInfo, clusterOperation *apiv1alpha1.ClusterOperationSpec, spec T, ) *BaseCluster[T]
func (*BaseCluster[T]) AddResource ¶ added in v0.8.0
func (r *BaseCluster[T]) AddResource(resource Reconciler)
func (*BaseCluster[T]) GetClusterOperation ¶ added in v0.8.0
func (r *BaseCluster[T]) GetClusterOperation() *apiv1alpha1.ClusterOperationSpec
func (*BaseCluster[T]) GetName ¶ added in v0.8.0
func (r *BaseCluster[T]) GetName() string
func (*BaseCluster[T]) GetResources ¶ added in v0.8.0
func (r *BaseCluster[T]) GetResources() []Reconciler
func (*BaseCluster[T]) Paused ¶ added in v0.8.0
func (r *BaseCluster[T]) Paused(ctx context.Context) bool
func (*BaseCluster[T]) Ready ¶ added in v0.8.0
func (r *BaseCluster[T]) Ready(ctx context.Context) *Result
func (*BaseCluster[T]) Reconcile ¶ added in v0.8.0
func (r *BaseCluster[T]) Reconcile(ctx context.Context) *Result
func (*BaseCluster[T]) RegisterResources ¶ added in v0.8.0
func (r *BaseCluster[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 Spec T }
func (*BaseReconciler[T]) GetClient ¶
func (b *BaseReconciler[T]) GetClient() *client.Client
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
type BaseRoleReconciler ¶
type BaseRoleReconciler[T AnySpec] struct { BaseCluster[T] RoleInfo RoleInfo }
func NewBaseRoleReconciler ¶
func NewBaseRoleReconciler[T AnySpec]( client *client.Client, roleInfo RoleInfo, clusterOperation *apiv1alpha1.ClusterOperationSpec, spec T, ) *BaseRoleReconciler[T]
func (*BaseRoleReconciler[T]) GetFullName ¶ added in v0.8.0
func (r *BaseRoleReconciler[T]) GetFullName() string
func (*BaseRoleReconciler[T]) GetName ¶ added in v0.8.0
func (r *BaseRoleReconciler[T]) GetName() string
func (*BaseRoleReconciler[T]) GetRoleGroups ¶ added in v0.8.0
func (r *BaseRoleReconciler[T]) GetRoleGroups() (map[string]AnySpec, error)
func (*BaseRoleReconciler[T]) MergeRoleGroupSpec ¶
func (b *BaseRoleReconciler[T]) MergeRoleGroupSpec(roleGroup AnySpec) AnySpec
MergeRoleGroupSpec merges the roleGroup spec with the base role spec. It merges the fields from the right (roleSpec) to the left (roleGroup). If a field exists in the left but is zero, it will be replaced by the corresponding field from the right. The left must be a pointer, as the merge operation modifies it. The fields "RoleGroups" and "PodDisruptionBudget" are excluded during the merge.
Example:
left := &RoleGroupSpec{ Replicas: 1, Config: config, EnvOverrides: envOverridesRoleGroup, } right := RoleSpec{ RoleGroups: rolegroups, // this field is excluded EnvOverrides: envOverridesRole, CommandOverrides: commandOverrides, } result := &RoleGroupSpec{ Replicas: 1, Config: config, EnvOverrides: envOverridesRoleGroup, // `EnvOverrides` exists in left, so it is not replaced CommandOverrides: commandOverrides, // Add RoleSpec.CommandOverrides to left }
func (*BaseRoleReconciler[T]) RegisterResources ¶ added in v0.8.0
func (r *BaseRoleReconciler[T]) RegisterResources(ctx context.Context) error
type ClusterInfo ¶ added in v0.8.0
type ClusterInfo struct { GVK *metav1.GroupVersionKind ClusterName string // contains filtered or unexported fields }
func (*ClusterInfo) AddAnnotation ¶ added in v0.8.0
func (i *ClusterInfo) AddAnnotation(key, value string)
func (*ClusterInfo) AddLabel ¶ added in v0.8.0
func (i *ClusterInfo) AddLabel(key, value string)
func (*ClusterInfo) GetAnnotations ¶ added in v0.8.0
func (i *ClusterInfo) GetAnnotations() map[string]string
func (*ClusterInfo) GetClusterName ¶ added in v0.8.0
func (i *ClusterInfo) GetClusterName() string
func (*ClusterInfo) GetFullName ¶ added in v0.8.0
func (i *ClusterInfo) GetFullName() string
func (*ClusterInfo) GetLabels ¶ added in v0.8.0
func (i *ClusterInfo) GetLabels() map[string]string
type ClusterReconciler ¶
type ClusterReconciler interface { Reconciler GetClusterOperation() *apiv1alpha1.ClusterOperationSpec GetResources() []Reconciler AddResource(resource Reconciler) RegisterResources(ctx context.Context) error }
type Deployment ¶ added in v0.8.0
type Deployment struct { GenericResourceReconciler[builder.DeploymentBuilder] Stopped bool }
func NewDeployment ¶ added in v0.8.0
func NewDeployment( client *client.Client, name string, deployBuilder builder.DeploymentBuilder, ) *Deployment
type GenericResourceReconciler ¶
type GenericResourceReconciler[B builder.ResourceBuilder] struct { BaseReconciler[AnySpec] Builder B Name string }
func NewGenericResourceReconciler ¶
func NewGenericResourceReconciler[B builder.ResourceBuilder]( client *client.Client, name string, builder B, ) *GenericResourceReconciler[B]
func (*GenericResourceReconciler[B]) GetBuilder ¶
func (r *GenericResourceReconciler[B]) GetBuilder() B
func (*GenericResourceReconciler[B]) GetName ¶ added in v0.8.0
func (r *GenericResourceReconciler[B]) GetName() string
func (*GenericResourceReconciler[b]) GetObjectMeta ¶
func (r *GenericResourceReconciler[b]) GetObjectMeta() metav1.ObjectMeta
func (*GenericResourceReconciler[B]) Ready ¶
func (r *GenericResourceReconciler[B]) Ready(ctx context.Context) *Result
GenericResourceReconciler[B] does not check anythins, so it is always 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
ResourceReconcile creates or updates a resource. If the resource is created or updated, it returns a Result with a requeue time of 1 second.
Most of the time you should not call this method directly, but call the r.Reconcile() method instead.
type Reconciler ¶
type ResourceReconciler ¶
type ResourceReconciler[B builder.ResourceBuilder] interface { Reconciler GetObjectMeta() metav1.ObjectMeta GetBuilder() B ResourceReconcile(ctx context.Context, resource ctrlclient.Object) *Result }
type Result ¶
func (*Result) RequeueOrNot ¶
type RoleGroupInfo ¶ added in v0.8.0
type RoleGroupInfo struct { RoleInfo RoleGroupName string // contains filtered or unexported fields }
func (*RoleGroupInfo) AddLabel ¶ added in v0.8.0
func (i *RoleGroupInfo) AddLabel(key, value string)
func (*RoleGroupInfo) GetAnnotations ¶ added in v0.8.0
func (i *RoleGroupInfo) GetAnnotations() map[string]string
func (*RoleGroupInfo) GetFullName ¶ added in v0.8.0
func (i *RoleGroupInfo) GetFullName() string
func (*RoleGroupInfo) GetGroupName ¶ added in v0.8.0
func (i *RoleGroupInfo) GetGroupName() string
func (*RoleGroupInfo) GetLabels ¶ added in v0.8.0
func (i *RoleGroupInfo) GetLabels() map[string]string
type RoleGroupResourceReconcilersGetter ¶ added in v0.8.0
type RoleGroupResourceReconcilersGetter interface {
GetResourceReconcilers(info *RoleGroupInfo, roleGroupSpec any) ([]Reconciler, error)
}
type RoleInfo ¶ added in v0.8.0
type RoleInfo struct { ClusterInfo RoleName string // contains filtered or unexported fields }
func (*RoleInfo) AddAnnotation ¶ added in v0.8.0
func (*RoleInfo) GetAnnotations ¶ added in v0.8.0
func (*RoleInfo) GetFullName ¶ added in v0.8.0
func (*RoleInfo) GetRoleName ¶ added in v0.8.0
type RoleReconciler ¶
type RoleReconciler interface { ClusterReconciler // Get the full name of the role, formatted as `<clusterName>-<roleName>` GetFullName() string }
type Service ¶ added in v0.8.0
type Service struct { GenericResourceReconciler[builder.ServiceBuilder] }
type SimpleResourceReconciler ¶
type SimpleResourceReconciler[B builder.ResourceBuilder] struct { GenericResourceReconciler[B] }
func NewSimpleResourceReconciler ¶
func NewSimpleResourceReconciler[B builder.ResourceBuilder]( client *client.Client, name string, 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 StatefulSet ¶ added in v0.8.0
type StatefulSet struct { GenericResourceReconciler[builder.StatefulSetBuilder] Stopped bool }
func NewStatefulSet ¶ added in v0.8.0
func NewStatefulSet( client *client.Client, name string, stsBuilder builder.StatefulSetBuilder, ) *StatefulSet