[stable/spinnaker] use spinnaker service settings to set service type (#11102)

* [stable/spinnaker] use spinnaker service settings to set service type

Instead of using a helm hook to patch the services, we can use service
settings to tell spinnaker to set the service type.

This sets up a service-settings configmap and puts the existing
service-settings bits into that and has a switch for setting two things
needed for ingress, type to NodePort and also the `useExecHealthcheck`
to false to ensure GCP ingress works.

Signed-off-by: Paul Czarkowski <username.taken@gmail.com>

* bump version

Signed-off-by: Paul Czarkowski <username.taken@gmail.com>
This commit is contained in:
Paul Czarkowski
2019-02-11 07:00:16 -08:00
committed by Kubernetes Prow Robot
parent 5bad465540
commit 92c8dd63ba
5 changed files with 44 additions and 56 deletions
+1 -1
View File
@@ -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.6.1
version: 1.7.0
appVersion: 1.11.6
home: http://spinnaker.io/
sources:
@@ -11,24 +11,14 @@ data:
# Override Halyard daemon's listen address
cp /opt/halyard/config/* /tmp/config
printf 'server.address: 0.0.0.0\n' > /tmp/config/halyard-local.yml
# Use Redis deployed via the dependent Helm chart
rm -rf /tmp/spinnaker/.hal/default/service-settings
mkdir -p /tmp/spinnaker/.hal/default/service-settings
{{- if .Values.redis.enabled }}
printf 'overrideBaseUrl: redis://:{{ .Values.redis.password }}@{{ .Release.Name }}-redis-master:6379\nskipLifeCycleManagement: true\n' > /tmp/spinnaker/.hal/default/service-settings/redis.yml
{{- else }}
{{ if .Values.redis.external.password }}
printf 'overrideBaseUrl: redis://:{{ .Values.redis.external.password }}@{{ .Values.redis.external.host }}:{{ .Values.redis.external.port }}\nskipLifeCycleManagement: true\n' > /tmp/spinnaker/.hal/default/service-settings/redis.yml
{{- else }}
printf 'overrideBaseUrl: redis://{{ .Values.redis.external.host }}:{{ .Values.redis.external.port }}\nskipLifeCycleManagement: true\n' > /tmp/spinnaker/.hal/default/service-settings/redis.yml
{{- end }}
{{- end }}
# Route the /gate path of Deck to Gate
printf 'env:\n API_HOST: http://spin-gate.{{ .Release.Namespace }}:8084\n' > /tmp/spinnaker/.hal/default/service-settings/deck.yml
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 && \
rm -rf /tmp/spinnaker/.hal/default/profiles
mkdir -p /tmp/spinnaker/.hal/default/profiles
cp /tmp/additionalProfileConfigMaps/* /tmp/spinnaker/.hal/default/profiles/
{{- end }}
@@ -0,0 +1,33 @@
apiVersion: v1
kind: ConfigMap
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: |-
env:
API_HOST: http://spin-gate.{{ .Release.Namespace }}:8084
kubernetes:
{{- if .Values.ingress.enabled }}
useExecHealthCheck: false
serviceType: NodePort
{{- end }}
deck.yml: |-
kubernetes:
{{- if .Values.ingress.enabled }}
useExecHealthCheck: false
serviceType: NodePort
{{- end }}
@@ -1,40 +0,0 @@
{{- if .Values.ingress.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-expose-nodeports"
labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}
component: halyard
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook-weight": "5"
"helm.sh/hook-delete-policy": "before-hook-creation"
spec:
template:
metadata:
labels:
{{ include "spinnaker.standard-labels" . | indent 8 }}
component: halyard
spec:
{{- if .Values.serviceAccount.halyardName }}
serviceAccountName: {{ .Values.serviceAccount.halyardName }}
{{- else }}
serviceAccountName: {{ template "spinnaker.fullname" . }}-halyard
{{- end }}
restartPolicy: OnFailure
containers:
- name: patch-services
image: {{ .Values.halyard.image.repository }}:{{ .Values.halyard.image.tag }}
command:
- bash
- -c
- |
PATCH='{"spec": {"type":"NodePort"}}'
if [ "$(kubectl get service --namespace {{ .Release.Namespace }} spin-deck -o=jsonpath='{.spec.type}')" = "ClusterIP" ]; then
kubectl patch service --namespace {{ .Release.Namespace }} spin-deck --patch "$PATCH"
fi
if [ "$(kubectl get service --namespace {{ .Release.Namespace }} spin-gate -o=jsonpath='{.spec.type}')" = "ClusterIP" ]; then
kubectl patch service --namespace {{ .Release.Namespace }} spin-gate --patch "$PATCH"
fi
{{- end }}
@@ -34,6 +34,8 @@ spec:
volumeMounts:
- name: halyard-config
mountPath: /tmp/config
- name: service-settings
mountPath: /tmp/service-settings
- name: halyard-home
mountPath: /tmp/spinnaker
{{- if .Values.halyard.additionalProfileConfigMaps.create }}
@@ -90,6 +92,9 @@ spec:
{{- end }}
- name: halyard-config
emptyDir: {}
- name: service-settings
configMap:
name: {{ template "spinnaker.fullname" . }}-service-settings
- name: halyard-initscript
configMap:
name: {{ template "spinnaker.fullname" . }}-halyard-init-script