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:
parent
1fd752fca2
commit
4371de9733
|
|
@ -84,6 +84,8 @@ type RunnerSpec struct {
|
||||||
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
|
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
|
||||||
// +optional
|
// +optional
|
||||||
DockerdWithinRunnerContainer *bool `json:"dockerdWithinRunnerContainer,omitempty"`
|
DockerdWithinRunnerContainer *bool `json:"dockerdWithinRunnerContainer,omitempty"`
|
||||||
|
// +optional
|
||||||
|
DockerEnabled *bool `json:"dockerEnabled,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateRepository validates repository field.
|
// ValidateRepository validates repository field.
|
||||||
|
|
|
||||||
|
|
@ -530,6 +530,11 @@ func (in *RunnerSpec) DeepCopyInto(out *RunnerSpec) {
|
||||||
*out = new(bool)
|
*out = new(bool)
|
||||||
**out = **in
|
**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.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerSpec.
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -393,6 +393,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -393,6 +393,8 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
dockerEnabled:
|
||||||
|
type: boolean
|
||||||
dockerdContainerResources:
|
dockerdContainerResources:
|
||||||
description: ResourceRequirements describes the compute resource requirements.
|
description: ResourceRequirements describes the compute resource requirements.
|
||||||
properties:
|
properties:
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
|
||||||
var (
|
var (
|
||||||
privileged bool = true
|
privileged bool = true
|
||||||
dockerdInRunner bool = runner.Spec.DockerdWithinRunnerContainer != nil && *runner.Spec.DockerdWithinRunnerContainer
|
dockerdInRunner bool = runner.Spec.DockerdWithinRunnerContainer != nil && *runner.Spec.DockerdWithinRunnerContainer
|
||||||
|
dockerEnabled bool = runner.Spec.DockerEnabled == nil || *runner.Spec.DockerEnabled
|
||||||
)
|
)
|
||||||
|
|
||||||
runnerImage := runner.Spec.Image
|
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{
|
pod.Spec.Volumes = []corev1.Volume{
|
||||||
{
|
{
|
||||||
Name: "work",
|
Name: "work",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue