Skip to content

Commit 70939eb

Browse files
Merge pull request #1132 from Denton24646/fix/operatorhub-catalog-windows-vm-scheduling-bug
Bug 1773661: schedule catalogsource pods to linux nodes only
2 parents d7c729f + a26d2ea commit 70939eb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

pkg/controller/registry/reconciler/reconciler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ func Pod(source *v1alpha1.CatalogSource, name string, image string, labels map[s
133133
Operator: v1.TolerationOpExists,
134134
},
135135
},
136+
NodeSelector: map[string]string{
137+
"beta.kubernetes.io/os": "linux",
138+
},
136139
},
137140
}
138141
return pod
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package reconciler
2+
3+
import (
4+
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
5+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6+
7+
"testing"
8+
)
9+
10+
func TestPodNodeSelector(t *testing.T) {
11+
catsrc := &v1alpha1.CatalogSource{
12+
ObjectMeta: metav1.ObjectMeta{
13+
Name: "test",
14+
Namespace: "testns",
15+
},
16+
}
17+
18+
key := "beta.kubernetes.io/os"
19+
value := "linux"
20+
21+
gotCatSrcPod := Pod(catsrc, "hello", "busybox", map[string]string{}, int32(0), int32(0))
22+
gotCatSrcPodSelector := gotCatSrcPod.Spec.NodeSelector
23+
24+
if gotCatSrcPodSelector[key] != value {
25+
t.Errorf("expected %s value for node selector key %s, received %s value instead", value, key,
26+
gotCatSrcPodSelector[key])
27+
}
28+
}

0 commit comments

Comments
 (0)