buildkite / agent-stack-k8s

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

Configurable job/pod name #166

Open calvinbui opened 1 year ago

calvinbui commented 1 year ago

All job and pod names are configured to be buildkite-%s

https://github.com/buildkite/agent-stack-k8s/blob/676327839cb9f5bab6d4c1838fe0cd44d18333ac/internal/controller/config/config.go#L37)

https://github.com/buildkite/agent-stack-k8s/blob/676327839cb9f5bab6d4c1838fe0cd44d18333ac/internal/controller/scheduler/scheduler.go#L459

We have multiple environments, so it'll be easier to identify where jobs are run if this value was configurable.

image

triarius commented 1 year ago

Hi @calvinbui, thanks for using agent-stack-k8s! This is certainly something we could implement, but there are a few choices for what to put there.

Some that I can think of are:

It also should be noted that knowing where the jobs are run is a few clicks away in the job's timeline tab. There you can find a link to the agent, who's tags will make it clear it was run on Kubernetes (and some of the option for the choice above). But I completely agree that having it in the place in your screenshot is a lot more user-friendly.

Let me know what you think.

calvinbui commented 1 year ago

Hi @calvinbui, thanks for using agent-stack-k8s! This is certainly something we could implement, but there are a few choices for what to put there.

Some that I can think of are:

  • The helm release name (agent-stack-k8s in the examples we give)
  • The k8s namespace (buildkite in the examples we give)
  • Some new config value in the agent-stack-k8s config, exposed in the helm chart (not as big a fan of this, by I could be convinced)
  • the step label or key normalised in some way
  • the hostname of the node that the pod ran on

It also should be noted that knowing where the jobs are run is a few clicks away in the job's timeline tab. There you can find a link to the agent, who's tags will make it clear it was run on Kubernetes (and some of the option for the choice above). But I completely agree that having it in the place in your screenshot is a lot more user-friendly.

Let me know what you think.

the easiest is probably respecting the BUILDKITE_AGENT_NAME env var. I've tried adding that onto the podSpec but wasn't being used.

agates4 commented 1 year ago

Looks like these two lines of code need to be updated with the actual agent name: