Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pkg/controller/bundle/bundle_unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
// arch-specific tolerations
{
Key: "kubernetes.io/arch",
Value: "amd64",
Expand All @@ -254,6 +255,24 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
Value: "s390x",
Operator: "Equal",
},
// control-plane-specific tolerations
{
Key: "node-role.kubernetes.io/master",
Operator: "Exists",
Effect: "NoSchedule",
},
{
Key: "node.kubernetes.io/unreachable",
Operator: "Exists",
Effect: "NoExecute",
TolerationSeconds: ptr.To[int64](120),
},
{
Key: "node.kubernetes.io/not-ready",
Operator: "Exists",
Effect: "NoExecute",
TolerationSeconds: ptr.To[int64](120),
},
},
},
},
Expand Down
180 changes: 48 additions & 132 deletions pkg/controller/bundle/bundle_unpacker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,48 @@ func TestConfigMapUnpacker(t *testing.T) {
customAnnotationDuration := 2 * time.Minute
customAnnotationTimeoutSeconds := int64(customAnnotationDuration.Seconds())

podTolerations := []corev1.Toleration{
// arch-specific tolerations
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
// control-plane-specific tolerations
{
Key: "node-role.kubernetes.io/master",
Operator: "Exists",
Effect: "NoSchedule",
},
{
Key: "node.kubernetes.io/unreachable",
Operator: "Exists",
Effect: "NoExecute",
TolerationSeconds: ptr.To[int64](120),
},
{
Key: "node.kubernetes.io/not-ready",
Operator: "Exists",
Effect: "NoExecute",
TolerationSeconds: ptr.To[int64](120),
},
}

type fields struct {
objs []runtime.Object
crs []runtime.Object
Expand Down Expand Up @@ -345,28 +387,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down Expand Up @@ -582,28 +603,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down Expand Up @@ -859,28 +859,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down Expand Up @@ -1131,28 +1110,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down Expand Up @@ -1373,28 +1331,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down Expand Up @@ -1628,28 +1565,7 @@ func TestConfigMapUnpacker(t *testing.T) {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
Tolerations: []corev1.Toleration{
{
Key: "kubernetes.io/arch",
Value: "amd64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "arm64",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "ppc64le",
Operator: "Equal",
},
{
Key: "kubernetes.io/arch",
Value: "s390x",
Operator: "Equal",
},
},
Tolerations: podTolerations,
},
},
},
Expand Down