Skip to content

Commit

Permalink
[Bugfix] Image ID fix (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored May 22, 2023
1 parent 7a80635 commit cf98e1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- (Feature) ArangoBackup create retries and MaxIterations limit
- (Feature) Add Reason in OOM Metric
- (Feature) PersistentVolume Inspector
- (Bugfix) Discover Arango image during ID phase

## [1.2.27](https://github.com/arangodb/kube-arangodb/tree/1.2.27) (2023-04-27)
- (Feature) Add InSync Cache
Expand Down
15 changes: 7 additions & 8 deletions pkg/util/k8sutil/images.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -25,6 +25,7 @@ import (

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand All @@ -51,14 +52,12 @@ func GetArangoDBImageIDFromPod(pod *core.Pod) (string, error) {
return "", errors.New("empty list of ContainerStatuses")
}

rawImageID := pod.Status.ContainerStatuses[0].ImageID
if len(pod.Status.ContainerStatuses) > 1 {
for _, containerStatus := range pod.Status.ContainerStatuses {
if strings.Contains(containerStatus.ImageID, "arango") {
rawImageID = containerStatus.ImageID
}
for _, cs := range pod.Status.ContainerStatuses {
if cs.Name == shared.ServerContainerName {
return ConvertImageID2Image(cs.ImageID), nil
}
}

return ConvertImageID2Image(rawImageID), nil
// If Server container is not found use first container
return ConvertImageID2Image(pod.Status.ContainerStatuses[0].ImageID), nil
}

0 comments on commit cf98e1a

Please sign in to comment.