add dockerEnabled option (#191)

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
This commit is contained in:
Shinnosuke Sawada 2020-11-16 09:41:12 +09:00 committed by GitHub
parent 1fd752fca2
commit 4371de9733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 1 deletions

View File

@ -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.

View File

@ -530,6 +530,11 @@ func (in *RunnerSpec) DeepCopyInto(out *RunnerSpec) {
*out = new(bool)
**out = **in
}
if in.DockerEnabled != nil {
in, out := &in.DockerEnabled, &out.DockerEnabled
*out = new(bool)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerSpec.

View File

@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -393,6 +393,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -400,6 +400,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -393,6 +393,8 @@ spec:
- name
type: object
type: array
dockerEnabled:
type: boolean
dockerdContainerResources:
description: ResourceRequirements describes the compute resource requirements.
properties:

View File

@ -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
@ -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",