From b153f54fc6e3abaefb1fa4baf0bc2c314afc506c Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:46:30 +0200 Subject: [PATCH] [Bugfix] Fix missing Pod Status case in the RuntimeContainerImageUpdateAction (#1454) --- CHANGELOG.md | 1 + .../action_runtime_container_image_update.go | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9711bff4..6fc60f2a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - (Documentation) Move documentation from ArangoDB into this repo, update and improve structure - (Documentation) Update ArangoDeployment CR auto-generated docs - (Documentation) Update ArangoBackup and ArangoBackupPolicy CR auto-generated docs +- (Bugfix) Fix missing Pod Status case in the RuntimeContainerImageUpdateAction ## [1.2.34](https://github.com/arangodb/kube-arangodb/tree/1.2.34) (2023-10-16) - (Bugfix) Fix make manifests-crd-file command diff --git a/pkg/deployment/reconcile/action_runtime_container_image_update.go b/pkg/deployment/reconcile/action_runtime_container_image_update.go index 8a32b423d..7381dd602 100644 --- a/pkg/deployment/reconcile/action_runtime_container_image_update.go +++ b/pkg/deployment/reconcile/action_runtime_container_image_update.go @@ -1,7 +1,7 @@ // // DISCLAIMER // -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany +// Copyright 2016-2023 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. @@ -227,13 +227,8 @@ func (a actionRuntimeContainerImageUpdate) Start(ctx context.Context) (bool, err return true, nil } - spec := member.Spec.Template.PodSpec - status := member.Status.Template.PodSpec - for id := range pod.Spec.Containers { - if pod.Spec.Containers[id].Name != spec.Spec.Containers[id].Name || - pod.Spec.Containers[id].Name != status.Spec.Containers[id].Name || - pod.Spec.Containers[id].Name != name { + if pod.Spec.Containers[id].Name != name { continue } @@ -249,10 +244,14 @@ func (a actionRuntimeContainerImageUpdate) Start(ctx context.Context) (bool, err return false, nil } + a.log.Info("Image is UpToDate") + return true, nil } - return true, nil + a.log.Str("container", name).Str("pod", pod.GetName()).Warn("Container not found") + + return false, errors.Newf("Container %s not found in Pod %s", name, pod.GetName()) } func (a actionRuntimeContainerImageUpdate) CheckProgress(ctx context.Context) (bool, bool, error) {