11//
22// DISCLAIMER
33//
4- // Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import (
2525
2626 core "k8s.io/api/core/v1"
2727
28+ "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2829 "github.com/arangodb/kube-arangodb/pkg/util/errors"
2930)
3031
@@ -51,14 +52,12 @@ func GetArangoDBImageIDFromPod(pod *core.Pod) (string, error) {
5152 return "" , errors .New ("empty list of ContainerStatuses" )
5253 }
5354
54- rawImageID := pod .Status .ContainerStatuses [0 ].ImageID
55- if len (pod .Status .ContainerStatuses ) > 1 {
56- for _ , containerStatus := range pod .Status .ContainerStatuses {
57- if strings .Contains (containerStatus .ImageID , "arango" ) {
58- rawImageID = containerStatus .ImageID
59- }
55+ for _ , cs := range pod .Status .ContainerStatuses {
56+ if cs .Name == shared .ServerContainerName {
57+ return ConvertImageID2Image (cs .ImageID ), nil
6058 }
6159 }
6260
63- return ConvertImageID2Image (rawImageID ), nil
61+ // If Server container is not found use first container
62+ return ConvertImageID2Image (pod .Status .ContainerStatuses [0 ].ImageID ), nil
6463}
0 commit comments