Skip to content
Open
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
16 changes: 4 additions & 12 deletions controllers/new_runner_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ func TestNewRunnerPod(t *testing.T) {
},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Privileged: func() *bool { v := false; return &v }(),
},
SecurityContext: &corev1.SecurityContext{},
},
{
Name: "docker",
Expand Down Expand Up @@ -366,9 +364,7 @@ func TestNewRunnerPod(t *testing.T) {
},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Privileged: boolPtr(false),
},
SecurityContext: &corev1.SecurityContext{},
},
},
RestartPolicy: corev1.RestartPolicyNever,
Expand Down Expand Up @@ -690,9 +686,7 @@ func TestNewRunnerPodFromRunnerController(t *testing.T) {
},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Privileged: func() *bool { v := false; return &v }(),
},
SecurityContext: &corev1.SecurityContext{},
},
{
Name: "docker",
Expand Down Expand Up @@ -930,9 +924,7 @@ func TestNewRunnerPodFromRunnerController(t *testing.T) {
},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Privileged: boolPtr(false),
},
SecurityContext: &corev1.SecurityContext{},
},
},
RestartPolicy: corev1.RestartPolicyNever,
Expand Down
10 changes: 4 additions & 6 deletions controllers/runner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,6 @@ func newRunnerPodWithContainerMode(containerMode string, template corev1.Pod, ru
runnerContainerIndex = -1
runnerContainer = &corev1.Container{
Name: containerName,
SecurityContext: &corev1.SecurityContext{
// Runner need to run privileged if it contains DinD
Privileged: &dockerdInRunnerPrivileged,
},
}
}

Expand Down Expand Up @@ -887,8 +883,10 @@ func newRunnerPodWithContainerMode(containerMode string, template corev1.Pod, ru
runnerContainer.SecurityContext = &corev1.SecurityContext{}
}

if runnerContainer.SecurityContext.Privileged == nil {
// Runner need to run privileged if it contains DinD
// Runner need to run privileged if it contains DinD.
// Do not explicitly set SecurityContext.Privileged to false which is default,
// otherwise Windows pods don't get admitted on GKE.
if dockerdInRunnerPrivileged {
runnerContainer.SecurityContext.Privileged = &dockerdInRunnerPrivileged
}

Expand Down