agent-stack-k8s icon indicating copy to clipboard operation
agent-stack-k8s copied to clipboard

Configurable job/pod name

Open calvinbui opened this issue 1 year ago • 3 comments

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

calvinbui avatar May 02 '23 01:05 calvinbui

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.

triarius avatar May 08 '23 12:05 triarius

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.

calvinbui avatar May 08 '23 13:05 calvinbui

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

  • https://github.com/buildkite/agent-stack-k8s/blob/64efe80913ba7877d146535085691939881ea8f2/internal/controller/scheduler/scheduler.go#L246-L248
  • https://github.com/buildkite/agent-stack-k8s/blob/64efe80913ba7877d146535085691939881ea8f2/internal/controller/scheduler/scheduler.go#L302-L303

agates4 avatar Sep 12 '23 13:09 agates4