Skip to content

Commit fea9ac7

Browse files
grokspawnci-robot
authored andcommitted
🐛 add catalog-operator control-plane-specific tolerations to unpack jobs (#3606)
* add catalog-operator control-plane-specific tolerations to unpack jobs Signed-off-by: grokspawn <[email protected]> * refactored common in test Signed-off-by: grokspawn <[email protected]> --------- Signed-off-by: grokspawn <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: 57e6b8c8b381be1d6432718905b9825495836470
1 parent 53e474a commit fea9ac7

File tree

3 files changed

+86
-132
lines changed

3 files changed

+86
-132
lines changed

staging/operator-lifecycle-manager/pkg/controller/bundle/bundle_unpacker.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
234234
"kubernetes.io/os": "linux",
235235
},
236236
Tolerations: []corev1.Toleration{
237+
// arch-specific tolerations
237238
{
238239
Key: "kubernetes.io/arch",
239240
Value: "amd64",
@@ -254,6 +255,24 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
254255
Value: "s390x",
255256
Operator: "Equal",
256257
},
258+
// control-plane-specific tolerations
259+
{
260+
Key: "node-role.kubernetes.io/master",
261+
Operator: "Exists",
262+
Effect: "NoSchedule",
263+
},
264+
{
265+
Key: "node.kubernetes.io/unreachable",
266+
Operator: "Exists",
267+
Effect: "NoExecute",
268+
TolerationSeconds: ptr.To[int64](120),
269+
},
270+
{
271+
Key: "node.kubernetes.io/not-ready",
272+
Operator: "Exists",
273+
Effect: "NoExecute",
274+
TolerationSeconds: ptr.To[int64](120),
275+
},
257276
},
258277
},
259278
},

staging/operator-lifecycle-manager/pkg/controller/bundle/bundle_unpacker_test.go

Lines changed: 48 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,48 @@ func TestConfigMapUnpacker(t *testing.T) {
5959
customAnnotationDuration := 2 * time.Minute
6060
customAnnotationTimeoutSeconds := int64(customAnnotationDuration.Seconds())
6161

62+
podTolerations := []corev1.Toleration{
63+
// arch-specific tolerations
64+
{
65+
Key: "kubernetes.io/arch",
66+
Value: "amd64",
67+
Operator: "Equal",
68+
},
69+
{
70+
Key: "kubernetes.io/arch",
71+
Value: "arm64",
72+
Operator: "Equal",
73+
},
74+
{
75+
Key: "kubernetes.io/arch",
76+
Value: "ppc64le",
77+
Operator: "Equal",
78+
},
79+
{
80+
Key: "kubernetes.io/arch",
81+
Value: "s390x",
82+
Operator: "Equal",
83+
},
84+
// control-plane-specific tolerations
85+
{
86+
Key: "node-role.kubernetes.io/master",
87+
Operator: "Exists",
88+
Effect: "NoSchedule",
89+
},
90+
{
91+
Key: "node.kubernetes.io/unreachable",
92+
Operator: "Exists",
93+
Effect: "NoExecute",
94+
TolerationSeconds: ptr.To[int64](120),
95+
},
96+
{
97+
Key: "node.kubernetes.io/not-ready",
98+
Operator: "Exists",
99+
Effect: "NoExecute",
100+
TolerationSeconds: ptr.To[int64](120),
101+
},
102+
}
103+
62104
type fields struct {
63105
objs []runtime.Object
64106
crs []runtime.Object
@@ -345,28 +387,7 @@ func TestConfigMapUnpacker(t *testing.T) {
345387
NodeSelector: map[string]string{
346388
"kubernetes.io/os": "linux",
347389
},
348-
Tolerations: []corev1.Toleration{
349-
{
350-
Key: "kubernetes.io/arch",
351-
Value: "amd64",
352-
Operator: "Equal",
353-
},
354-
{
355-
Key: "kubernetes.io/arch",
356-
Value: "arm64",
357-
Operator: "Equal",
358-
},
359-
{
360-
Key: "kubernetes.io/arch",
361-
Value: "ppc64le",
362-
Operator: "Equal",
363-
},
364-
{
365-
Key: "kubernetes.io/arch",
366-
Value: "s390x",
367-
Operator: "Equal",
368-
},
369-
},
390+
Tolerations: podTolerations,
370391
},
371392
},
372393
},
@@ -582,28 +603,7 @@ func TestConfigMapUnpacker(t *testing.T) {
582603
NodeSelector: map[string]string{
583604
"kubernetes.io/os": "linux",
584605
},
585-
Tolerations: []corev1.Toleration{
586-
{
587-
Key: "kubernetes.io/arch",
588-
Value: "amd64",
589-
Operator: "Equal",
590-
},
591-
{
592-
Key: "kubernetes.io/arch",
593-
Value: "arm64",
594-
Operator: "Equal",
595-
},
596-
{
597-
Key: "kubernetes.io/arch",
598-
Value: "ppc64le",
599-
Operator: "Equal",
600-
},
601-
{
602-
Key: "kubernetes.io/arch",
603-
Value: "s390x",
604-
Operator: "Equal",
605-
},
606-
},
606+
Tolerations: podTolerations,
607607
},
608608
},
609609
},
@@ -859,28 +859,7 @@ func TestConfigMapUnpacker(t *testing.T) {
859859
NodeSelector: map[string]string{
860860
"kubernetes.io/os": "linux",
861861
},
862-
Tolerations: []corev1.Toleration{
863-
{
864-
Key: "kubernetes.io/arch",
865-
Value: "amd64",
866-
Operator: "Equal",
867-
},
868-
{
869-
Key: "kubernetes.io/arch",
870-
Value: "arm64",
871-
Operator: "Equal",
872-
},
873-
{
874-
Key: "kubernetes.io/arch",
875-
Value: "ppc64le",
876-
Operator: "Equal",
877-
},
878-
{
879-
Key: "kubernetes.io/arch",
880-
Value: "s390x",
881-
Operator: "Equal",
882-
},
883-
},
862+
Tolerations: podTolerations,
884863
},
885864
},
886865
},
@@ -1131,28 +1110,7 @@ func TestConfigMapUnpacker(t *testing.T) {
11311110
NodeSelector: map[string]string{
11321111
"kubernetes.io/os": "linux",
11331112
},
1134-
Tolerations: []corev1.Toleration{
1135-
{
1136-
Key: "kubernetes.io/arch",
1137-
Value: "amd64",
1138-
Operator: "Equal",
1139-
},
1140-
{
1141-
Key: "kubernetes.io/arch",
1142-
Value: "arm64",
1143-
Operator: "Equal",
1144-
},
1145-
{
1146-
Key: "kubernetes.io/arch",
1147-
Value: "ppc64le",
1148-
Operator: "Equal",
1149-
},
1150-
{
1151-
Key: "kubernetes.io/arch",
1152-
Value: "s390x",
1153-
Operator: "Equal",
1154-
},
1155-
},
1113+
Tolerations: podTolerations,
11561114
},
11571115
},
11581116
},
@@ -1373,28 +1331,7 @@ func TestConfigMapUnpacker(t *testing.T) {
13731331
NodeSelector: map[string]string{
13741332
"kubernetes.io/os": "linux",
13751333
},
1376-
Tolerations: []corev1.Toleration{
1377-
{
1378-
Key: "kubernetes.io/arch",
1379-
Value: "amd64",
1380-
Operator: "Equal",
1381-
},
1382-
{
1383-
Key: "kubernetes.io/arch",
1384-
Value: "arm64",
1385-
Operator: "Equal",
1386-
},
1387-
{
1388-
Key: "kubernetes.io/arch",
1389-
Value: "ppc64le",
1390-
Operator: "Equal",
1391-
},
1392-
{
1393-
Key: "kubernetes.io/arch",
1394-
Value: "s390x",
1395-
Operator: "Equal",
1396-
},
1397-
},
1334+
Tolerations: podTolerations,
13981335
},
13991336
},
14001337
},
@@ -1628,28 +1565,7 @@ func TestConfigMapUnpacker(t *testing.T) {
16281565
NodeSelector: map[string]string{
16291566
"kubernetes.io/os": "linux",
16301567
},
1631-
Tolerations: []corev1.Toleration{
1632-
{
1633-
Key: "kubernetes.io/arch",
1634-
Value: "amd64",
1635-
Operator: "Equal",
1636-
},
1637-
{
1638-
Key: "kubernetes.io/arch",
1639-
Value: "arm64",
1640-
Operator: "Equal",
1641-
},
1642-
{
1643-
Key: "kubernetes.io/arch",
1644-
Value: "ppc64le",
1645-
Operator: "Equal",
1646-
},
1647-
{
1648-
Key: "kubernetes.io/arch",
1649-
Value: "s390x",
1650-
Operator: "Equal",
1651-
},
1652-
},
1568+
Tolerations: podTolerations,
16531569
},
16541570
},
16551571
},

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/bundle/bundle_unpacker.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)