From 128f2ed38f2664ac80d0678d7c47e8a50c2ea76e Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Tue, 15 Dec 2020 12:41:14 +0100 Subject: [PATCH] 1.1.3 RC2 Fixes (#678) --- .gitignore | 3 +- .vscode/settings.json | 37 ------------------- pkg/deployment/context_impl.go | 2 +- pkg/deployment/deployment_inspector.go | 7 ++++ .../reconcile/action_upgrade_member.go | 12 ++++-- .../reconcile/plan_builder_rotate_upgrade.go | 2 +- pkg/deployment/reconcile/plan_builder_tls.go | 2 +- pkg/deployment/resources/pod_inspector.go | 1 + 8 files changed, 22 insertions(+), 44 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index b6ea97536..bbce8b9da 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ bin logs vendor/ .idea/ -deps/ \ No newline at end of file +deps/ +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4982515a3..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "git.ignoreLimitWarning": true, - "fileHeaderComment.parameter":{ - "*":{ - "commentprefix": "//", - "company": "ArangoDB GmbH, Cologne, Germany", - "author": "Ewout Prangsma" - } - }, - "fileHeaderComment.template":{ - "*":[ - "${commentprefix} ", - "${commentprefix} DISCLAIMER", - "${commentprefix} ", - "${commentprefix} Copyright ${year} ArangoDB GmbH, Cologne, Germany", - "${commentprefix} ", - "${commentprefix} Licensed under the Apache License, Version 2.0 (the \"License\");", - "${commentprefix} you may not use this file except in compliance with the License.", - "${commentprefix} You may obtain a copy of the License at", - "${commentprefix} ", - "${commentprefix} http://www.apache.org/licenses/LICENSE-2.0", - "${commentprefix} ", - "${commentprefix} Unless required by applicable law or agreed to in writing, software", - "${commentprefix} distributed under the License is distributed on an \"AS IS\" BASIS,", - "${commentprefix} WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", - "${commentprefix} See the License for the specific language governing permissions and", - "${commentprefix} limitations under the License.", - "${commentprefix} ", - "${commentprefix} Copyright holder is ArangoDB GmbH, Cologne, Germany", - "${commentprefix} ", - "${commentprefix} Author ${author}", - "${commentprefix} ", - "" - ] - }, - "go.gopath": "${workspaceRoot}/.gobuild" -} diff --git a/pkg/deployment/context_impl.go b/pkg/deployment/context_impl.go index f1cf0279e..2c5b677a9 100644 --- a/pkg/deployment/context_impl.go +++ b/pkg/deployment/context_impl.go @@ -176,7 +176,7 @@ func (d *Deployment) UpdateMember(member api.MemberStatus) error { return maskAny(err) } if err := d.UpdateStatus(status, lastVersion); err != nil { - log.Debug().Err(err).Msg("Updating CR status failed") + d.deps.Log.Debug().Err(err).Msg("Updating CR status failed") return maskAny(err) } return nil diff --git a/pkg/deployment/deployment_inspector.go b/pkg/deployment/deployment_inspector.go index baeac6d83..6bd2c2420 100644 --- a/pkg/deployment/deployment_inspector.go +++ b/pkg/deployment/deployment_inspector.go @@ -154,6 +154,13 @@ func (d *Deployment) inspectDeploymentWithError(ctx context.Context, lastInterva } } + // Cleanup terminated pods on the beginning of loop + if x, err := d.resources.CleanupTerminatedPods(cachedStatus); err != nil { + return minInspectionInterval, errors.Wrapf(err, "Pod cleanup failed") + } else { + nextInterval = nextInterval.ReduceTo(x) + } + if err := d.resources.EnsureSecrets(d.deps.Log, cachedStatus); err != nil { return minInspectionInterval, errors.Wrapf(err, "Secret creation failed") } diff --git a/pkg/deployment/reconcile/action_upgrade_member.go b/pkg/deployment/reconcile/action_upgrade_member.go index d8aa2fd59..47f566f31 100644 --- a/pkg/deployment/reconcile/action_upgrade_member.go +++ b/pkg/deployment/reconcile/action_upgrade_member.go @@ -112,11 +112,17 @@ func (a *actionUpgradeMember) CheckProgress(ctx context.Context) (bool, bool, er log = log.With(). Str("pod-name", m.PodName). Bool("is-upgrading", isUpgrading).Logger() - if !m.Conditions.IsTrue(api.ConditionTypeReady) { - // Pod is not yet terminated + + act := actionWaitForMemberUp{ + actionImpl: a.actionImpl, + } + + if ok, _, err := act.CheckProgress(ctx); err != nil { + return false, false, maskAny(err) + } else if !ok { return false, false, nil } - // Pod is now gone, update the member status + // Pod is now upgraded, update the member status m.Phase = api.MemberPhaseCreated m.RecentTerminations = nil // Since we're upgrading, we do not care about old terminations. m.CleanoutJobID = "" diff --git a/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go b/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go index 10fd5d352..cbef59dc0 100644 --- a/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go +++ b/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go @@ -248,7 +248,7 @@ func podNeedsUpgrading(log zerolog.Logger, status api.MemberStatus, spec api.Dep ToLicense: specLicense, UpgradeNeeded: true, UpgradeAllowed: true, - AutoUpgradeNeeded: false, + AutoUpgradeNeeded: true, } } diff --git a/pkg/deployment/reconcile/plan_builder_tls.go b/pkg/deployment/reconcile/plan_builder_tls.go index 7c6cc62c3..dd1f643cb 100644 --- a/pkg/deployment/reconcile/plan_builder_tls.go +++ b/pkg/deployment/reconcile/plan_builder_tls.go @@ -217,7 +217,7 @@ func createCARenewalPlan(ctx context.Context, } if !k8sutil.IsOwner(apiObject.AsOwner(), caSecret) { - log.Warn().Str("secret", spec.TLS.GetCASecretName()).Msg("CA Secret is not owned by Operator, we wont do anything") + log.Debug().Str("secret", spec.TLS.GetCASecretName()).Msg("CA Secret is not owned by Operator, we wont do anything") return nil } diff --git a/pkg/deployment/resources/pod_inspector.go b/pkg/deployment/resources/pod_inspector.go index 05c2d6e70..b6a34fb78 100644 --- a/pkg/deployment/resources/pod_inspector.go +++ b/pkg/deployment/resources/pod_inspector.go @@ -217,6 +217,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspector.Insp return maskAny(err) } } + fallthrough default: log.Debug().Str("pod-name", podName).Msg("Pod is gone") m.Phase = api.MemberPhaseNone // This is trigger a recreate of the pod.