Skip to content

Commit

Permalink
add dockerEnabled option (#191)
Browse files Browse the repository at this point in the history
Add dockerEnabled option for users who does not need docker and want not to run privileged container.
if `dockerEnabled == false`, dind container not run, and there are no privileged container.

Do the same as closed #96
  • Loading branch information
Warashi authored Nov 16, 2020
1 parent 1fd752f commit 4371de9
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/v1alpha1/runner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type RunnerSpec struct {
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// +optional
DockerdWithinRunnerContainer *bool `json:"dockerdWithinRunnerContainer,omitempty"`
// +optional
DockerEnabled *bool `json:"dockerEnabled,omitempty"`
}

// ValidateRepository validates repository field.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/actions.summerwind.dev_runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down
3 changes: 2 additions & 1 deletion controllers/runner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
var (
privileged bool = true
dockerdInRunner bool = runner.Spec.DockerdWithinRunnerContainer != nil && *runner.Spec.DockerdWithinRunnerContainer
dockerEnabled bool = runner.Spec.DockerEnabled == nil || *runner.Spec.DockerEnabled
)

runnerImage := runner.Spec.Image
Expand Down Expand Up @@ -373,7 +374,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
},
}

if !dockerdInRunner {
if !dockerdInRunner && dockerEnabled {
pod.Spec.Volumes = []corev1.Volume{
{
Name: "work",
Expand Down

0 comments on commit 4371de9

Please sign in to comment.