Skip to content

Commit f72a052

Browse files
authored
[Feature] [Platform] Fix ImagePullSecrets Merge (#2001)
1 parent a92d8aa commit f72a052

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- (Bugfix) (Platform) Fix LM CLI Option
66
- (Bugfix) (Platform) Fix topology for Gateways
77
- (Feature) (Platform) Dump CLI switch to Services
8+
- (Feature) (Platform) Fix ImagePullSecrets Merge
89

910
## [1.3.2](https://github.com/arangodb/kube-arangodb/tree/1.3.2) (2025-11-20)
1011
- (Bugfix) (Platform) Increase memory limit for Inventory

pkg/apis/scheduler/v1beta1/pod/resources/image.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2024-2025 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.
@@ -59,11 +59,19 @@ func (i *Image) With(other *Image) *Image {
5959
return nil
6060
}
6161

62-
if other == nil {
63-
return i.DeepCopy()
62+
if i == nil || other == nil {
63+
if i != nil {
64+
return i.DeepCopy()
65+
}
66+
67+
return other.DeepCopy()
6468
}
6569

66-
return other.DeepCopy()
70+
z := i.DeepCopy()
71+
72+
z.ImagePullSecrets = append(z.ImagePullSecrets, other.ImagePullSecrets...)
73+
74+
return z
6775
}
6876

6977
func (i *Image) Validate() error {

pkg/apis/scheduler/v1beta1/pod/resources/image_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2024-2025 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.
@@ -85,4 +85,23 @@ func Test_Image(t *testing.T) {
8585
require.Equal(t, "secret", pod.Spec.ImagePullSecrets[0].Name)
8686
})
8787
})
88+
t.Run("With Merge", func(t *testing.T) {
89+
applyImage(t, &core.PodTemplateSpec{}, &Image{
90+
ImagePullSecrets: []string{
91+
"secret",
92+
},
93+
}, &Image{
94+
ImagePullSecrets: []string{
95+
"secret2",
96+
},
97+
}, &Image{
98+
ImagePullSecrets: []string{
99+
"secret",
100+
},
101+
})(func(t *testing.T, pod *core.PodTemplateSpec) {
102+
require.Len(t, pod.Spec.ImagePullSecrets, 2)
103+
require.Equal(t, "secret", pod.Spec.ImagePullSecrets[0].Name)
104+
require.Equal(t, "secret2", pod.Spec.ImagePullSecrets[1].Name)
105+
})
106+
})
88107
}

0 commit comments

Comments
 (0)