Skip to content

RunnerDeployment 'initContainers' getting overwritten #772

@donovanmuller

Description

@donovanmuller

Describe the bug

I am trying to use initContainers in a RunnerDeployment spec. However, once applied, it appears that the initContainers value are overwritten to an empty value, which then results in this error:

ERROR    controller-runtime.controller    Reconciler error    {"controller": "runner-controller", "request": "actions-runners/test-rf9v5-kjks5", "error": "Runner.actions.summerwind.dev \"test-rf9v5-kjks5\" is invalid: spec.initContainers.name: Required value"}

Checks

  • My actions-runner-controller version (v0.19.0) does support the feature
  • I'm using an unreleased version of the controller I built from HEAD of the default branch

To Reproduce
Steps to reproduce the behavior:

  1. Apply the following RunnerDeployment spec:
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:    
  name: test
  namespace: actions-runners
spec:
  replicas: 1
  template:
    metadata: {}
    spec:
      dockerdWithinRunnerContainer: true
      ephemeral: true
      image: summerwind/actions-runner-dind:v2.278.0-ubuntu-20.04
      initContainers:
      - command:
          - sh
          - '-c'
          - 'echo "I just want to run..."'
        image: 'alpine'
        name: test
      labels:
      - test
      repository: test/test
  1. Describe the created RunnerDeployment and notice that the initContainers now have a single empty value:
$ k get runnerdeployments.actions.summerwind.dev test -n actions-runners -oyaml
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"actions.summerwind.dev/v1alpha1","kind":"RunnerDeployment","metadata":{"annotations":{},"name":"test","namespace":"actions-runners"},"spec":{"replicas":1,"template":{"metadata":{},"spec":{"dockerdWithinRunnerContainer":true,"ephemeral":true,"image":"summerwind/actions-runner-dind:v2.278.0-ubuntu-20.04","initContainers":[{"command":["sh","-c","echo \"I just want to run...\""],"image":"alpine","name":"test"}],"labels":["test"],"repository":"test/test"}}}}
  creationTimestamp: "2021-08-28T09:40:18Z"
  generation: 1
  name: test
  namespace: actions-runners
  resourceVersion: "7900359"
  uid: a39eed1b-8edc-4da5-b6e8-9577586ba0cc
spec:
  replicas: 1
  selector: null
  template:
    metadata: {}
    spec:
      dockerdContainerResources: {}
      dockerdWithinRunnerContainer: true
      ephemeral: true
      image: summerwind/actions-runner-dind:v2.278.0-ubuntu-20.04
      initContainers:
      - {}
      labels:
      - test
      repository: test/test
      resources: {}

Expected behavior

The initContainers are applied to the runner Pod as defined in the RunnerDeployment

Environment (please complete the following information):

  • Controller Version v0.19.0
  • Deployment Method Helm
  • Helm Chart Version 0.12.7

Additional context

Just to try rule out the possibility that other controllers/mutating webhooks were mutating the RunnerDeployment I tested with a simple Pod spec with initContainers but that worked as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions