Skip to content

Commit

Permalink
More configurability of fullname template variable
Browse files Browse the repository at this point in the history
Provide more ways to tailor the `fullname` template variable that is
used for naming resources.
It's a way to independently set it from the `name` template variable
that is used in the `app` label and selector, which is useful when you
want to have multiple Buildkite agents with different configuration
deployed into the same Kubernetes namespace, but without having awkward
resource names.

See #99 for more details.
  • Loading branch information
jim-barber-he committed Mar 20, 2023
1 parent 5ffc4be commit c214925
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Buildkite Agent Chart
name: agent
version: 0.6.1
version: 0.6.2
appVersion: 3.25.0
icon: https://buildkite.com/_next/static/assets/assets/images/brand-assets/buildkite-logo-portrait-on-light-61fc0230.png
keywords:
Expand Down
2 changes: 2 additions & 0 deletions stable/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Parameter | Description | Default
`dind.resources` | Pod resource requests & limits for dind sidecar (if enabled) | `{}`
`dind.volumeMounts` | Extra volumeMounts configuration | `nil`
`terminationGracePeriodSeconds` | Duration in seconds the pod needs to terminate gracefully | `30`
`nameOverride` | Provide a name to override the default `$name` template variable | `nil`
`fullnameOverride` | Provide a name to substitute for the full names of resources | `nil`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Expand Down
8 changes: 8 additions & 0 deletions stable/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Set the Deployment API version based on the version of Kubernetes the chart is being deployed into.
Expand Down

0 comments on commit c214925

Please sign in to comment.