Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- (Bugfix) Reorder Topology management plan steps
- (Feature) UpdateInProgress & UpgradeInProgress Conditions
- (Bugfix) Fix Maintenance switch and HotBackup race
- (Bugfix) Fix Maintenance Condition typo

## [1.2.9](https://github.com/arangodb/kube-arangodb/tree/1.2.9) (2022-03-30)
- (Feature) Improve Kubernetes clientsets management
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/deployment_inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (d *Deployment) refreshMaintenanceTTL(ctx context.Context) {

// Check GracePeriod
if t, ok := maintenance.Time(); ok {
if time.Until(t) < d.apiObject.Spec.Timeouts.GetMaintenanceGracePeriod() {
if time.Until(t) < time.Hour-d.apiObject.Spec.Timeouts.GetMaintenanceGracePeriod() {
if err := d.SetAgencyMaintenanceMode(ctx, true); err != nil {
return
}
Expand Down
24 changes: 12 additions & 12 deletions pkg/deployment/reconcile/plan_builder_maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func createBackupInProgressConditionPlan(ctx context.Context,

currentCondition, currentConditionExists := status.Conditions.Get(api.ConditionTypeBackupInProgress)

backupInProgress := cache.Target.HotBackup.Create
maintenance := cache.Target.HotBackup.Create

if currentConditionExists {
// Condition exists
if !backupInProgress.Exists() {
if !maintenance.Exists() {
// Condition needs to be removed
return api.Plan{
removeConditionActionV2("Backup not in progress", api.ConditionTypeBackupInProgress),
Expand All @@ -58,7 +58,7 @@ func createBackupInProgressConditionPlan(ctx context.Context,

// Backup is in progress

hash := backupInProgress.Hash()
hash := maintenance.Hash()

if !currentCondition.IsTrue() || currentCondition.Hash != hash {
return api.Plan{
Expand All @@ -68,9 +68,9 @@ func createBackupInProgressConditionPlan(ctx context.Context,

return nil
} else {
if backupInProgress.Exists() {
if maintenance.Exists() {
return api.Plan{
updateConditionActionV2("Backup in progress", api.ConditionTypeBackupInProgress, true, "Backup In Progress", "", backupInProgress.Hash()),
updateConditionActionV2("Backup in progress", api.ConditionTypeBackupInProgress, true, "Backup In Progress", "", maintenance.Hash()),
}
}

Expand All @@ -94,32 +94,32 @@ func createMaintenanceConditionPlan(ctx context.Context,

currentCondition, currentConditionExists := status.Conditions.Get(api.ConditionTypeMaintenance)

backupInProgress := cache.Target.HotBackup.Create
maintenance := cache.Supervision.Maintenance

if currentConditionExists {
// Condition exists
if !backupInProgress.Exists() {
if !maintenance.Exists() {
// Condition needs to be removed
return api.Plan{
removeConditionActionV2("Backup not in progress", api.ConditionTypeMaintenance),
removeConditionActionV2("Maintenance Disabled", api.ConditionTypeMaintenance),
}
}

// Backup is in progress

hash := backupInProgress.Hash()
hash := maintenance.Hash()

if !currentCondition.IsTrue() || currentCondition.Hash != hash {
return api.Plan{
updateConditionActionV2("Backup in progress", api.ConditionTypeMaintenance, true, "Backup In Progress", "", hash),
updateConditionActionV2("Maintenance Enabled", api.ConditionTypeMaintenance, true, "Maintenance Enabled", "", hash),
}
}

return nil
} else {
if backupInProgress.Exists() {
if maintenance.Exists() {
return api.Plan{
updateConditionActionV2("Backup in progress", api.ConditionTypeMaintenance, true, "Backup In Progress", "", backupInProgress.Hash()),
updateConditionActionV2("Maintenance Enabled", api.ConditionTypeMaintenance, true, "Maintenance Enabled", "", maintenance.Hash()),
}
}

Expand Down