Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #457 from morganchristiansson/logstash-fullnameove…
Browse files Browse the repository at this point in the history
…rride

[logstash] Add fullnameOverride setting
  • Loading branch information
jmlrt authored Jan 31, 2020
2 parents 7917345 + 147d4d4 commit 8e10ead
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions logstash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ helm install --name logstash elastic/logstash --set imageTag=7.5.2
| `updateStrategy` | The [updateStrategy](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets) for the statefulset. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` |
| `volumeClaimTemplate` | Configuration for the [volumeClaimTemplate for statefulsets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-storage). You will want to adjust the storage (default `30Gi`) and the `storageClassName` if you are using a different storage class | `accessModes: [ "ReadWriteOnce" ]`<br>`resources.requests.storage: 1Gi` |
| `rbac` | Configuration for creating a role, role binding and service account as part of this helm chart with `create: true`. Also can be used to reference an external service account with `serviceAccountName: "externalServiceAccountName"`. | `create: false`<br>`serviceAccountName: ""` |
| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
## Try it out
Expand Down
4 changes: 4 additions & 0 deletions logstash/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ 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 "logstash.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for statefulset.
Expand Down
10 changes: 10 additions & 0 deletions logstash/tests/logstash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,13 @@ def test_adding_a_service():
assert len(s['spec']['ports']) == 1
assert s['spec']['ports'][0] == {
'name': 'beats', 'port': 5044, 'protocol': 'TCP', 'targetPort': 5044}

def test_setting_fullnameOverride():
config = '''
fullnameOverride: 'logstash-custom'
'''
r = helm_template(config)

custom_name = 'logstash-custom'
assert custom_name in r['statefulset']
assert r['statefulset'][custom_name]['spec']['template']['spec']['containers'][0]['name'] == 'logstash'

0 comments on commit 8e10ead

Please sign in to comment.