Skip to content

Commit

Permalink
AppName (#89)
Browse files Browse the repository at this point in the history
* injects APP_NAME

* bump chart
  • Loading branch information
whereismyjetpack authored Nov 4, 2024
1 parent 20b7f27 commit 38f7d9d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion charts/application-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.2.4
version: 4.2.5


maintainers:
- name: Dominic DePasquale
11 changes: 11 additions & 0 deletions charts/application-core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Build the env that gets injected into the deployments
*/}}
{{- define "application-core.env" -}}
- name: APP_NAME
value: {{ .Values.appName | default (printf "%s-%s" .Release.Namespace .Release.Name) }}
{{- if .Values.env }}
{{ .Values.env | toYaml }}
{{- end }}
{{- end }}

{{/*
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).
Expand Down
8 changes: 2 additions & 6 deletions charts/application-core/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ spec:
- {{ . }}
{{- end }}
{{- end }}
{{- if or .Values.env }}
env:
{{- .Values.env | toYaml | nindent 12 }}
{{- end }}
{{- include "application-core.env" . | nindent 12 }}
{{- if or .Values.externalSecret.enabled .Values.configMap.enabled .Values.extraConfigMaps .Values.extraSecrets }}
envFrom:
{{- if .Values.configMap.enabled }}
Expand Down Expand Up @@ -148,10 +146,8 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if or .Values.env }}
env:
{{- .Values.env | toYaml | nindent 12 }}
{{- end }}
{{- include "application-core.env" . | nindent 12 }}
{{- if or .Values.externalSecret.enabled .Values.configMap.enabled .Values.extraConfigMaps .Values.extraSecrets }}
envFrom:
{{- if .Values.configMap.enabled }}
Expand Down
2 changes: 2 additions & 0 deletions charts/application-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ configMap:

command: []

appName: ""

env: []
# - name: FOO
# value: BAR
Expand Down

0 comments on commit 38f7d9d

Please sign in to comment.