Skip to content

Commit 2bd60bb

Browse files
authored
Don't use Chart.Name in templates (#179)
Don't use Chart.Name, because when consumed as sub-chart and renamed in Chart.yaml using alias, it may cause some k8s resources failed to render because of various k8s constraints applied to naming Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
1 parent e0c0255 commit 2bd60bb

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

examples/metric-pull/setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ kubectl apply -f ${DIR}/podinfo-so.yaml
3838
(hey -n 7000 -z 180s http://localhost:8181/delay/2 &> /dev/null)&
3939

4040
# watch deployments being scaled
41-
echo "hey is running in background, now deployments should be autoscaled.."
41+
echo -e "\nhey is running in background, now deployments should be autoscaled.."
4242
sleep 5
4343
watch -c "kubectl get deploy/podinfo"
44+
45+
echo -e "\nDon't forget to delete the cluster:\n - k3d cluster delete metric-pull\n\n🚀"

examples/metric-push/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ kubectl apply -f ${DIR}/sos.yaml
6666
echo "now deployments should be autoscaled.."
6767
sleep 5
6868
watch -c "kubectl get deploy/recommendation deploy/product-catalog hpa/keda-hpa-recommendationservice hpa/keda-hpa-productcatalogservice"
69+
70+
echo -e "\nDon't forget to delete the cluster:\n - k3d cluster delete metric-push\n\n🚀"

helmchart/otel-add-on/templates/_helpers.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Expand the name of the chart.
33
*/}}
44
{{- define "otel-add-on.name" -}}
5-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
5+
{{- default "otel-add-on" .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

88
{{/*
@@ -14,7 +14,7 @@ If release name contains chart name it will be used as a full name.
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
17-
{{- $name := default .Chart.Name .Values.nameOverride }}
17+
{{- $name := default "otel-add-on" .Values.nameOverride }}
1818
{{- if contains $name .Release.Name }}
1919
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
2020
{{- else }}
@@ -27,7 +27,7 @@ If release name contains chart name it will be used as a full name.
2727
Create chart name and version as used by the chart label.
2828
*/}}
2929
{{- define "otel-add-on.chart" -}}
30-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
30+
{{- printf "%s-%s" "otel-add-on" .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

3333
{{/*

helmchart/otel-add-on/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
securityContext:
3636
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3737
containers:
38-
- name: {{ .Chart.Name }}
38+
- name: main
3939
securityContext:
4040
{{- toYaml .Values.securityContext | nindent 12 }}
4141
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"

0 commit comments

Comments
 (0)