buildkite / agent-stack-k8s

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

Fix custom namespace deploy errors in RBAC RoleBinding #330

Closed artem-zinnatullin closed 2 months ago

artem-zinnatullin commented 2 months ago

Deploying v0.11.0 to custom namespace results in an error:

W0516 23:52:47.169746       1 reflector.go:539] k8s.io/client-go@v0.29.3/tools/cache/reflector.go:229: 
failed to list *v1.Job: jobs.batch is forbidden: User "system:serviceaccount:my-namespace:my-deploy-name-v1-controller" cannot list resource "jobs" in API group "batch" in the namespace "my-namespace"

The RoleBinding in RBAC should be bound to a namespace.

To be honest I'm baffled at how is deploy was supposed to work for users with custom namespace, does everyone deploy to a default namespace or am I missing something? 🤔

artem-zinnatullin commented 2 months ago

Thanks for landing this 👍

DrJosh9000 commented 2 months ago

Hey, thanks for spending the time investigating it and raising a PR! Makes it easy 😄