-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve conflicts in helm templates/values (#504)
Fixes: aws-controllers-k8s/community#2014 Prior to this patch, we observed some weird conflicts when installing multiple ACK helm charts (as sub charts), e.g `ack-chart`, where the last controller installation would override values/templates from the previous ones. This issue stemmed from the asumption that helm "template" names are unique across installations, which was a miss from the ACK team. This patch addresses the conflict by prefixing all the helm template variables with a `ack-$SERVICE-controller` string. This solution comes with the cost of adding complexity to the already complex helm "templates templates generator"... However the least we could do is to leverage Go template "Funcs" to reduce the complexity of writing those templates. For example instead of writing something like `{{ "{{ \"define \"ack- }}" }}{{ .ServicePackageName }}{{ "-controller.rbac-rules\"" }}`, we could "simply" write a `{{ DefineTemplate "rbac-rules" }}` Signed-off-by: Amine Hilaly <[email protected]> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
12 changed files
with
310 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{ "{{/* The name of the application this chart installs */}}" }} | ||
{{ DefineTemplate "app.name" }} | ||
{{ "{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix \"-\" -}}" }} | ||
{{ "{{- 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)." }} | ||
{{ "If release name contains chart name it will be used as a full name." }} | ||
{{ "*/}}" }} | ||
{{ DefineTemplate "app.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 -}}" }} | ||
|
||
{{ "{{/* The name and version as used by the chart label */}}" }} | ||
{{ DefineTemplate "chart.name-version" }} | ||
{{ "{{- printf \"%s-%s\" .Chart.Name .Chart.Version | replace \"+\" \"_\" | trunc 63 | trimSuffix \"-\" -}}" }} | ||
{{ "{{- end -}}" }} | ||
|
||
{{ "{{/* The name of the service account to use */}}" }} | ||
{{ DefineTemplate "service-account.name" }} | ||
{{ "{{ default \"default\" .Values.serviceAccount.name }}" }} | ||
{{ "{{- end -}}" }} | ||
|
||
{{ DefineTemplate "watch-namespace" }} | ||
{{ "{{- if eq .Values.installScope \"namespace\" -}}" }} | ||
{{ "{{ .Values.watchNamespace | default .Release.Namespace }}" }} | ||
{{ "{{- end -}}" }} | ||
{{ "{{- end -}}" }} | ||
|
||
{{ "{{/* The mount path for the shared credentials file */}}" }} | ||
{{ DefineTemplate "aws.credentials.secret_mount_path" }} | ||
{{ "{{- \"/var/run/secrets/aws\" -}}" }} | ||
{{ "{{- end -}}" }} | ||
|
||
{{ "{{/* The path the shared credentials file is mounted */}}" }} | ||
{{ DefineTemplate "aws.credentials.path" }} | ||
{{ "{{- printf \"%s/%s\" (include \"aws.credentials.secret_mount_path\" .) .Values.aws.credentials.secretKey -}}" }} | ||
{{ "{{- end -}}" }} | ||
|
||
{{ "{{/* The rules a of ClusterRole or Role */}}" }} | ||
{{ DefineTemplate "rbac-rules" }} | ||
SEDREPLACERULES | ||
{{ "{{- end }}" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.