Skip to content

Commit 60c4103

Browse files
dhaiducekopenshift-merge-bot[bot]
authored andcommitted
Set unreachable Toleration in Placement
Without it, ManagedClusters that are unreachable are patched with a Taint and aren't returned by the Placement controller. ref: https://issues.redhat.com/browse/ACM-9871 Signed-off-by: Dale Haiducek <[email protected]>
1 parent 60d90e0 commit 60c4103

20 files changed

+147
-0
lines changed

internal/plugin.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,12 @@ func (p *Plugin) createPlacement(
16521652
},
16531653
},
16541654
},
1655+
"tolerations": []map[string]interface{}{
1656+
{
1657+
"key": "cluster.open-cluster-management.io/unreachable",
1658+
"operator": "Exists",
1659+
},
1660+
},
16551661
},
16561662
}
16571663
}

internal/plugin_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ spec:
170170
- requiredClusterSelector:
171171
labelSelector:
172172
matchExpressions: []
173+
tolerations:
174+
- key: cluster.open-cluster-management.io/unreachable
175+
operator: Exists
173176
---
174177
apiVersion: policy.open-cluster-management.io/v1
175178
kind: PlacementBinding
@@ -771,6 +774,9 @@ spec:
771774
- requiredClusterSelector:
772775
labelSelector:
773776
matchExpressions: []
777+
tolerations:
778+
- key: cluster.open-cluster-management.io/unreachable
779+
operator: Exists
774780
---
775781
apiVersion: cluster.open-cluster-management.io/v1beta1
776782
kind: Placement
@@ -782,6 +788,9 @@ spec:
782788
- requiredClusterSelector:
783789
labelSelector:
784790
matchExpressions: []
791+
tolerations:
792+
- key: cluster.open-cluster-management.io/unreachable
793+
operator: Exists
785794
---
786795
apiVersion: policy.open-cluster-management.io/v1
787796
kind: PlacementBinding
@@ -1746,6 +1755,9 @@ spec:
17461755
- requiredClusterSelector:
17471756
labelSelector:
17481757
matchExpressions: []
1758+
tolerations:
1759+
- key: cluster.open-cluster-management.io/unreachable
1760+
operator: Exists
17491761
`
17501762
expected = strings.TrimPrefix(expected, "\n")
17511763
assertEqual(t, output, expected)
@@ -1788,6 +1800,9 @@ spec:
17881800
- requiredClusterSelector:
17891801
labelSelector:
17901802
matchExpressions: []
1803+
tolerations:
1804+
- key: cluster.open-cluster-management.io/unreachable
1805+
operator: Exists
17911806
`
17921807
expected = strings.TrimPrefix(expected, "\n")
17931808
assertEqual(t, output, expected)
@@ -1885,6 +1900,9 @@ spec:
18851900
operator: In
18861901
values:
18871902
- pacman
1903+
tolerations:
1904+
- key: cluster.open-cluster-management.io/unreachable
1905+
operator: Exists
18881906
`
18891907
expected = strings.TrimPrefix(expected, "\n")
18901908
assertEqual(t, output, expected)
@@ -2029,6 +2047,9 @@ spec:
20292047
- requiredClusterSelector:
20302048
labelSelector:
20312049
matchExpressions: []
2050+
tolerations:
2051+
- key: cluster.open-cluster-management.io/unreachable
2052+
operator: Exists
20322053
`
20332054
p, plrPath := plPathHelper(t, plrYAML, true)
20342055

@@ -2137,6 +2158,9 @@ spec:
21372158
operator: In
21382159
values:
21392160
- pacman
2161+
tolerations:
2162+
- key: cluster.open-cluster-management.io/unreachable
2163+
operator: Exists
21402164
`
21412165
plrYAML = strings.TrimPrefix(plrYAML, "\n")
21422166
p, _ := plPathHelper(t, plrYAML, false)
@@ -2192,6 +2216,9 @@ spec:
21922216
- requiredClusterSelector:
21932217
labelSelector:
21942218
matchExpressions: []
2219+
tolerations:
2220+
- key: cluster.open-cluster-management.io/unreachable
2221+
operator: Exists
21952222
`
21962223
p, plrPath := plPathHelper(t, plrYAML, false)
21972224

@@ -2218,6 +2245,9 @@ spec:
22182245
- requiredClusterSelector:
22192246
labelSelector:
22202247
matchExpressions: []
2248+
tolerations:
2249+
- key: cluster.open-cluster-management.io/unreachable
2250+
operator: Exists
22212251
`
22222252
p, plrPath := plPathHelper(t, plrYAML, false)
22232253

@@ -2245,6 +2275,9 @@ spec:
22452275
- requiredClusterSelector:
22462276
labelSelector:
22472277
matchExpressions: []
2278+
tolerations:
2279+
- key: cluster.open-cluster-management.io/unreachable
2280+
operator: Exists
22482281
`
22492282
p, plrPath := plPathHelper(t, plrYAML, false)
22502283

@@ -2654,6 +2687,9 @@ spec:
26542687
- requiredClusterSelector:
26552688
labelSelector:
26562689
matchExpressions: []
2690+
tolerations:
2691+
- key: cluster.open-cluster-management.io/unreachable
2692+
operator: Exists
26572693
---
26582694
apiVersion: policy.open-cluster-management.io/v1
26592695
kind: PlacementBinding
@@ -2786,6 +2822,9 @@ spec:
27862822
operator: In
27872823
values:
27882824
- my-cluster
2825+
tolerations:
2826+
- key: cluster.open-cluster-management.io/unreachable
2827+
operator: Exists
27892828
---
27902829
apiVersion: policy.open-cluster-management.io/v1
27912830
kind: PlacementBinding
@@ -3816,6 +3855,9 @@ spec:
38163855
labelSelector:
38173856
matchLabels:
38183857
cloud: red hat
3858+
tolerations:
3859+
- key: cluster.open-cluster-management.io/unreachable
3860+
operator: Exists
38193861
`
38203862
expected = strings.TrimPrefix(expected, "\n")
38213863
assertEqual(t, output, expected)
@@ -3866,6 +3908,9 @@ spec:
38663908
values:
38673909
- red hat
38683910
- test
3911+
tolerations:
3912+
- key: cluster.open-cluster-management.io/unreachable
3913+
operator: Exists
38693914
`
38703915
expected = strings.TrimPrefix(expected, "\n")
38713916
assertEqual(t, output, expected)
@@ -3950,6 +3995,9 @@ spec:
39503995
- red hat
39513996
matchLabels:
39523997
cloud: red hat
3998+
tolerations:
3999+
- key: cluster.open-cluster-management.io/unreachable
4000+
operator: Exists
39534001
`
39544002
expected = strings.TrimPrefix(expected, "\n")
39554003
assertEqual(t, output, expected)

internal/testdata/ordering/default-deps-propagated.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ spec:
8585
- requiredClusterSelector:
8686
labelSelector:
8787
matchExpressions: []
88+
tolerations:
89+
- key: cluster.open-cluster-management.io/unreachable
90+
operator: Exists
8891
---
8992
apiVersion: cluster.open-cluster-management.io/v1beta1
9093
kind: Placement
@@ -96,6 +99,9 @@ spec:
9699
- requiredClusterSelector:
97100
labelSelector:
98101
matchExpressions: []
102+
tolerations:
103+
- key: cluster.open-cluster-management.io/unreachable
104+
operator: Exists
99105
---
100106
apiVersion: policy.open-cluster-management.io/v1
101107
kind: PlacementBinding

internal/testdata/ordering/default-extradeps-consolidated.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ spec:
9393
- requiredClusterSelector:
9494
labelSelector:
9595
matchExpressions: []
96+
tolerations:
97+
- key: cluster.open-cluster-management.io/unreachable
98+
operator: Exists
9699
---
97100
apiVersion: cluster.open-cluster-management.io/v1beta1
98101
kind: Placement
@@ -104,6 +107,9 @@ spec:
104107
- requiredClusterSelector:
105108
labelSelector:
106109
matchExpressions: []
110+
tolerations:
111+
- key: cluster.open-cluster-management.io/unreachable
112+
operator: Exists
107113
---
108114
apiVersion: policy.open-cluster-management.io/v1
109115
kind: PlacementBinding

internal/testdata/ordering/default-extradeps-override.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ spec:
108108
- requiredClusterSelector:
109109
labelSelector:
110110
matchExpressions: []
111+
tolerations:
112+
- key: cluster.open-cluster-management.io/unreachable
113+
operator: Exists
111114
---
112115
apiVersion: cluster.open-cluster-management.io/v1beta1
113116
kind: Placement
@@ -119,6 +122,9 @@ spec:
119122
- requiredClusterSelector:
120123
labelSelector:
121124
matchExpressions: []
125+
tolerations:
126+
- key: cluster.open-cluster-management.io/unreachable
127+
operator: Exists
122128
---
123129
apiVersion: policy.open-cluster-management.io/v1
124130
kind: PlacementBinding

internal/testdata/ordering/default-extradeps-propagated.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ spec:
108108
- requiredClusterSelector:
109109
labelSelector:
110110
matchExpressions: []
111+
tolerations:
112+
- key: cluster.open-cluster-management.io/unreachable
113+
operator: Exists
111114
---
112115
apiVersion: cluster.open-cluster-management.io/v1beta1
113116
kind: Placement
@@ -119,6 +122,9 @@ spec:
119122
- requiredClusterSelector:
120123
labelSelector:
121124
matchExpressions: []
125+
tolerations:
126+
- key: cluster.open-cluster-management.io/unreachable
127+
operator: Exists
122128
---
123129
apiVersion: policy.open-cluster-management.io/v1
124130
kind: PlacementBinding

internal/testdata/ordering/dependency-details-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ spec:
4747
- requiredClusterSelector:
4848
labelSelector:
4949
matchExpressions: []
50+
tolerations:
51+
- key: cluster.open-cluster-management.io/unreachable
52+
operator: Exists
5053
---
5154
apiVersion: policy.open-cluster-management.io/v1
5255
kind: PlacementBinding

internal/testdata/ordering/extradeps-overrides.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ spec:
4747
- requiredClusterSelector:
4848
labelSelector:
4949
matchExpressions: []
50+
tolerations:
51+
- key: cluster.open-cluster-management.io/unreachable
52+
operator: Exists
5053
---
5154
apiVersion: policy.open-cluster-management.io/v1
5255
kind: PlacementBinding

internal/testdata/ordering/ignore-pending-manifest-override.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ spec:
9292
- requiredClusterSelector:
9393
labelSelector:
9494
matchExpressions: []
95+
tolerations:
96+
- key: cluster.open-cluster-management.io/unreachable
97+
operator: Exists
9598
---
9699
apiVersion: cluster.open-cluster-management.io/v1beta1
97100
kind: Placement
@@ -103,6 +106,9 @@ spec:
103106
- requiredClusterSelector:
104107
labelSelector:
105108
matchExpressions: []
109+
tolerations:
110+
- key: cluster.open-cluster-management.io/unreachable
111+
operator: Exists
106112
---
107113
apiVersion: policy.open-cluster-management.io/v1
108114
kind: PlacementBinding

internal/testdata/ordering/ignore-pending-policy-consolidated.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ spec:
8282
- requiredClusterSelector:
8383
labelSelector:
8484
matchExpressions: []
85+
tolerations:
86+
- key: cluster.open-cluster-management.io/unreachable
87+
operator: Exists
8588
---
8689
apiVersion: cluster.open-cluster-management.io/v1beta1
8790
kind: Placement
@@ -93,6 +96,9 @@ spec:
9396
- requiredClusterSelector:
9497
labelSelector:
9598
matchExpressions: []
99+
tolerations:
100+
- key: cluster.open-cluster-management.io/unreachable
101+
operator: Exists
96102
---
97103
apiVersion: policy.open-cluster-management.io/v1
98104
kind: PlacementBinding

0 commit comments

Comments
 (0)