mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Allow to configure action timeouts (#934)
This commit is contained in:
parent
53871beaf4
commit
a117bdb1dd
69 changed files with 216 additions and 168 deletions
|
@ -8,6 +8,7 @@
|
|||
- (Update) Bump K8S API to 1.21.10
|
||||
- (Feature) (ACS) Add ACS handler
|
||||
- (Feature) Allow to restart DBServers in cases when WriteConcern will be satisfied
|
||||
- (Feature) Allow to configure action timeouts
|
||||
|
||||
## [1.2.8](https://github.com/arangodb/kube-arangodb/tree/1.2.8) (2022-02-24)
|
||||
- Do not check License V2 on Community images
|
||||
|
|
|
@ -31,14 +31,18 @@ const (
|
|||
)
|
||||
|
||||
type Timeouts struct {
|
||||
// AddMember action timeout
|
||||
AddMember *Timeout `json:"addMember,omitempty"`
|
||||
|
||||
// MaintenanceGracePeriod action timeout
|
||||
MaintenanceGracePeriod *Timeout `json:"maintenanceGracePeriod,omitempty"`
|
||||
|
||||
// RuntimeContainerImageUpdate action timeout
|
||||
RuntimeContainerImageUpdate *Timeout `json:"runtimeContainerImageUpdate,omitempty"`
|
||||
// Actions
|
||||
Actions ActionTimeouts `json:"actions,omitempty"`
|
||||
|
||||
// deprecated
|
||||
AddMember *Timeout `json:"-"`
|
||||
|
||||
// deprecated
|
||||
RuntimeContainerImageUpdate *Timeout `json:"-"`
|
||||
}
|
||||
|
||||
func (t *Timeouts) GetMaintenanceGracePeriod() time.Duration {
|
||||
|
@ -57,6 +61,12 @@ func (t *Timeouts) Get() Timeouts {
|
|||
return *t
|
||||
}
|
||||
|
||||
type ActionTimeouts map[ActionType]Timeout
|
||||
|
||||
func NewTimeout(timeout time.Duration) Timeout {
|
||||
return Timeout(meta.Duration{Duration: timeout})
|
||||
}
|
||||
|
||||
type Timeout meta.Duration
|
||||
|
||||
func (t *Timeout) Get(d time.Duration) time.Duration {
|
||||
|
|
|
@ -30,6 +30,16 @@ import (
|
|||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
func GetAllActions() []api.ActionType {
|
||||
z := make([]api.ActionType, 0, len(definedActions))
|
||||
|
||||
for k := range definedActions {
|
||||
z = append(z, k)
|
||||
}
|
||||
|
||||
return z
|
||||
}
|
||||
|
||||
// ActionCore executes a single Plan item.
|
||||
type ActionCore interface {
|
||||
// Start performs the start of the action.
|
||||
|
@ -45,8 +55,6 @@ type ActionCore interface {
|
|||
type Action interface {
|
||||
ActionCore
|
||||
|
||||
// Timeout returns the amount of time after which this action will timeout.
|
||||
Timeout(deploymentSpec api.DeploymentSpec) time.Duration
|
||||
// MemberID Return the MemberID used / created in this action
|
||||
MemberID() string
|
||||
}
|
||||
|
@ -144,9 +152,10 @@ type actionFactory func(log zerolog.Logger, action api.Action, actionCtx ActionC
|
|||
var (
|
||||
definedActions = map[api.ActionType]actionFactory{}
|
||||
definedActionsLock sync.Mutex
|
||||
actionTimeouts = api.ActionTimeouts{}
|
||||
)
|
||||
|
||||
func registerAction(t api.ActionType, f actionFactory) {
|
||||
func registerAction(t api.ActionType, f actionFactory, timeout time.Duration) {
|
||||
definedActionsLock.Lock()
|
||||
defer definedActionsLock.Unlock()
|
||||
|
||||
|
@ -156,6 +165,7 @@ func registerAction(t api.ActionType, f actionFactory) {
|
|||
}
|
||||
|
||||
definedActions[t] = f
|
||||
actionTimeouts[t] = api.NewTimeout(timeout)
|
||||
}
|
||||
|
||||
func getActionFactory(t api.ActionType) (actionFactory, bool) {
|
||||
|
|
|
@ -22,7 +22,6 @@ package reconcile
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/deployment/topology"
|
||||
|
||||
|
@ -35,7 +34,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeAddMember, newAddMemberAction)
|
||||
registerAction(api.ActionTypeAddMember, newAddMemberAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
// newAddMemberAction creates a new Action that implements the given
|
||||
|
@ -43,9 +42,7 @@ func init() {
|
|||
func newAddMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionAddMember{}
|
||||
|
||||
a.actionImpl = newBaseActionImpl(log, action, actionCtx, func(deploymentSpec api.DeploymentSpec) time.Duration {
|
||||
return deploymentSpec.Timeouts.Get().AddMember.Get(addMemberTimeout)
|
||||
}, &a.newMemberID)
|
||||
a.actionImpl = newBaseActionImpl(log, action, actionCtx, &a.newMemberID)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeArangoMemberUpdatePodSpec, newArangoMemberUpdatePodSpecAction)
|
||||
registerAction(api.ActionTypeArangoMemberUpdatePodSpec, newArangoMemberUpdatePodSpecAction, defaultTimeout)
|
||||
}
|
||||
|
||||
// newArangoMemberUpdatePodSpecAction creates a new Action that implements the given
|
||||
|
@ -41,7 +41,7 @@ func init() {
|
|||
func newArangoMemberUpdatePodSpecAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionArangoMemberUpdatePodSpec{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeArangoMemberUpdatePodStatus, newArangoMemberUpdatePodStatusAction)
|
||||
registerAction(api.ActionTypeArangoMemberUpdatePodStatus, newArangoMemberUpdatePodStatusAction, defaultTimeout)
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -43,7 +43,7 @@ const (
|
|||
func newArangoMemberUpdatePodStatusAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionArangoMemberUpdatePodStatus{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeBackupRestore, newBackupRestoreAction)
|
||||
registerAction(api.ActionTypeBackupRestore, newBackupRestoreAction, backupRestoreTimeout)
|
||||
}
|
||||
|
||||
func newBackupRestoreAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionBackupRestore{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, backupRestoreTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeBackupRestoreClean, newBackupRestoreCleanAction)
|
||||
registerAction(api.ActionTypeBackupRestoreClean, newBackupRestoreCleanAction, backupRestoreTimeout)
|
||||
}
|
||||
|
||||
func newBackupRestoreCleanAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionBackupRestoreClean{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, backupRestoreTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -37,13 +37,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeBootstrapSetPassword, newBootstrapSetPasswordAction)
|
||||
registerAction(api.ActionTypeBootstrapSetPassword, newBootstrapSetPasswordAction, defaultTimeout)
|
||||
}
|
||||
|
||||
func newBootstrapSetPasswordAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionBootstrapSetPassword{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ func (a actionBootstrapSetPassword) Start(ctx context.Context) (bool, error) {
|
|||
a.log.Warn().Msgf("User does not exist in password hashes")
|
||||
return true, nil
|
||||
} else {
|
||||
ctxChild, cancel := context.WithTimeout(ctx, a.Timeout(spec))
|
||||
ctxChild, cancel := globals.GetGlobals().Timeouts().ArangoD().WithTimeout(ctx)
|
||||
defer cancel()
|
||||
|
||||
if password, err := a.setUserPassword(ctxChild, user, secret.Get()); err != nil {
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeBootstrapUpdate, newBootstrapUpdateAction)
|
||||
registerAction(api.ActionTypeBootstrapUpdate, newBootstrapUpdateAction, defaultTimeout)
|
||||
}
|
||||
|
||||
func newBootstrapUpdateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionBootstrapUpdate{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeCleanOutMember, newCleanOutMemberAction)
|
||||
registerAction(api.ActionTypeCleanOutMember, newCleanOutMemberAction, cleanoutMemberTimeout)
|
||||
}
|
||||
|
||||
// newCleanOutMemberAction creates a new Action that implements the given
|
||||
|
@ -43,7 +43,7 @@ func init() {
|
|||
func newCleanOutMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionCleanoutMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, cleanoutMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeClusterMemberCleanup, newClusterMemberCleanupAction)
|
||||
registerAction(api.ActionTypeClusterMemberCleanup, newClusterMemberCleanupAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
// newClusterMemberCleanupAction creates a new Action that implements the given
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
|||
func newClusterMemberCleanupAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionClusterMemberCleanup{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, addMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeDisableClusterScaling, newDisableScalingCluster)
|
||||
registerAction(api.ActionTypeDisableClusterScaling, newDisableScalingCluster, 0)
|
||||
}
|
||||
|
||||
// newDisableScalingCluster creates the new action with disabling scaling DBservers and coordinators.
|
||||
func newDisableScalingCluster(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionDisableScalingCluster{}
|
||||
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, 0, util.NewString(""))
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, util.NewString(""))
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEnableClusterScaling, newEnableScalingCluster)
|
||||
registerAction(api.ActionTypeEnableClusterScaling, newEnableScalingCluster, 0)
|
||||
}
|
||||
|
||||
// newEnableScalingCluster creates the new action with enabling scaling DBservers and coordinators.
|
||||
func newEnableScalingCluster(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionEnableScalingCluster{}
|
||||
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, 0, util.NewString(""))
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, util.NewString(""))
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -57,13 +57,13 @@ func ensureEncryptionSupport(actionCtx ActionContext) error {
|
|||
}
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEncryptionKeyAdd, newEncryptionKeyAdd)
|
||||
registerAction(api.ActionTypeEncryptionKeyAdd, newEncryptionKeyAdd, defaultTimeout)
|
||||
}
|
||||
|
||||
func newEncryptionKeyAdd(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &encryptionKeyAddAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEncryptionKeyPropagated, newEncryptionKeyPropagated)
|
||||
registerAction(api.ActionTypeEncryptionKeyPropagated, newEncryptionKeyPropagated, defaultTimeout)
|
||||
}
|
||||
|
||||
func newEncryptionKeyPropagated(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &encryptionKeyPropagatedAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEncryptionKeyRefresh, newEncryptionKeyRefresh)
|
||||
registerAction(api.ActionTypeEncryptionKeyRefresh, newEncryptionKeyRefresh, defaultTimeout)
|
||||
}
|
||||
|
||||
func newEncryptionKeyRefresh(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &encryptionKeyRefreshAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEncryptionKeyRemove, newEncryptionKeyRemove)
|
||||
registerAction(api.ActionTypeEncryptionKeyRemove, newEncryptionKeyRemove, defaultTimeout)
|
||||
}
|
||||
|
||||
func newEncryptionKeyRemove(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &encryptionKeyRemoveAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEncryptionKeyStatusUpdate, newEncryptionKeyStatusUpdate)
|
||||
registerAction(api.ActionTypeEncryptionKeyStatusUpdate, newEncryptionKeyStatusUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func newEncryptionKeyStatusUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &encryptionKeyStatusUpdateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -22,20 +22,11 @@ package reconcile
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type TimeoutFetcher func(deploymentSpec api.DeploymentSpec) time.Duration
|
||||
|
||||
func NewTimeoutFetcher(t time.Duration) TimeoutFetcher {
|
||||
return func(deploymentSpec api.DeploymentSpec) time.Duration {
|
||||
return t
|
||||
}
|
||||
}
|
||||
|
||||
type actionEmpty struct {
|
||||
actionImpl
|
||||
actionEmptyStart
|
||||
|
@ -58,23 +49,23 @@ func (e actionEmptyStart) Start(_ context.Context) (bool, error) {
|
|||
return false, nil
|
||||
}
|
||||
|
||||
func newActionImplDefRef(log zerolog.Logger, action api.Action, actionCtx ActionContext, timeout time.Duration) actionImpl {
|
||||
return newActionImpl(log, action, actionCtx, timeout, &action.MemberID)
|
||||
func newActionImplDefRef(log zerolog.Logger, action api.Action, actionCtx ActionContext) actionImpl {
|
||||
return newActionImpl(log, action, actionCtx, &action.MemberID)
|
||||
}
|
||||
|
||||
func newActionImpl(log zerolog.Logger, action api.Action, actionCtx ActionContext, timeout time.Duration, memberIDRef *string) actionImpl {
|
||||
func newActionImpl(log zerolog.Logger, action api.Action, actionCtx ActionContext, memberIDRef *string) actionImpl {
|
||||
if memberIDRef == nil {
|
||||
panic("Action cannot have nil reference to member!")
|
||||
}
|
||||
|
||||
return newBaseActionImpl(log, action, actionCtx, NewTimeoutFetcher(timeout), memberIDRef)
|
||||
return newBaseActionImpl(log, action, actionCtx, memberIDRef)
|
||||
}
|
||||
|
||||
func newBaseActionImplDefRef(log zerolog.Logger, action api.Action, actionCtx ActionContext, timeout TimeoutFetcher) actionImpl {
|
||||
return newBaseActionImpl(log, action, actionCtx, timeout, &action.MemberID)
|
||||
func newBaseActionImplDefRef(log zerolog.Logger, action api.Action, actionCtx ActionContext) actionImpl {
|
||||
return newBaseActionImpl(log, action, actionCtx, &action.MemberID)
|
||||
}
|
||||
|
||||
func newBaseActionImpl(log zerolog.Logger, action api.Action, actionCtx ActionContext, timeout TimeoutFetcher, memberIDRef *string) actionImpl {
|
||||
func newBaseActionImpl(log zerolog.Logger, action api.Action, actionCtx ActionContext, memberIDRef *string) actionImpl {
|
||||
if memberIDRef == nil {
|
||||
panic("Action cannot have nil reference to member!")
|
||||
}
|
||||
|
@ -83,7 +74,6 @@ func newBaseActionImpl(log zerolog.Logger, action api.Action, actionCtx ActionCo
|
|||
log: log,
|
||||
action: action,
|
||||
actionCtx: actionCtx,
|
||||
timeout: timeout,
|
||||
memberIDRef: memberIDRef,
|
||||
}
|
||||
}
|
||||
|
@ -93,19 +83,9 @@ type actionImpl struct {
|
|||
action api.Action
|
||||
actionCtx ActionContext
|
||||
|
||||
timeout TimeoutFetcher
|
||||
memberIDRef *string
|
||||
}
|
||||
|
||||
// Timeout returns the amount of time after which this action will timeout.
|
||||
func (a actionImpl) Timeout(deploymentSpec api.DeploymentSpec) time.Duration {
|
||||
if a.timeout == nil {
|
||||
return defaultTimeout
|
||||
}
|
||||
|
||||
return a.timeout(deploymentSpec)
|
||||
}
|
||||
|
||||
// MemberID returns the member ID used / created in the current action.
|
||||
func (a actionImpl) MemberID() string {
|
||||
return *a.memberIDRef
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeIdle, newIdleAction)
|
||||
registerAction(api.ActionTypeIdle, newIdleAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
// newIdleAction creates a new Action that implements the given
|
||||
|
@ -36,7 +36,7 @@ func init() {
|
|||
func newIdleAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionIdle{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, addMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -42,13 +42,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTAdd, newJWTAdd)
|
||||
registerAction(api.ActionTypeJWTAdd, newJWTAdd, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTAdd(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtAddAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTClean, newJWTClean)
|
||||
registerAction(api.ActionTypeJWTClean, newJWTClean, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTClean(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtCleanAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTPropagated, newJWTPropagated)
|
||||
registerAction(api.ActionTypeJWTPropagated, newJWTPropagated, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTPropagated(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtPropagatedAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTRefresh, newJWTRefresh)
|
||||
registerAction(api.ActionTypeJWTRefresh, newJWTRefresh, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTRefresh(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtRefreshAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -42,13 +42,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTSetActive, newJWTSetActive)
|
||||
registerAction(api.ActionTypeJWTSetActive, newJWTSetActive, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTSetActive(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtSetActiveAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@ func ensureJWTFolderSupport(spec api.DeploymentSpec, status api.DeploymentStatus
|
|||
}
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeJWTStatusUpdate, newJWTStatusUpdate)
|
||||
registerAction(api.ActionTypeJWTStatusUpdate, newJWTStatusUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func newJWTStatusUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &jwtStatusUpdateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeKillMemberPod, newKillMemberPodAction)
|
||||
registerAction(api.ActionTypeKillMemberPod, newKillMemberPodAction, defaultTimeout)
|
||||
}
|
||||
|
||||
// newKillMemberPodAction creates a new Action that implements the given
|
||||
|
@ -41,7 +41,7 @@ func init() {
|
|||
func newKillMemberPodAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionKillMemberPod{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetMaintenanceCondition, newSetMaintenanceConditionAction)
|
||||
registerAction(api.ActionTypeSetMaintenanceCondition, newSetMaintenanceConditionAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
func newSetMaintenanceConditionAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionSetMaintenanceCondition{}
|
||||
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, addMemberTimeout, &a.newMemberID)
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, &a.newMemberID)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeDisableMaintenance, newDisableMaintenanceAction)
|
||||
registerAction(api.ActionTypeDisableMaintenance, newDisableMaintenanceAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
func newDisableMaintenanceAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionDisableMaintenance{}
|
||||
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, addMemberTimeout, &a.newMemberID)
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, &a.newMemberID)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeEnableMaintenance, newEnableMaintenanceAction)
|
||||
registerAction(api.ActionTypeEnableMaintenance, newEnableMaintenanceAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
func newEnableMaintenanceAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionEnableMaintenance{}
|
||||
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, addMemberTimeout, &a.newMemberID)
|
||||
a.actionImpl = newActionImpl(log, action, actionCtx, &a.newMemberID)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeMarkToRemoveMember, newMarkToRemoveMemberAction)
|
||||
registerAction(api.ActionTypeMarkToRemoveMember, newMarkToRemoveMemberAction, addMemberTimeout)
|
||||
}
|
||||
|
||||
func newMarkToRemoveMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionMarkToRemove{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, addMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeMemberPhaseUpdate, newMemberPhaseUpdate)
|
||||
registerAction(api.ActionTypeMemberPhaseUpdate, newMemberPhaseUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -41,7 +41,7 @@ const (
|
|||
func newMemberPhaseUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &memberPhaseUpdateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeMemberRIDUpdate, newMemberRIDUpdate)
|
||||
registerAction(api.ActionTypeMemberRIDUpdate, newMemberRIDUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func newMemberRIDUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &memberRIDUpdateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypePVCResize, newPVCResizeAction)
|
||||
registerAction(api.ActionTypePVCResize, newPVCResizeAction, pvcResizeTimeout)
|
||||
}
|
||||
|
||||
// newRotateMemberAction creates a new Action that implements the given
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
|||
func newPVCResizeAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionPVCResize{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, pvcResizeTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypePVCResized, newPVCResizedAction)
|
||||
registerAction(api.ActionTypePVCResized, newPVCResizedAction, pvcResizedTimeout)
|
||||
}
|
||||
|
||||
// newRotateMemberAction creates a new Action that implements the given
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
|||
func newPVCResizedAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionPVCResized{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, pvcResizedTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRecreateMember, newRecreateMemberAction)
|
||||
registerAction(api.ActionTypeRecreateMember, newRecreateMemberAction, recreateMemberTimeout)
|
||||
}
|
||||
|
||||
// newRecreateMemberAction creates a new Action that implements the given
|
||||
|
@ -41,7 +41,7 @@ func init() {
|
|||
func newRecreateMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRecreateMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, recreateMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRemoveMember, newRemoveMemberAction)
|
||||
registerAction(api.ActionTypeRemoveMember, newRemoveMemberAction, removeMemberTimeout)
|
||||
}
|
||||
|
||||
// newRemoveMemberAction creates a new Action that implements the given
|
||||
|
@ -43,7 +43,7 @@ func init() {
|
|||
func newRemoveMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRemoveMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, removeMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeResignLeadership, newResignLeadershipAction)
|
||||
registerAction(api.ActionTypeResignLeadership, newResignLeadershipAction, shutdownMemberTimeout)
|
||||
}
|
||||
|
||||
// newResignLeadershipAction creates a new Action that implements the given
|
||||
|
@ -42,7 +42,7 @@ func init() {
|
|||
func newResignLeadershipAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionResignLeadership{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, shutdownMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRotateMember, withActionStartFailureGracePeriod(newRotateMemberAction, time.Minute))
|
||||
registerAction(api.ActionTypeRotateMember, withActionStartFailureGracePeriod(newRotateMemberAction, time.Minute), rotateMemberTimeout)
|
||||
}
|
||||
|
||||
// newRotateMemberAction creates a new Action that implements the given
|
||||
|
@ -42,7 +42,7 @@ func init() {
|
|||
func newRotateMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRotateMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, rotateMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRotateStartMember, withActionStartFailureGracePeriod(newRotateStartMemberAction, time.Minute))
|
||||
registerAction(api.ActionTypeRotateStartMember, withActionStartFailureGracePeriod(newRotateStartMemberAction, time.Minute), rotateMemberTimeout)
|
||||
}
|
||||
|
||||
// newRotateStartMemberAction creates a new Action that implements the given
|
||||
|
@ -42,7 +42,7 @@ func init() {
|
|||
func newRotateStartMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRotateStartMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, rotateMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRotateStopMember, newRotateStopMemberAction)
|
||||
registerAction(api.ActionTypeRotateStopMember, newRotateStopMemberAction, rotateMemberTimeout)
|
||||
}
|
||||
|
||||
// newRotateStopMemberAction creates a new Action that implements the given
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
|||
func newRotateStopMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRotateStopMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, rotateMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -37,13 +37,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRuntimeContainerArgsLogLevelUpdate, runtimeContainerArgsUpdate)
|
||||
registerAction(api.ActionTypeRuntimeContainerArgsLogLevelUpdate, runtimeContainerArgsUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func runtimeContainerArgsUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRuntimeContainerArgsUpdate{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ package reconcile
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/deployment/rotation"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
|
@ -34,15 +33,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRuntimeContainerImageUpdate, runtimeContainerImageUpdate)
|
||||
registerAction(api.ActionTypeRuntimeContainerImageUpdate, runtimeContainerImageUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func runtimeContainerImageUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionRuntimeContainerImageUpdate{}
|
||||
|
||||
a.actionImpl = newBaseActionImplDefRef(log, action, actionCtx, func(deploymentSpec api.DeploymentSpec) time.Duration {
|
||||
return deploymentSpec.Timeouts.Get().AddMember.Get(defaultTimeout)
|
||||
})
|
||||
a.actionImpl = newBaseActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetCondition, setCondition)
|
||||
registerAction(api.ActionTypeSetCondition, setCondition, defaultTimeout)
|
||||
}
|
||||
|
||||
func setCondition(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionSetCondition{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetConditionV2, setConditionV2)
|
||||
registerAction(api.ActionTypeSetConditionV2, setConditionV2, defaultTimeout)
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -48,7 +48,7 @@ const (
|
|||
func setConditionV2(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionSetConditionV2{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetMemberCurrentImage, newSetCurrentMemberImageAction)
|
||||
registerAction(api.ActionTypeSetMemberCurrentImage, newSetCurrentMemberImageAction, upgradeMemberTimeout)
|
||||
}
|
||||
|
||||
// newSetCurrentImageAction creates a new Action that implements the given
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
|||
func newSetCurrentMemberImageAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &setCurrentMemberImageAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, upgradeMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -33,13 +33,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeLicenseSet, newLicenseSet)
|
||||
registerAction(api.ActionTypeLicenseSet, newLicenseSet, defaultTimeout)
|
||||
}
|
||||
|
||||
func newLicenseSet(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &licenseSetAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetMemberCondition, setMemberCondition)
|
||||
registerAction(api.ActionTypeSetMemberCondition, setMemberCondition, defaultTimeout)
|
||||
}
|
||||
|
||||
func setMemberCondition(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionSetMemberCondition{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetMemberConditionV2, setMemberConditionV2)
|
||||
registerAction(api.ActionTypeSetMemberConditionV2, setMemberConditionV2, defaultTimeout)
|
||||
}
|
||||
|
||||
func setMemberConditionV2(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionSetMemberConditionV2{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeShutdownMember, withActionStartFailureGracePeriod(newShutdownMemberAction, time.Minute))
|
||||
registerAction(api.ActionTypeShutdownMember, withActionStartFailureGracePeriod(newShutdownMemberAction, time.Minute), shutdownMemberTimeout)
|
||||
}
|
||||
|
||||
// newShutdownMemberAction creates a new Action that implements the given
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
|||
func newShutdownMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionShutdownMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, shutdownMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
53
pkg/deployment/reconcile/action_timeouts.go
Normal file
53
pkg/deployment/reconcile/action_timeouts.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package reconcile
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
)
|
||||
|
||||
func GetActionTimeout(spec api.DeploymentSpec, t api.ActionType) time.Duration {
|
||||
if d, ok := getActionTimeout(spec, t); ok {
|
||||
return d
|
||||
}
|
||||
|
||||
if d, ok := getActionTimeout(spec, "default"); ok {
|
||||
return d
|
||||
}
|
||||
|
||||
return defaultTimeout
|
||||
}
|
||||
|
||||
func getActionTimeout(spec api.DeploymentSpec, t api.ActionType) (time.Duration, bool) {
|
||||
if timeouts := spec.Timeouts; timeouts != nil {
|
||||
if d, ok := timeouts.Actions[t]; ok {
|
||||
return d.Duration, true
|
||||
}
|
||||
}
|
||||
|
||||
if d, ok := actionTimeouts[t]; ok {
|
||||
return d.Duration, true
|
||||
}
|
||||
|
||||
return 0, false
|
||||
}
|
|
@ -42,13 +42,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeAppendTLSCACertificate, newAppendTLSCACertificateAction)
|
||||
registerAction(api.ActionTypeAppendTLSCACertificate, newAppendTLSCACertificateAction, operationTLSCACertificateTimeout)
|
||||
}
|
||||
|
||||
func newAppendTLSCACertificateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &appendTLSCACertificateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, operationTLSCACertificateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeCleanTLSCACertificate, newCleanTLSCACertificateAction)
|
||||
registerAction(api.ActionTypeCleanTLSCACertificate, newCleanTLSCACertificateAction, operationTLSCACertificateTimeout)
|
||||
}
|
||||
|
||||
func newCleanTLSCACertificateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &cleanTLSCACertificateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, operationTLSCACertificateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRenewTLSCACertificate, newRenewTLSCACertificateAction)
|
||||
registerAction(api.ActionTypeRenewTLSCACertificate, newRenewTLSCACertificateAction, operationTLSCACertificateTimeout)
|
||||
}
|
||||
|
||||
func newRenewTLSCACertificateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &renewTLSCACertificateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, operationTLSCACertificateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeCleanTLSKeyfileCertificate, newCleanTLSKeyfileCertificateAction)
|
||||
registerAction(api.ActionTypeCleanTLSKeyfileCertificate, newCleanTLSKeyfileCertificateAction, operationTLSCACertificateTimeout)
|
||||
}
|
||||
|
||||
func newCleanTLSKeyfileCertificateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &cleanTLSKeyfileCertificateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, operationTLSCACertificateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeRefreshTLSKeyfileCertificate, newRefreshTLSKeyfileCertificateAction)
|
||||
registerAction(api.ActionTypeRefreshTLSKeyfileCertificate, newRefreshTLSKeyfileCertificateAction, operationTLSCACertificateTimeout)
|
||||
}
|
||||
|
||||
func newRefreshTLSKeyfileCertificateAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &refreshTLSKeyfileCertificateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, operationTLSCACertificateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTLSPropagated, newTLSPropagated)
|
||||
registerAction(api.ActionTypeTLSPropagated, newTLSPropagated, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTLSPropagated(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &tlsPropagatedAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeUpdateTLSSNI, newTLSSNIUpdate)
|
||||
registerAction(api.ActionTypeUpdateTLSSNI, newTLSSNIUpdate, tlsSNIUpdateTimeout)
|
||||
}
|
||||
|
||||
func newTLSSNIUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &tlsSNIUpdate{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, tlsSNIUpdateTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTLSKeyStatusUpdate, newTLSKeyStatusUpdate)
|
||||
registerAction(api.ActionTypeTLSKeyStatusUpdate, newTLSKeyStatusUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTLSKeyStatusUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &tlsKeyStatusUpdateAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTopologyDisable, newTopologyDisable)
|
||||
registerAction(api.ActionTypeTopologyDisable, newTopologyDisable, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTopologyDisable(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &topologyDisable{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTopologyEnable, newTopologyEnable)
|
||||
registerAction(api.ActionTypeTopologyEnable, newTopologyEnable, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTopologyEnable(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &topologyEnable{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTopologyMemberAssignment, newTopologyMemberAssignment)
|
||||
registerAction(api.ActionTypeTopologyMemberAssignment, newTopologyMemberAssignment, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTopologyMemberAssignment(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &topologyMemberAssignment{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeTopologyZonesUpdate, newTopologyZonesUpdate)
|
||||
registerAction(api.ActionTypeTopologyZonesUpdate, newTopologyZonesUpdate, defaultTimeout)
|
||||
}
|
||||
|
||||
func newTopologyZonesUpdate(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &topologyZonesUpdate{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, defaultTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeSetCurrentImage, newSetCurrentImageAction)
|
||||
registerAction(api.ActionTypeSetCurrentImage, newSetCurrentImageAction, upgradeMemberTimeout)
|
||||
}
|
||||
|
||||
// newSetCurrentImageAction creates a new Action that implements the given
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
|||
func newSetCurrentImageAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &setCurrentImageAction{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, upgradeMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeUpgradeMember, newUpgradeMemberAction)
|
||||
registerAction(api.ActionTypeUpgradeMember, newUpgradeMemberAction, upgradeMemberTimeout)
|
||||
}
|
||||
|
||||
// newUpgradeMemberAction creates a new Action that implements the given
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
|||
func newUpgradeMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionUpgradeMember{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, upgradeMemberTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeWaitForMemberInSync, newWaitForMemberInSync)
|
||||
registerAction(api.ActionTypeWaitForMemberInSync, newWaitForMemberInSync, waitForMemberUpTimeout)
|
||||
}
|
||||
|
||||
// newWaitForMemberUpAction creates a new Action that implements the given
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
|||
func newWaitForMemberInSync(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionWaitForMemberInSync{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, waitForMemberUpTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
registerAction(api.ActionTypeWaitForMemberUp, newWaitForMemberUpAction)
|
||||
registerAction(api.ActionTypeWaitForMemberUp, newWaitForMemberUpAction, waitForMemberUpTimeout)
|
||||
}
|
||||
|
||||
// newWaitForMemberUpAction creates a new Action that implements the given
|
||||
|
@ -45,7 +45,7 @@ func init() {
|
|||
func newWaitForMemberUpAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionWaitForMemberUp{}
|
||||
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx, waitForMemberUpTimeout)
|
||||
a.actionImpl = newActionImplDefRef(log, action, actionCtx)
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ func (d *Reconciler) executeAction(ctx context.Context, log zerolog.Logger, plan
|
|||
log.Warn().Msg("Action aborted. Removing the entire plan")
|
||||
d.context.CreateEvent(k8sutil.NewPlanAbortedEvent(d.context.GetAPIObject(), string(planAction.Type), planAction.MemberID, planAction.Group.AsRole()))
|
||||
return false, true, false, false, nil
|
||||
} else if time.Now().After(planAction.CreationTime.Add(action.Timeout(d.context.GetSpec()))) {
|
||||
} else if time.Now().After(planAction.CreationTime.Add(GetActionTimeout(d.context.GetSpec(), planAction.Type))) {
|
||||
log.Warn().Msg("Action not finished in time. Removing the entire plan")
|
||||
d.context.CreateEvent(k8sutil.NewPlanTimeoutEvent(d.context.GetAPIObject(), string(planAction.Type), planAction.MemberID, planAction.Group.AsRole()))
|
||||
return false, true, false, false, nil
|
||||
|
|
Loading…
Reference in a new issue