Skip to content

Commit

Permalink
[stable/spinnaker] Move default profile settings from values to the t…
Browse files Browse the repository at this point in the history
…emplate (helm#13918)

* [stable/spinnaker] Move default profile settings from values to the template

Add support of passing actual blocks (aka `map[string]interface{}`) to `halyard.additionalProfileConfigMaps.data`,
which allows to override any of the default field as blocks are deeply merged.

These changes also keep the full backward compatibility with the old way passing data to `halyard.additionalProfileConfigMaps.data`.
Users can still pass the string values there and they will be applied only if `halyard.additionalProfileConfigMaps.create` is set to `true`.

Also, `halyard.additionalProfileConfigMaps.create` has been removed from the default values
because now this ConfigMap will always be created.

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

* [stable/spinnaker] Disable S3 versioning if Minio is enabled

Minio doesn't support versioning, so we should disable it on the Front50 side in this case.
https://www.spinnaker.io/setup/install/storage/minio/#editing-your-storage-settings

Otherwise, "pull-charts-e2e" tests will always fail because of Front50 errors related to
the versioning on S3-like storage backend.

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

* [stable/spinnaker] Bump chart version

Signed-off-by: Mikhail Zholobov <legal90@gmail.com>
  • Loading branch information
legal90 authored and eyenx committed May 28, 2019
1 parent 02a0e71 commit ba9b1e9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 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.8.2
version: 1.9.0
appVersion: 1.12.5
home: http://spinnaker.io/
sources:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
{{ if .Values.halyard.additionalProfileConfigMaps.create -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "spinnaker.fullname" . }}-additional-profile-config-maps
labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}
{{/*
Render profiles for each service by merging predefined defaults with values passed by
.Values.halyard.additionalProfileConfigMaps.data
*/}}
{{- $profiles := dict "gate-local.yml" "" -}}

{{- /* Defaults: Disable S3 versioning on Front50 if Minio storage is used */}}
{{- /* https://www.spinnaker.io/setup/install/storage/minio/#editing-your-storage-settings */}}
{{- if .Values.minio.enabled -}}
{{- $_ := set $profiles "front50-local.yml" (dict "spinnaker" (dict "s3" (dict "versioning" false))) -}}
{{- end -}}

{{- /* Defaults: Add special settings for gate if GCE or ALB ingress is used */}}
{{- /* https://github.com/spinnaker/spinnaker/issues/1630#issuecomment-467359999 */}}
{{- if index $.Values.ingress "annotations" -}}
{{- if eq (index $.Values.ingress.annotations "kubernetes.io/ingress.class" | default "") "gce" "alb" }}
{{- $tomcatProxySettings := dict -}}
{{- $_ := set $tomcatProxySettings "protocolHeader" "X-Forwarded-Proto" -}}
{{- $_ := set $tomcatProxySettings "remoteIpHeader" "X-Forwarded-For" -}}
{{- $_ := set $tomcatProxySettings "internalProxies" ".*" -}}
{{- $_ := set $tomcatProxySettings "httpsServerPort" "X-Forwarded-Port" -}}
{{- $_ := set $profiles "gate-local.yml" (dict "server" (dict "tomcat" $tomcatProxySettings)) -}}
{{- end -}}
{{- end -}}

{{- /* Merge dictionaries with passed values */}}
{{- $customProfilesEnabled := .Values.halyard.additionalProfileConfigMaps.create | default true -}}
{{- if and $customProfilesEnabled .Values.halyard.additionalProfileConfigMaps.data -}}
{{- $_ := mergeOverwrite $profiles .Values.halyard.additionalProfileConfigMaps.data -}}
{{- end -}}

{{- /* Convert the content of profiles to string unless it's already a string */}}
{{- range $filename, $content := $profiles -}}
{{- if not (typeIs "string" $content) -}}
{{- $_ := set $profiles $filename ($content | toYaml) -}}
{{- end -}}
{{- end -}}

data:
{{- if and .Values.halyard.additionalProfileConfigMaps.create .Values.halyard.additionalProfileConfigMaps.data }}
{{- range $index, $content := .Values.halyard.additionalProfileConfigMaps.data }}
{{ $index }}: |-
{{ $content | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{ $profiles | toYaml | indent 2 }}
2 changes: 0 additions & 2 deletions stable/spinnaker/templates/configmap/halyard-init-script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ data:
mkdir -p /tmp/spinnaker/.hal/default/service-settings
cp /tmp/service-settings/* /tmp/spinnaker/.hal/default/service-settings/
{{- if .Values.halyard.additionalProfileConfigMaps.create }}
rm -rf /tmp/spinnaker/.hal/default/profiles
mkdir -p /tmp/spinnaker/.hal/default/profiles
cp /tmp/additionalProfileConfigMaps/* /tmp/spinnaker/.hal/default/profiles/
{{- end }}
{{- if hasKey .Values.halyard "additionalInitScript" }}
# additionalInitScript
Expand Down
4 changes: 0 additions & 4 deletions stable/spinnaker/templates/statefulsets/halyard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ spec:
mountPath: /tmp/service-settings
- name: halyard-home
mountPath: /tmp/spinnaker
{{- if .Values.halyard.additionalProfileConfigMaps.create }}
- name: additional-profile-config-maps
mountPath: /tmp/additionalProfileConfigMaps
{{- end }}
- name: halyard-initscript
mountPath: /tmp/initscript
volumes:
Expand Down Expand Up @@ -89,11 +87,9 @@ spec:
configMap:
name: {{ template "spinnaker.fullname" . }}-additional-config-maps
{{- end }}
{{- if .Values.halyard.additionalProfileConfigMaps.create }}
- name: additional-profile-config-maps
configMap:
name: {{ template "spinnaker.fullname" . }}-additional-profile-config-maps
{{- end }}
- name: halyard-config
emptyDir: {}
- name: service-settings
Expand Down
28 changes: 14 additions & 14 deletions stable/spinnaker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ halyard:
additionalConfigMaps:
create: false
data: {}

additionalProfileConfigMaps:
create: false
data:
## if you're running spinnaker behind a reverse proxy such as a GCE ingress
## you may need the following profile settings for the gate profile.
## see https://github.com/spinnaker/spinnaker/issues/1630
## otherwise its harmless and will likely become default behavior in the future
## According to the linked github issue.
gate-local.yml: |-
server:
tomcat:
protocolHeader: X-Forwarded-Proto
remoteIpHeader: X-Forwarded-For
internalProxies: .*
httpsServerPort: X-Forwarded-Port
data: {}
## if you're running spinnaker behind a reverse proxy such as a GCE ingress
## you may need the following profile settings for the gate profile.
## see https://github.com/spinnaker/spinnaker/issues/1630
## otherwise its harmless and will likely become default behavior in the future
## According to the linked github issue.
# gate-local.yml:
# server:
# tomcat:
# protocolHeader: X-Forwarded-Proto
# remoteIpHeader: X-Forwarded-For
# internalProxies: .*
# httpsServerPort: X-Forwarded-Port

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

0 comments on commit ba9b1e9

Please sign in to comment.