diff --git a/api/v1alpha1/runner_types.go b/api/v1alpha1/runner_types.go index 614d734d20..9a1d06aa0e 100644 --- a/api/v1alpha1/runner_types.go +++ b/api/v1alpha1/runner_types.go @@ -92,6 +92,8 @@ type RunnerSpec struct { DockerdWithinRunnerContainer *bool `json:"dockerdWithinRunnerContainer,omitempty"` // +optional DockerEnabled *bool `json:"dockerEnabled,omitempty"` + // +optional + DockerMTU *int64 `json:"dockerMTU,omitempty"` } // ValidateRepository validates repository field. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index f5752e7358..b2c5ea5277 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -689,6 +689,11 @@ func (in *RunnerSpec) DeepCopyInto(out *RunnerSpec) { *out = new(bool) **out = **in } + if in.DockerMTU != nil { + in, out := &in.DockerMTU, &out.DockerMTU + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunnerSpec. diff --git a/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml b/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml index 17c05808ab..9c2cba0901 100644 --- a/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml +++ b/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml @@ -433,6 +433,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml b/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml index c23bfe9a4d..d3580df546 100644 --- a/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml +++ b/charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml @@ -433,6 +433,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml b/charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml index 4e5e947be2..090f1af69f 100644 --- a/charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml +++ b/charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml @@ -398,6 +398,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml b/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml index 17c05808ab..9c2cba0901 100644 --- a/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml +++ b/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml @@ -433,6 +433,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml b/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml index c23bfe9a4d..d3580df546 100644 --- a/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml +++ b/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml @@ -433,6 +433,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/config/crd/bases/actions.summerwind.dev_runners.yaml b/config/crd/bases/actions.summerwind.dev_runners.yaml index 4e5e947be2..090f1af69f 100644 --- a/config/crd/bases/actions.summerwind.dev_runners.yaml +++ b/config/crd/bases/actions.summerwind.dev_runners.yaml @@ -398,6 +398,9 @@ spec: type: array dockerEnabled: type: boolean + dockerMTU: + format: int64 + type: integer dockerdContainerResources: description: ResourceRequirements describes the compute resource requirements. properties: diff --git a/controllers/runner_controller.go b/controllers/runner_controller.go index 99056212f3..02c512bfbf 100644 --- a/controllers/runner_controller.go +++ b/controllers/runner_controller.go @@ -530,6 +530,15 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) { }, } + if mtu := runner.Spec.DockerMTU; mtu != nil && dockerdInRunner { + pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, []corev1.EnvVar{ + { + Name: "MTU", + Value: fmt.Sprintf("%d", *runner.Spec.DockerMTU), + }, + }...) + } + if !dockerdInRunner && dockerEnabled { runnerVolumeName := "runner" runnerVolumeMountPath := "/runner" @@ -612,6 +621,15 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) { Resources: runner.Spec.DockerdContainerResources, }) + if mtu := runner.Spec.DockerMTU; mtu != nil { + pod.Spec.Containers[1].Env = append(pod.Spec.Containers[1].Env, []corev1.EnvVar{ + { + Name: "DOCKERD_ROOTLESS_ROOTLESSKIT_MTU", + Value: fmt.Sprintf("%d", *runner.Spec.DockerMTU), + }, + }...) + } + } if len(runner.Spec.Containers) != 0 { diff --git a/runner/startup.sh b/runner/startup.sh index fc4cf51bcd..0fcb1eaa0b 100644 --- a/runner/startup.sh +++ b/runner/startup.sh @@ -33,5 +33,9 @@ for process in "${processes[@]}"; do fi done +if [ -n "${MTU}" ]; then + ifconfig docker0 mtu ${MTU} up +fi + # Wait processes to be running entrypoint.sh