buildkite / agent-stack-k8s

Spin up an autoscaling stack of Buildkite Agents on Kubernetes
MIT License
79 stars 30 forks source link

Make imagePullPolicy configurable #257

Closed calvinbui closed 6 months ago

calvinbui commented 8 months ago

It is currently set to Always which slows down our builds when the image is already present on the host.

For example, it already pulled the image for copy-agent init container, but then has to pull it again for the checkout and agent containers.

This also includes the job/step container.

https://github.com/buildkite/agent-stack-k8s/blob/3bf9caa15f922ca9e2ede89da272414c145796d8/internal/controller/scheduler/scheduler.go#L243

https://github.com/buildkite/agent-stack-k8s/blob/3bf9caa15f922ca9e2ede89da272414c145796d8/internal/controller/scheduler/scheduler.go#L315

triarius commented 7 months ago

Thanks for raising this @calvinbui. We think it's a good idea to be able to do this. We've added this to our roadmap, but we're unable to commit to a timeline at this stage. In the meantime, a PR that plumbs this from the helm chart into the controller's config into these lines of code would be welcome.

42atomys commented 7 months ago

Hi, the pull request https://github.com/buildkite/agent-stack-k8s/pull/262 will make ti configurable easier 💯

calvinbui commented 6 months ago

works so much better and faster now, that I think IfNotPresent should be the default.

my change:

"pod-spec-patch":
  "containers":
  - "imagePullPolicy": "IfNotPresent"
    "name": "agent"
  - "imagePullPolicy": "IfNotPresent"
    "name": "checkout"
  - "imagePullPolicy": "IfNotPresent"
    "name": "container-0"
  "initContainers":
  - "imagePullPolicy": "IfNotPresent"
    "name": "copy-agent"