-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a common chart, included global images options and global labels
Signed-off-by: realanna <anna.reale@dynatrace.com>
- Loading branch information
Showing
67 changed files
with
452 additions
and
346 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 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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,18 @@ | ||
apiVersion: v2 | ||
name: common | ||
description: A Helm chart containing common templates for Keptn | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: library | ||
|
||
# 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: 0.1.0 |
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,69 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "common.name" -}} | ||
{{- default .context.Chart.Name .context.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. | ||
*/}} | ||
{{- define "common.fullname" -}} | ||
{{- if .context.Values.fullnameOverride }} | ||
{{- .context.Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .context.Chart.Name .context.Values.nameOverride }} | ||
{{- if contains $name .context.Release.Name }} | ||
{{- .context.Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "common.chart" -}} | ||
{{- printf "%s-%s" (kebabcase .context.Chart.Name) .context.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
|
||
{{- define "common.labels.standard" -}} | ||
{{- $default := fromYaml (include "common.labels" (dict "context" .context) ) -}} | ||
{{ template "common.tplvalues.merge" (dict "values" (list .context.Values.global.commonLabels $default) "context" .context ) }} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "common.labels" -}} | ||
helm.sh/chart: {{ include "common.chart" (dict "context" .context) }} | ||
{{ include "common.selectorLabels" (dict "context" .context) }} | ||
{{- if .context.Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .context.Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .context.Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "common.selectorLabels" -}} | ||
app.kubernetes.io/name: {{kebabcase (include "common.name" (dict "context" .context) ) }} | ||
app.kubernetes.io/instance: {{ .context.Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "common.serviceAccountName" -}} | ||
{{- if .context.Values.serviceAccount.create }} | ||
{{- default (include "common.fullname" (dict "context" .context )) .context.Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .context.Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{{/* | ||
Return the proper image name | ||
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" .Values.global ) }} | ||
*/}} | ||
{{- define "common.images.image" -}} | ||
{{- $registryName := .imageRoot.registry -}} | ||
{{- $repositoryName := .imageRoot.repository -}} | ||
{{- $separator := ":" -}} | ||
{{- $termination := .imageRoot.tag | toString -}} | ||
{{- if .global }} | ||
{{- if .global.imageRegistry }} | ||
{{- $registryName = .global.imageRegistry -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- if .imageRoot.digest }} | ||
{{- $separator = "@" -}} | ||
{{- $termination = .imageRoot.digest | toString -}} | ||
{{- end -}} | ||
{{- if $registryName }} | ||
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}} | ||
{{- else -}} | ||
{{- printf "%s%s%s" $repositoryName $separator $termination -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper Docker Image Registry Secret Names evaluating values as templates | ||
{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} | ||
*/}} | ||
{{- define "common.images.renderPullSecrets" -}} | ||
{{- $pullSecrets := list }} | ||
{{- $context := .context }} | ||
|
||
{{- if $context.Values.global }} | ||
{{- range $context.Values.global.imagePullSecrets -}} | ||
{{- if kindIs "map" . -}} | ||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}} | ||
{{- else -}} | ||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- range .images -}} | ||
{{- range .pullSecrets -}} | ||
{{- if kindIs "map" . -}} | ||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}} | ||
{{- else -}} | ||
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- if (not (empty $pullSecrets)) }} | ||
imagePullSecrets: | ||
{{- range $pullSecrets | uniq }} | ||
- name: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Return the proper Docker Image Registry Secret Names | ||
*/}} | ||
{{- define "common.images.imagePullSecrets" -}} | ||
{{- include "common.images.renderPullSecrets" (dict "images" list "global" .Values.global) | default list| toJson | indent 1 -}} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* | ||
Renders a value that contains template perhaps with scope if the scope is present. | ||
Usage: | ||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} | ||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} | ||
*/}} | ||
{{- define "common.tplvalues.render" -}} | ||
{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} | ||
{{- if contains "{{" (toJson .value) }} | ||
{{- if .scope }} | ||
{{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} | ||
{{- else }} | ||
{{- tpl $value .context }} | ||
{{- end }} | ||
{{- else }} | ||
{{- $value }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Merge a list of values that contains template after rendering them. | ||
Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge | ||
Usage: | ||
{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} | ||
*/}} | ||
{{- define "common.tplvalues.merge" -}} | ||
{{- $dst := dict -}} | ||
{{- range .values -}} | ||
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} | ||
{{- end -}} | ||
{{ $dst | toYaml }} | ||
{{- 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 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
Oops, something went wrong.