From ba68295e3a3402b368117189e68e2d48d6140223 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Thu, 17 Aug 2017 12:50:27 +0100 Subject: [PATCH] Update chart to include redis service - adds stable/redis dependency to chart - updates API Dockerfile to alpine:3.6 for dns resolution support - configures Monocular to fail of Redis connection is not established --- deployment/monocular/.gitignore | 1 + deployment/monocular/requirements.lock | 6 ++++++ deployment/monocular/requirements.yaml | 4 ++++ deployment/monocular/templates/_helpers.tpl | 8 ++++++++ deployment/monocular/templates/api-config.yaml | 5 ++++- deployment/monocular/values.yaml | 2 ++ scripts/repo-sync.sh | 3 ++- src/api/rootfs/Dockerfile | 2 +- src/api/swagger/restapi/configure_monocular.go | 5 ++++- 9 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 deployment/monocular/.gitignore create mode 100644 deployment/monocular/requirements.lock create mode 100644 deployment/monocular/requirements.yaml diff --git a/deployment/monocular/.gitignore b/deployment/monocular/.gitignore new file mode 100644 index 000000000..948259a7b --- /dev/null +++ b/deployment/monocular/.gitignore @@ -0,0 +1 @@ +charts/*.tgz diff --git a/deployment/monocular/requirements.lock b/deployment/monocular/requirements.lock new file mode 100644 index 000000000..b915d4f0b --- /dev/null +++ b/deployment/monocular/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: redis + repository: https://kubernetes-charts.storage.googleapis.com + version: 0.8.1 +digest: sha256:06eaffdfb97b679510a6072b036358e03af85c26afa9bf8eb41b9f21cfd5fca0 +generated: 2017-08-16T18:47:21.379793272+01:00 diff --git a/deployment/monocular/requirements.yaml b/deployment/monocular/requirements.yaml new file mode 100644 index 000000000..c62c15f65 --- /dev/null +++ b/deployment/monocular/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: +- name: redis + version: 0.8.1 + repository: https://kubernetes-charts.storage.googleapis.com diff --git a/deployment/monocular/templates/_helpers.tpl b/deployment/monocular/templates/_helpers.tpl index f0d83d2ed..a971d9b34 100644 --- a/deployment/monocular/templates/_helpers.tpl +++ b/deployment/monocular/templates/_helpers.tpl @@ -14,3 +14,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | 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). +*/}} +{{- define "redis.fullname" -}} +{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deployment/monocular/templates/api-config.yaml b/deployment/monocular/templates/api-config.yaml index c46afbd55..25aa0438a 100644 --- a/deployment/monocular/templates/api-config.yaml +++ b/deployment/monocular/templates/api-config.yaml @@ -9,4 +9,7 @@ metadata: heritage: "{{ .Release.Service }}" data: monocular.yaml: |- -{{ toYaml .Values.api.config | indent 4 }} +{{ toYaml .Values.api.config | indent 4 -}} + redis: + host: {{ template "redis.fullname" . }}:6379 + diff --git a/deployment/monocular/values.yaml b/deployment/monocular/values.yaml index 7fb0e9c3c..fae3acfe7 100644 --- a/deployment/monocular/values.yaml +++ b/deployment/monocular/values.yaml @@ -88,6 +88,8 @@ prerender: requests: cpu: 100m memory: 128Mi +redis: + usePassword: false ingress: enabled: true diff --git a/scripts/repo-sync.sh b/scripts/repo-sync.sh index 92d9be004..13fa155ee 100755 --- a/scripts/repo-sync.sh +++ b/scripts/repo-sync.sh @@ -112,6 +112,7 @@ install_helm log "Packaging charts from source code" pushd $BUILD_DIR log "Packaging chart" + helm dep build $CHART_PATH helm package $CHART_PATH log "Indexing repository" @@ -135,4 +136,4 @@ fi log "Repository cleanup and reset" git reset --hard upstream/master -git clean -df . \ No newline at end of file +git clean -df . diff --git a/src/api/rootfs/Dockerfile b/src/api/rootfs/Dockerfile index d988c9451..6ff171844 100644 --- a/src/api/rootfs/Dockerfile +++ b/src/api/rootfs/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.3 +FROM alpine:3.6 RUN apk -U add ca-certificates && \ rm -Rf /var/cache/apk/* diff --git a/src/api/swagger/restapi/configure_monocular.go b/src/api/swagger/restapi/configure_monocular.go index 53edfbea5..3c94003f8 100755 --- a/src/api/swagger/restapi/configure_monocular.go +++ b/src/api/swagger/restapi/configure_monocular.go @@ -44,7 +44,10 @@ func configureAPI(api *operations.MonocularAPI) http.Handler { } // configure the api here - data.UpdateCache(conf.Repos) + if err := data.UpdateCache(conf.Repos); err != nil { + log.Fatalf("Can not configure repository cache %v\n", err) + } + chartsImplementation := cache.NewCachedCharts() // Run foreground repository refresh chartsImplementation.Refresh()