diff --git a/pkg/install/deployment.go b/pkg/install/deployment.go index 4ee8e52383..41fe474d0c 100644 --- a/pkg/install/deployment.go +++ b/pkg/install/deployment.go @@ -331,6 +331,12 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment Spec: corev1.PodSpec{ RestartPolicy: corev1.RestartPolicyAlways, ServiceAccountName: c.serviceAccountName, + NodeSelector: map[string]string{ + "kubernetes.io/os": "linux", + }, + OS: &corev1.PodOS{ + Name: "linux", + }, Containers: []corev1.Container{ { Name: "velero", diff --git a/pkg/install/deployment_test.go b/pkg/install/deployment_test.go index 48e02fb5e1..4f91563d18 100644 --- a/pkg/install/deployment_test.go +++ b/pkg/install/deployment_test.go @@ -99,4 +99,7 @@ func TestDeployment(t *testing.T) { deploy = Deployment("velero", WithRepoMaintenanceJobConfigMap("test-repo-maintenance-config")) assert.Len(t, deploy.Spec.Template.Spec.Containers[0].Args, 2) assert.Equal(t, "--repo-maintenance-job-configmap=test-repo-maintenance-config", deploy.Spec.Template.Spec.Containers[0].Args[1]) + + assert.Equal(t, "linux", deploy.Spec.Template.Spec.NodeSelector["kubernetes.io/os"]) + assert.Equal(t, "linux", string(deploy.Spec.Template.Spec.OS.Name)) }