Documentation
¶
Index ¶
- Constants
- Variables
- func EvaluateMemberRecreationCondition(ctx context.Context, apiObject k8sutil.APIObject, spec api.DeploymentSpec, ...) (string, bool)
- func GetActionTimeout(spec api.DeploymentSpec, t api.ActionType) api.Timeout
- func GetAllActions() []api.ActionType
- func GetTimezone(tz *string) (timezones.Timezone, bool)
- func IsTimezoneValid(cache generic.Inspector[*core.Secret], name string, ...) bool
- func WithArangoMemberStatusUpdate(ctx context.Context, client inspector.ArangoMemberUpdateInterface, name string, ...) error
- type Action
- type ActionContext
- type ActionCore
- type ActionLocalsContext
- type ActionPVCResizeConfig
- type ActionPlanAppender
- type ActionPost
- type ActionPre
- type ActionProgressor
- type ActionReloadCachedStatus
- type ActionStartFailureGracePeriod
- type ActionsConfig
- type Context
- type CreateMemberMod
- type MemberRecreationConditionEvaluator
- type Metrics
- type MetricsRebalancer
- type PlanAppender
- type PlanBuilderContext
- type RebalanceAction
- type RebalanceActions
- type Reconciler
- func (r *Reconciler) CheckDeployment(ctx context.Context) error
- func (r *Reconciler) CollectMetrics(m metrics.PushMetric)
- func (d *Reconciler) CreatePlan(ctx context.Context) (error, bool)
- func (d *Reconciler) ExecutePlan(ctx context.Context) (bool, error)
- func (r *Reconciler) WrapLogger(in *zerolog.Event) *zerolog.Event
- type ScaleFilter
- type ScaleFilterFunc
- type ScaleSelectFunc
- type WithPlanBuilder
Constants ¶
const ( DefaultStartFailureGracePeriod = 10 * time.Second LocalJobID api.PlanLocalKey = "jobID" )
const ( BackOffCheck api.BackOffKey = "check" LicenseCheck api.BackOffKey = "license" TimezoneCheck api.BackOffKey = "timezone" )
const (
ActionShutdownJobExpiredTerminationTimeout = time.Minute
)
const (
ActionTypeArangoMemberUpdatePodStatusChecksum = "checksum"
)
const CertificateRenewalMargin = 7 * 24 * time.Hour
const (
DelayActionDuration = "delayActionDuration"
)
Variables ¶
var ( ObsoleteClusterConditions = []api.ConditionType{ api.ConditionTypeMaintenanceMode, } )
Functions ¶
func EvaluateMemberRecreationCondition ¶
func EvaluateMemberRecreationCondition(ctx context.Context, apiObject k8sutil.APIObject, spec api.DeploymentSpec, status api.DeploymentStatus, group api.ServerGroup, member api.MemberStatus, context PlanBuilderContext, evaluators ...MemberRecreationConditionEvaluator) (string, bool)
func GetActionTimeout ¶
func GetActionTimeout(spec api.DeploymentSpec, t api.ActionType) api.Timeout
func GetAllActions ¶
func GetAllActions() []api.ActionType
func IsTimezoneValid ¶
func WithArangoMemberStatusUpdate ¶
func WithArangoMemberStatusUpdate(ctx context.Context, client inspector.ArangoMemberUpdateInterface, name string, f inspector.ArangoMemberUpdateFunc) error
Types ¶
type Action ¶
type Action interface {
ActionCore
// MemberID Return the MemberID used / created in this action
MemberID() string
}
Action executes a single Plan item.
type ActionContext ¶
type ActionContext interface {
reconciler.DeploymentStatusUpdate
reconciler.DeploymentAgencyMaintenance
reconciler.DeploymentPodRenderer
reconciler.ArangoAgencyGet
reconciler.DeploymentInfoGetter
reconciler.DeploymentDatabaseClient
reconciler.KubernetesEventGenerator
member.StateInspectorGetter
sutil.ACSGetter
Metrics() *Metrics
ActionLocalsContext
ActionProgressor
// GetMemberStatusByID returns the current member status
// for the member with given id.
// Returns member status, true when found, or false
// when no such member is found.
GetMemberStatusByID(id string) (api.MemberStatus, bool)
// GetMemberStatusAndGroupByID returns the current member status and group
// for the member with given id.
// Returns member status, true when found, or false
// when no such member is found.
GetMemberStatusAndGroupByID(id string) (api.MemberStatus, api.ServerGroup, bool)
// CreateMember adds a new member to the given group.
// If ID is non-empty, it will be used, otherwise a new ID is created.
CreateMember(ctx context.Context, group api.ServerGroup, id string, mods ...CreateMemberMod) (string, error)
// UpdateMember updates the deployment status wrt the given member.
UpdateMember(ctx context.Context, member api.MemberStatus) error
// RemoveMemberByID removes a member with given id.
RemoveMemberByID(ctx context.Context, id string) error
// GetImageInfo returns the image info for an image with given name.
// Returns: (info, infoFound)
GetImageInfo(imageName string) (api.ImageInfo, bool)
// GetCurrentImageInfo returns the image info for an current image.
// Returns: (info, infoFound)
GetCurrentImageInfo() (api.ImageInfo, bool)
// SetCurrentImage changes the CurrentImage field in the deployment
// status to the given image.
SetCurrentImage(ctx context.Context, imageInfo api.ImageInfo) error
// DisableScalingCluster disables scaling DBservers and coordinators
DisableScalingCluster(ctx context.Context) error
// EnableScalingCluster enables scaling DBservers and coordinators
EnableScalingCluster(ctx context.Context) error
// UpdateClusterCondition update status of ArangoDeployment with defined modifier. If action returns True action is taken
UpdateClusterCondition(ctx context.Context, conditionType api.ConditionType, status bool, reason, message string) error
// GetBackup receives information about a backup resource
GetBackup(ctx context.Context, backup string) (*backupApi.ArangoBackup, error)
// GetName receives information about a deployment name
GetName() string
// SelectImage select currently used image by pod
SelectImage(spec api.DeploymentSpec, status api.DeploymentStatus) (api.ImageInfo, bool)
}
ActionContext provides methods to the Action implementations to control their context.
type ActionCore ¶
type ActionCore interface {
// Start performs the start of the action.
// Returns true if the action is completely finished, false in case
// the start time needs to be recorded and a ready condition needs to be checked.
Start(ctx context.Context) (bool, error)
// CheckProgress checks the progress of the action.
// Returns: ready, abort, error.
CheckProgress(ctx context.Context) (bool, bool, error)
}
ActionCore executes a single Plan item.
func NewActionSuccess ¶
func NewActionSuccess() ActionCore
NewActionSuccess returns action which always returns success.
type ActionLocalsContext ¶
type ActionLocalsContext interface {
CurrentLocals() api.PlanLocals
Get(action api.Action, key api.PlanLocalKey) (string, bool)
Add(key api.PlanLocalKey, value string, override bool) bool
SetTime(key api.PlanLocalKey, t time.Time) bool
GetTime(action api.Action, key api.PlanLocalKey) (time.Time, bool)
BackoffExecution(action api.Action, key api.PlanLocalKey, duration time.Duration) bool
}
type ActionPVCResizeConfig ¶
type ActionPVCResizeConfig struct {
Concurrency int
}
type ActionPlanAppender ¶
type ActionPlanAppender interface {
Action
// ActionPlanAppender modify plan after action execution
ActionPlanAppender(current api.Plan) (api.Plan, bool)
}
ActionPlanAppender modify plan after action execution
type ActionPost ¶
type ActionPost interface {
Action
// Post execute after action is completed
Post(ctx context.Context) error
}
ActionPost keep interface which is executed after action is completed.
type ActionPre ¶
type ActionPre interface {
Action
// Pre execute after action is completed
Pre(ctx context.Context) error
}
ActionPre keep interface which is executed before action is started.
type ActionProgressor ¶
type ActionProgressor interface {
// GetProgress returns progress of an action.
GetProgress() string
// SetProgress sets progress of an action.
SetProgress(progress string)
}
ActionProgressor describe functions to follow a progress of an action.
type ActionReloadCachedStatus ¶
type ActionReloadCachedStatus interface {
Action
// ReloadComponents return cache components to be reloaded
ReloadComponents() (types.UID, []definitions.Component)
}
ActionReloadCachedStatus keeps information about CachedStatus reloading (executed after action has been executed)
type ActionStartFailureGracePeriod ¶
type ActionStartFailureGracePeriod interface {
Action
// StartFailureGracePeriod returns information about failure grace period (defaults to 0)
StartFailureGracePeriod() time.Duration
}
ActionStartFailureGracePeriod extend action definition to allow specifying start failure grace period
type ActionsConfig ¶
type ActionsConfig struct {
// PVCResize keeps configuration for action api.ActionTypePVCResize
PVCResize ActionPVCResizeConfig
}
var ActionsConfigGlobal ActionsConfig
type Context ¶
type Context interface {
reconciler.DeploymentStatusUpdate
reconciler.DeploymentAgencyMaintenance
reconciler.DeploymentPodRenderer
reconciler.DeploymentImageManager
reconciler.ArangoAgencyGet
reconciler.ArangoApplier
reconciler.DeploymentGetter
reconciler.DeploymentDatabaseClient
reconciler.KubernetesEventGenerator
member.StateInspectorGetter
sutil.ACSGetter
// CreateMember adds a new member to the given group.
// If ID is non-empty, it will be used, otherwise a new ID is created.
// Returns ID, error
CreateMember(ctx context.Context, group api.ServerGroup, id string, mods ...CreateMemberMod) (string, error)
// DisableScalingCluster disables scaling DBservers and coordinators
DisableScalingCluster(ctx context.Context) error
// EnableScalingCluster enables scaling DBservers and coordinators
EnableScalingCluster(ctx context.Context) error
// GetBackup receives information about a backup resource
GetBackup(ctx context.Context, backup string) (*backupApi.ArangoBackup, error)
// GetAuthentication return authentication for members
GetAuthentication() conn.Auth
}
Context provides methods to the reconcile package.
type CreateMemberMod ¶
type CreateMemberMod func(s *api.DeploymentStatus, g api.ServerGroup, m *api.MemberStatus) error
type MemberRecreationConditionEvaluator ¶
type MemberRecreationConditionEvaluator func(ctx context.Context, apiObject k8sutil.APIObject, spec api.DeploymentSpec, status api.DeploymentStatus, group api.ServerGroup, member api.MemberStatus, context PlanBuilderContext) (bool, string, error)
type Metrics ¶
type Metrics struct {
Rebalancer MetricsRebalancer
}
func (*Metrics) GetRebalancer ¶
func (m *Metrics) GetRebalancer() *MetricsRebalancer
type MetricsRebalancer ¶
type MetricsRebalancer struct {
// contains filtered or unexported fields
}
func (*MetricsRebalancer) AddFailures ¶
func (m *MetricsRebalancer) AddFailures(i int)
func (*MetricsRebalancer) AddMoves ¶
func (m *MetricsRebalancer) AddMoves(moves int)
func (*MetricsRebalancer) AddSuccesses ¶
func (m *MetricsRebalancer) AddSuccesses(i int)
func (*MetricsRebalancer) SetCurrent ¶
func (m *MetricsRebalancer) SetCurrent(current int)
func (*MetricsRebalancer) SetEnabled ¶
func (m *MetricsRebalancer) SetEnabled(enabled bool)
type PlanAppender ¶
type PlanAppender interface {
Apply(pb planBuilder) PlanAppender
ApplyWithCondition(c planBuilderCondition, pb planBuilder) PlanAppender
ApplySubPlan(pb planBuilderSubPlan, plans ...planBuilder) PlanAppender
ApplyIfEmpty(pb planBuilder) PlanAppender
ApplyWithConditionIfEmpty(c planBuilderCondition, pb planBuilder) PlanAppender
ApplySubPlanIfEmpty(pb planBuilderSubPlan, plans ...planBuilder) PlanAppender
ApplyWithBackOff(key api.BackOffKey, delay time.Duration, pb planBuilder) PlanAppender
ApplyIfEmptyWithBackOff(key api.BackOffKey, delay time.Duration, pb planBuilder) PlanAppender
BackOff() api.BackOff
Plan() api.Plan
}
type PlanBuilderContext ¶
type PlanBuilderContext interface {
reconciler.DeploymentStatusUpdate
reconciler.DeploymentGetter
reconciler.DeploymentAgencyMaintenance
reconciler.DeploymentPodRenderer
reconciler.DeploymentImageManager
reconciler.ArangoAgencyGet
reconciler.DeploymentDatabaseClient
reconciler.KubernetesEventGenerator
member.StateInspectorGetter
sutil.ACSGetter
// GetAuthentication return authentication for members
GetAuthentication() conn.Auth
// GetBackup receives information about a backup resource
GetBackup(ctx context.Context, backup string) (*backupApi.ArangoBackup, error)
}
PlanBuilderContext contains context methods provided to plan builders.
type RebalanceAction ¶
type RebalanceActions ¶
type RebalanceActions []RebalanceAction
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler is the service that takes care of bring the a deployment in line with its (changed) specification.
func NewReconciler ¶
func NewReconciler(namespace, name string, context Context) *Reconciler
NewReconciler creates a new reconciler with given context.
func (*Reconciler) CheckDeployment ¶
func (r *Reconciler) CheckDeployment(ctx context.Context) error
CheckDeployment checks for obviously broken things and fixes them immediately
func (*Reconciler) CollectMetrics ¶
func (r *Reconciler) CollectMetrics(m metrics.PushMetric)
func (*Reconciler) CreatePlan ¶
func (d *Reconciler) CreatePlan(ctx context.Context) (error, bool)
CreatePlan considers the current specification & status of the deployment creates a plan to get the status in line with the specification. If a plan already exists, nothing is done.
func (*Reconciler) ExecutePlan ¶
func (d *Reconciler) ExecutePlan(ctx context.Context) (bool, error)
ExecutePlan tries to execute the plan as far as possible. Returns true when it has to be called again soon. False otherwise.
func (*Reconciler) WrapLogger ¶
func (r *Reconciler) WrapLogger(in *zerolog.Event) *zerolog.Event
type ScaleFilter ¶
type ScaleFilter interface {
Filter(in ScaleFilterFunc) ScaleFilter
Select(in ScaleSelectFunc) ScaleFilter
Get() (api.MemberStatus, error)
}
func NewScaleFilter ¶
func NewScaleFilter(context PlanBuilderContext, status api.DeploymentStatus, group api.ServerGroup, in api.MemberStatusList) ScaleFilter
type ScaleFilterFunc ¶
type ScaleFilterFunc func(context PlanBuilderContext, status api.DeploymentStatus, group api.ServerGroup, in api.MemberStatusList) (api.MemberStatusList, bool, error)
type ScaleSelectFunc ¶
type ScaleSelectFunc func(context PlanBuilderContext, status api.DeploymentStatus, group api.ServerGroup, in api.MemberStatusList) (api.MemberStatus, bool, error)
type WithPlanBuilder ¶
type WithPlanBuilder interface {
Apply(p planBuilder) api.Plan
ApplyWithCondition(c planBuilderCondition, p planBuilder) api.Plan
ApplySubPlan(p planBuilderSubPlan, plans ...planBuilder) api.Plan
}
func NewWithPlanBuilder ¶
func NewWithPlanBuilder(ctx context.Context, apiObject k8sutil.APIObject, spec api.DeploymentSpec, status api.DeploymentStatus, context PlanBuilderContext) WithPlanBuilder
Source Files
¶
- action.config.generated.go
- action.go
- action.register.generated.go
- action_add_member.go
- action_arango_member_update_pod_spec.go
- action_arango_member_update_pod_status.go
- action_backup_restore.go
- action_backup_restore_clean.go
- action_bootstrap_set_password.go
- action_bootstrap_update.go
- action_clean_member_service.go
- action_cleanout_member.go
- action_cluster_member_cleanup.go
- action_compact_member.go
- action_context.go
- action_delay.go
- action_encryption_add.go
- action_encryption_propagated.go
- action_encryption_refresh.go
- action_encryption_remove.go
- action_encryption_status_update.go
- action_enforce_resign_leadership.go
- action_helper.go
- action_idle.go
- action_jwt_add.go
- action_jwt_clean.go
- action_jwt_propagated.go
- action_jwt_refresh.go
- action_jwt_set_active.go
- action_jwt_status_update.go
- action_kill_member_pod.go
- action_maintenance_condition.go
- action_maintenance_disable.go
- action_maintenance_enable.go
- action_mark_to_remove_member.go
- action_member_maintenance_disable.community.go
- action_member_maintenance_disable.go
- action_member_maintenance_enable.community.go
- action_member_maintenance_enable.go
- action_member_phase_update.go
- action_member_status_sync.go
- action_migrate_member.go
- action_placeholder.community.go
- action_placeholder.go
- action_pvc_resize.go
- action_pvc_resized.go
- action_rebalancer_check.community.go
- action_rebalancer_check.go
- action_rebalancer_check_v2.go
- action_rebalancer_clean.community.go
- action_rebalancer_clean.go
- action_rebalancer_clean_v2.go
- action_rebalancer_generate.community.go
- action_rebalancer_generate.go
- action_rebalancer_generate_v2.go
- action_rebalancer_helper.go
- action_rebuild_outsynced_shards.go
- action_recreate_member.go
- action_remove_member.go
- action_remove_member_pvc.go
- action_renew_tls_certificate.go
- action_resign_leadership.go
- action_resign_leadership_utils.go
- action_resource_sync.go
- action_rotate_member.go
- action_rotate_start_member.go
- action_rotate_stop_member.go
- action_runtime_container_args_udpate.go
- action_runtime_container_image_update.go
- action_runtime_sync_tolerations.go
- action_set_condition_v2.go
- action_set_current_image.go
- action_set_current_member_arch.go
- action_set_license.go
- action_set_member_condition_v2.go
- action_shutdown_member.go
- action_timeouts.go
- action_timezone_secret_set.go
- action_tls_ca_append.go
- action_tls_ca_clean.go
- action_tls_ca_refresh.go
- action_tls_ca_renew.go
- action_tls_keyfile_clean.go
- action_tls_keyfile_refresh.go
- action_tls_propagated.go
- action_tls_sni_update.go
- action_tls_status_update.go
- action_topology_disable.community.go
- action_topology_disable.go
- action_topology_enable.community.go
- action_topology_enable.go
- action_topology_member_assignment.community.go
- action_topology_member_assignment.go
- action_topology_zones_update.community.go
- action_topology_zones_update.go
- action_upgrade_current_image.go
- action_upgrade_member.go
- action_uptodate_update.go
- action_wait_for_member_in_sync.go
- action_wait_for_member_ready.go
- action_wait_for_member_up.go
- condition_member_recreation.go
- context.go
- helper_member.go
- helper_shutdown.go
- helper_tls_sni.go
- helper_wrap.go
- metrics.go
- plan_builder.go
- plan_builder_appender.go
- plan_builder_bootstrap.go
- plan_builder_clean_out.go
- plan_builder_cluster.go
- plan_builder_common.go
- plan_builder_context.go
- plan_builder_encryption.go
- plan_builder_factory.go
- plan_builder_gateway.go
- plan_builder_generator.go
- plan_builder_high.go
- plan_builder_jwt.go
- plan_builder_license.go
- plan_builder_maintenance.community.go
- plan_builder_maintenance.go
- plan_builder_member_pod_scheduling_failure.go
- plan_builder_member_recovery.go
- plan_builder_normal.go
- plan_builder_rebalancer.community.go
- plan_builder_rebalancer.go
- plan_builder_rebalancer_v2.go
- plan_builder_rebuild_outsynced_shards.go
- plan_builder_resources.go
- plan_builder_restore.go
- plan_builder_rotate_arch.go
- plan_builder_rotate_upgrade.go
- plan_builder_rotate_upgrade_decision.go
- plan_builder_scale.go
- plan_builder_scale_funcs.community.go
- plan_builder_scale_funcs.go
- plan_builder_scale_utils.go
- plan_builder_storage.go
- plan_builder_sync.go
- plan_builder_timezone.go
- plan_builder_tls.go
- plan_builder_tls_go1.20.go
- plan_builder_tls_sni.go
- plan_builder_topology.community.go
- plan_builder_utils.go
- plan_builder_volume.go
- plan_executor.go
- reconciler.go
- utils.go
- utils_timezone.go