Skip to content

Commit

Permalink
update comment and move logic to template
Browse files Browse the repository at this point in the history
  • Loading branch information
chunter0 committed Apr 22, 2024
1 parent 55ee9bd commit c0fd7da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions charts/opentelemetry-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,15 @@ The capitalization is important for StatefulSet.
{{- print "StatefulSet" -}}
{{- end -}}
{{- end }}

{{/*
Get ConfigMap name if existingName is defined, otherwise use default name for generated config.
*/}}
{{- define "opentelemetry-collector.configName" -}}
{{- if .Values.configMap.existingName -}}
{{ .Values.configMap.existingName }}
{{- else }}
{{- printf "%s%s" (include "opentelemetry-collector.fullname" .) (.configmapSuffix) }}
{{- end -}}
{{- end }}

2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ volumes:
{{- if or .Values.configMap.create .Values.configMap.existingName }}
- name: {{ include "opentelemetry-collector.lowercase_chartname" . }}-configmap
configMap:
name: {{ .Values.configMap.existingName | default (printf "%s%s" (include "opentelemetry-collector.fullname" .) (.configmapSuffix)) }}
name: {{ include "opentelemetry-collector.configName" . }}
items:
- key: relay
path: relay.yaml
Expand Down
3 changes: 2 additions & 1 deletion charts/opentelemetry-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ presets:
configMap:
# Specifies whether a configMap should be created (true by default)
create: true
# Specifies an existing configMap to be mounted to the pod
# Specifies an existing configMap to be mounted to the pod which should contain an item with key 'relay' and path 'relay.yaml'.

Check failure on line 83 in charts/opentelemetry-collector/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

83:130 [trailing-spaces] trailing spaces
# These settings will be used to properly configure the collector.

Check failure on line 84 in charts/opentelemetry-collector/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

84:69 [trailing-spaces] trailing spaces
existingName: ""

# Base collector configuration.
Expand Down

0 comments on commit c0fd7da

Please sign in to comment.