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]) IsPaused(ctx context.Context) bool
- func (r *BaseCluster[T]) IsStopped() bool
- func (r *BaseCluster[T]) Ready(ctx context.Context) (ctrl.Result, error)
- func (r *BaseCluster[T]) Reconcile(ctx context.Context) (ctrl.Result, error)
- func (r *BaseCluster[T]) RegisterResources(ctx context.Context) error
- func (r *BaseCluster[T]) Run(ctx context.Context) (ctrl.Result, 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) (ctrl.Result, error)
- func (b *BaseReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, error)
- type BaseRoleReconciler
- func (r *BaseRoleReconciler[T]) AddResource(resource Reconciler)
- func (r *BaseRoleReconciler[T]) ClusterStopped() bool
- func (r *BaseRoleReconciler[T]) GetClusterName() string
- func (r *BaseRoleReconciler[T]) GetFullName() string
- func (r *BaseRoleReconciler[T]) GetName() string
- func (r *BaseRoleReconciler[T]) GetResources() []Reconciler
- func (r *BaseRoleReconciler[T]) GetRoleName() string
- func (r *BaseRoleReconciler[T]) IsStopped() booldeprecated
- func (r *BaseRoleReconciler[T]) Ready(ctx context.Context) (ctrl.Result, error)
- func (r *BaseRoleReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, error)
- 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[T]) GetBuilder() T
- func (r *GenericResourceReconciler[T]) GetClient() *client.Client
- func (r *GenericResourceReconciler[T]) GetName() string
- func (r *GenericResourceReconciler[T]) GetNamespace() string
- func (r *GenericResourceReconciler[T]) GetObjectKey() ctrlclient.ObjectKey
- func (r *GenericResourceReconciler[T]) GetObjectMeta() metav1.ObjectMetadeprecated
- func (r *GenericResourceReconciler[T]) Ready(ctx context.Context) (ctrl.Result, error)
- func (r *GenericResourceReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, error)
- func (r *GenericResourceReconciler[T]) ResourceReconcile(ctx context.Context, resource ctrlclient.Object) (ctrl.Result, error)
- type Job
- type PDB
- type Reconciler
- type ResourceReconciler
- type RoleGroupInfo
- 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]) IsPaused ¶ added in v0.10.0
func (r *BaseCluster[T]) IsPaused(ctx context.Context) bool
func (*BaseCluster[T]) IsStopped ¶ added in v0.10.0
func (r *BaseCluster[T]) IsStopped() bool
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 { BaseReconciler[T] RoleInfo RoleInfo // contains filtered or unexported fields }
func NewBaseRoleReconciler ¶
func (*BaseRoleReconciler[T]) AddResource ¶ added in v0.10.0
func (r *BaseRoleReconciler[T]) AddResource(resource Reconciler)
func (*BaseRoleReconciler[T]) ClusterStopped ¶ added in v0.10.0
func (r *BaseRoleReconciler[T]) ClusterStopped() bool
func (*BaseRoleReconciler[T]) GetClusterName ¶ added in v0.12.0
func (r *BaseRoleReconciler[T]) GetClusterName() string
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
GetName returns the name of the role
func (*BaseRoleReconciler[T]) GetResources ¶ added in v0.10.0
func (r *BaseRoleReconciler[T]) GetResources() []Reconciler
func (*BaseRoleReconciler[T]) GetRoleName ¶ added in v0.12.0
func (r *BaseRoleReconciler[T]) GetRoleName() string
func (*BaseRoleReconciler[T]) IsStopped
deprecated
added in
v0.10.0
func (r *BaseRoleReconciler[T]) IsStopped() bool
Deprecated: Use IsStopped instead. This method is marked deprecated in `v0.12.0` and will be removed in next release.
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 IsStopped() bool Run(ctx context.Context) (ctrl.Result, error) }
type Deployment ¶ added in v0.8.0
type Deployment struct { GenericResourceReconciler[builder.DeploymentBuilder] // When the cluster is stopped, the deployment will be scaled to 0 // and the reconcile will be not executed until the cluster is started Stopped bool }
func NewDeployment ¶ added in v0.8.0
func NewDeployment( client *client.Client, deployBuilder builder.DeploymentBuilder, stopped bool, ) *Deployment
type GenericResourceReconciler ¶
type GenericResourceReconciler[T builder.ObjectBuilder] struct { // Do not use ptr, to avoid other packages to modify the client Client *client.Client Builder T }
func NewGenericResourceReconciler ¶
func NewGenericResourceReconciler[T builder.ObjectBuilder]( client *client.Client, builder T, ) *GenericResourceReconciler[T]
func (*GenericResourceReconciler[T]) GetBuilder ¶
func (r *GenericResourceReconciler[T]) GetBuilder() T
func (*GenericResourceReconciler[T]) GetClient ¶ added in v0.12.0
func (r *GenericResourceReconciler[T]) GetClient() *client.Client
func (*GenericResourceReconciler[T]) GetName ¶ added in v0.8.0
func (r *GenericResourceReconciler[T]) GetName() string
func (*GenericResourceReconciler[T]) GetNamespace ¶ added in v0.12.0
func (r *GenericResourceReconciler[T]) GetNamespace() string
func (*GenericResourceReconciler[T]) GetObjectKey ¶ added in v0.12.0
func (r *GenericResourceReconciler[T]) GetObjectKey() ctrlclient.ObjectKey
func (*GenericResourceReconciler[T]) GetObjectMeta
deprecated
func (r *GenericResourceReconciler[T]) GetObjectMeta() metav1.ObjectMeta
Deprecated: Use r.GetObjectKey instead. This method is marked deprecated in `v0.12.0` and will be removed in next release.
func (*GenericResourceReconciler[T]) Ready ¶
GenericResourceReconciler[T] does not check anythins, so it is always ready.
func (*GenericResourceReconciler[T]) ResourceReconcile ¶
func (r *GenericResourceReconciler[T]) ResourceReconcile(ctx context.Context, resource ctrlclient.Object) (ctrl.Result, error)
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 Job ¶ added in v0.11.0
type Job struct { *GenericResourceReconciler[builder.JobBuilder] }
type PDB ¶ added in v0.11.0
type PDB struct { GenericResourceReconciler[builder.PodDisruptionBudgetBuilder] }
func NewPDBReconciler ¶ added in v0.11.0
type Reconciler ¶
type ResourceReconciler ¶
type ResourceReconciler[B builder.ObjectBuilder] interface { Reconciler // Deprecated: Use GetObjectKey instead. // this method is marked deprecated in `v0.12.0` and will be removed in next release. GetObjectMeta() metav1.ObjectMeta GetObjectKey() ctrlclient.ObjectKey GetBuilder() B ResourceReconcile(ctx context.Context, resource ctrlclient.Object) (ctrl.Result, error) }
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 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 { Reconciler // Get the name of the cluster GetClusterName() string // Get the name of the role GetRoleName() string // Get the full name of the role, formatted as `<clusterName>-<roleName>` GetFullName() string // GetResources returns the resources in the role GetResources() []Reconciler // AddResource adds a resource to the role AddResource(resource Reconciler) // RegisterResources registers resources with the role RegisterResources(ctx context.Context) error // Deprecated: Use IsStopped instead. // This method is marked deprecated in `v0.12.0` and will be removed in next release. IsStopped() bool ClusterStopped() bool }
type Service ¶ added in v0.8.0
type Service struct { GenericResourceReconciler[builder.ServiceBuilder] }
func NewServiceReconciler ¶
func NewServiceReconciler( client *client.Client, name string, ports []corev1.ContainerPort, options ...builder.ServiceBuilderOption, ) *Service
type SimpleResourceReconciler ¶
type SimpleResourceReconciler[T builder.ObjectBuilder] struct { GenericResourceReconciler[T] }
func NewSimpleResourceReconciler ¶
func NewSimpleResourceReconciler[T builder.ObjectBuilder]( client *client.Client, builder T, ) *SimpleResourceReconciler[T]
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] // When the cluster is stopped, the statefulset will be scaled to 0 // and the reconcile will be not executed until the cluster is started Stopped bool }
func NewStatefulSet ¶ added in v0.8.0
func NewStatefulSet( client *client.Client, statefulset builder.StatefulSetBuilder, stopped bool, ) *StatefulSet