diff --git a/CHANGELOG.md b/CHANGELOG.md index 2220e4aeb..1d015a7e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/deployment/deployment_inspector.go b/pkg/deployment/deployment_inspector.go index 797732702..e7f7feff3 100644 --- a/pkg/deployment/deployment_inspector.go +++ b/pkg/deployment/deployment_inspector.go @@ -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 } diff --git a/pkg/deployment/reconcile/plan_builder_maintenance.go b/pkg/deployment/reconcile/plan_builder_maintenance.go index 6948c58c0..3e87bd5a2 100644 --- a/pkg/deployment/reconcile/plan_builder_maintenance.go +++ b/pkg/deployment/reconcile/plan_builder_maintenance.go @@ -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), @@ -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{ @@ -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()), } } @@ -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()), } }