Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[stable/spinnaker] Add a value for customizing service settings (#13049)
Browse files Browse the repository at this point in the history
* [stable/spinnaker] Bump chart version

Signed-off-by: Mikhail Zholobov <legal90@gmail.com>

* [stable/spinnaker] Add a value for customizing service settings

Using the newly added `additionalServiceSettings` value it's possible to override service-specific
parameters. That could be used to override some component versions or to add custom labels to pods.
Read more: https://www.spinnaker.io/reference/halyard/custom/#custom-service-settings

Signed-off-by: Mikhail Zholobov <legal90@gmail.com>
  • Loading branch information
legal90 authored and k8s-ci-robot committed May 20, 2019
1 parent 29d635c commit edc8a28
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 27 deletions.
2 changes: 1 addition & 1 deletion stable/spinnaker/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Open source, multi-cloud continuous delivery platform for releasing software changes with high velocity and confidence.
name: spinnaker
version: 1.9.2
version: 1.10.0
appVersion: 1.12.5
home: http://spinnaker.io/
sources:
Expand Down
13 changes: 13 additions & 0 deletions stable/spinnaker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ Create comma separated list of omitted namespaces in Kubernetes
{{- define "omittedNameSpaces" -}}
{{- join "," .Values.kubeConfig.omittedNameSpaces }}
{{- end -}}

{{/*
Redis base URL for Spinnaker
*/}}
{{- define "spinnaker.redisBaseURL" -}}
{{- if .Values.redis.enabled }}
{{- printf "redis://:%s@%s-redis-master:6379" .Values.redis.password .Release.Name -}}
{{- else if .Values.redis.external.password }}
{{- printf "redis://:%s@%s:%s" .Values.redis.external.password .Values.redis.external.host (.Values.redis.external.port | toString) -}}
{{- else }}
{{- printf "redis://%s:%s" .Values.redis.external.host (.Values.redis.external.port | toString) -}}
{{- end }}
{{- end }}
67 changes: 41 additions & 26 deletions stable/spinnaker/templates/configmap/service-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,45 @@ metadata:
name: {{ template "spinnaker.fullname" . }}-service-settings
labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}
data:
redis.yml: |-

{{- if .Values.redis.enabled }}
overrideBaseUrl: redis://:{{ .Values.redis.password }}@{{ .Release.Name }}-redis-master:6379
{{- else }}
{{ if .Values.redis.external.password }}
overrideBaseUrl: redis://:{{ .Values.redis.external.password }}@{{ .Values.redis.external.host }}:{{ .Values.redis.external.port }}
{{- else }}
overrideBaseUrl: redis://{{ .Values.redis.external.host }}:{{ .Values.redis.external.port }}
{{- end }}
{{- end }}
skipLifeCycleManagement: true
gate.yml: |-
kubernetes:
{{- if .Values.ingress.enabled }}
useExecHealthCheck: false
serviceType: NodePort
{{- end }}
deck.yml: |-
env:
API_HOST: http://spin-gate:8084
kubernetes:
{{- if .Values.ingress.enabled }}
useExecHealthCheck: false
serviceType: NodePort
{{- end }}
{{/*
Render settings for each service by merging predefined defaults with values passed by
.Values.halyard.additionalServiceSettings
*/}}
{{- $settings := dict -}}

{{- /* Defaults: redis service */}}
{{- $redisDefaults := dict -}}
{{- $_ := set $redisDefaults "skipLifeCycleManagement" true -}}
{{- $_ := set $redisDefaults "overrideBaseUrl" (include "spinnaker.redisBaseURL" $) -}}
{{- $_ := set $settings "redis.yml" $redisDefaults -}}

{{/* Defaults: gate service */}}
{{- if .Values.ingress.enabled -}}
{{- $gateDefaults := dict -}}
{{- $_ := set $gateDefaults "kubernetes" (dict "useExecHealthCheck" false "serviceType" "NodePort") -}}
{{- $_ := set $settings "gate.yml" $gateDefaults -}}
{{- end -}}

{{/* Defaults: deck service */}}
{{- $deckDefaults := dict -}}
{{- $_ := set $deckDefaults "API_HOST" "http://spin-gate:8084" -}}
{{- if .Values.ingress.enabled -}}
{{- $_ := set $deckDefaults "kubernetes" (dict "useExecHealthCheck" false "serviceType" "NodePort") -}}
{{- end -}}
{{- $_ := set $settings "deck.yml" $deckDefaults -}}

{{- /* Merge dictionaries with passed values */}}
{{- if .Values.halyard.additionalServiceSettings -}}
{{- $_ := mergeOverwrite $settings .Values.halyard.additionalServiceSettings -}}
{{- end -}}

{{- /* Convert the content of settings key to YAML string */}}
{{- range $filename, $content := $settings -}}
{{- if not (typeIs "string" $content) -}}
{{- $_ := set $settings $filename ($content | toYaml) -}}
{{- end -}}
{{- end -}}

data:
{{ $settings | toYaml | indent 2 }}
14 changes: 14 additions & 0 deletions stable/spinnaker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ halyard:
# internalProxies: .*
# httpsServerPort: X-Forwarded-Port

## Define custom settings for Spinnaker services. Read more for details:
## https://www.spinnaker.io/reference/halyard/custom/#custom-service-settings
## You can use it to add annotations for pods, override the image, etc.
additionalServiceSettings: {}
# deck.yml:
# artifactId: gcr.io/spinnaker-marketplace/deck:2.9.0-20190412012808
# kubernetes:
# podAnnotations:
# iam.amazonaws.com/role: <role_arn>
# clouddriver.yml:
# kubernetes:
# podAnnotations:
# iam.amazonaws.com/role: <role_arn>

## Uncomment if you want to add extra commands to the init script
## run by the init container before halyard is started.
# additionalInitScript: |-
Expand Down

0 comments on commit edc8a28

Please sign in to comment.