Skip to content

Commit cf98e1a

Browse files
authored
[Bugfix] Image ID fix (#1310)
1 parent 7a80635 commit cf98e1a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- (Feature) ArangoBackup create retries and MaxIterations limit
55
- (Feature) Add Reason in OOM Metric
66
- (Feature) PersistentVolume Inspector
7+
- (Bugfix) Discover Arango image during ID phase
78

89
## [1.2.27](https://github.com/arangodb/kube-arangodb/tree/1.2.27) (2023-04-27)
910
- (Feature) Add InSync Cache

pkg/util/k8sutil/images.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

Comments
 (0)