From 1bed11db2fd23c5e8d5045efe23115e95adb3c0c Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 12:38:36 +0000 Subject: [PATCH 1/4] [bitnami/tensorflow-inception] Add global imagePullSecrets to overwrite any other existing one --- bitnami/tensorflow-inception/Chart.yaml | 2 +- bitnami/tensorflow-inception/README.md | 1 + .../templates/_helpers.tpl | 36 +++++++++++++++++++ .../templates/deployment.yaml | 7 +--- bitnami/tensorflow-inception/values.yaml | 15 ++++---- 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/bitnami/tensorflow-inception/Chart.yaml b/bitnami/tensorflow-inception/Chart.yaml index 8b6c5079c..d0288b130 100644 --- a/bitnami/tensorflow-inception/Chart.yaml +++ b/bitnami/tensorflow-inception/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: tensorflow-inception -version: 3.2.9 +version: 3.3.0 appVersion: 1.13.0 description: Open-source software library for serving machine learning models keywords: diff --git a/bitnami/tensorflow-inception/README.md b/bitnami/tensorflow-inception/README.md index 8283f7248..113bdbd4b 100755 --- a/bitnami/tensorflow-inception/README.md +++ b/bitnami/tensorflow-inception/README.md @@ -63,6 +63,7 @@ The following tables lists the configurable parameters of the TensorFlow Incepti | Parameter | Description | Default | | ------------------------------- | ------------------------------------------------ | ------------------------------------------------------------ | | `global.imageRegistry` | Global Docker image registry | `nil` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `replicaCount` | desired number of pods | `1` | | `server.image.registry` | TensorFlow Serving image registry | `docker.io` | | `server.image.repository` | TensorFlow Serving Image name | `bitnami/tensorflow-serving` | diff --git a/bitnami/tensorflow-inception/templates/_helpers.tpl b/bitnami/tensorflow-inception/templates/_helpers.tpl index eea84fd0b..e57a2f2bb 100644 --- a/bitnami/tensorflow-inception/templates/_helpers.tpl +++ b/bitnami/tensorflow-inception/templates/_helpers.tpl @@ -70,3 +70,39 @@ Return the proper image name (for the metrics image) {{- $tag := .Values.metrics.image.tag | toString -}} {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "tensorflow-inception.imagePullSecrets" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +Also, we can not use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} +{{- if .Values.global.imagePullSecrets }} +imagePullSecrets: +{{- range +.Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/bitnami/tensorflow-inception/templates/deployment.yaml b/bitnami/tensorflow-inception/templates/deployment.yaml index 9558a431a..24afd3f0f 100644 --- a/bitnami/tensorflow-inception/templates/deployment.yaml +++ b/bitnami/tensorflow-inception/templates/deployment.yaml @@ -34,12 +34,7 @@ spec: fsGroup: {{ .Values.securityContext.fsGroup }} runAsUser: {{ .Values.securityContext.runAsUser }} {{- end }} - {{- if .Values.server.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.server.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "tensorflow-inception.imagePullSecrets" . | indent 6 }} initContainers: - name: seed image: "{{ template "tensorflow-inception.client.image" . }}" diff --git a/bitnami/tensorflow-inception/values.yaml b/bitnami/tensorflow-inception/values.yaml index 169e94850..0c2eba76a 100644 --- a/bitnami/tensorflow-inception/values.yaml +++ b/bitnami/tensorflow-inception/values.yaml @@ -1,8 +1,11 @@ -## Global Docker image registry -## Please, note that this will override the image registry for all the images, including dependencies, configured to use the global value +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagepullSecrets ## # global: -# imageRegistry: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName replicaCount: 1 @@ -24,7 +27,7 @@ server: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName port: 8500 ## TensorFlow Inception image version @@ -45,7 +48,7 @@ client: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' @@ -85,7 +88,7 @@ metrics: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Metrics exporter pod Annotation and Labels podAnnotations: prometheus.io/scrape: "true" From d7f9f3f0dd944fb3025afb7edbf37a22b5f1e369 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 15:19:11 +0000 Subject: [PATCH 2/4] Fix typo --- bitnami/tensorflow-inception/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/tensorflow-inception/values.yaml b/bitnami/tensorflow-inception/values.yaml index 0c2eba76a..25c6714e8 100644 --- a/bitnami/tensorflow-inception/values.yaml +++ b/bitnami/tensorflow-inception/values.yaml @@ -1,6 +1,6 @@ ## Global Docker image parameters ## Please, note that this will override the image parameters, including dependencies, configured to use the global value -## Current available global Docker image parameters: imageRegistry and imagepullSecrets +## Current available global Docker image parameters: imageRegistry and imagePullSecrets ## # global: # imageRegistry: myRegistryName From 6fecf2a45a95dba5a673fad46697c513c0071053 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 15:40:14 +0000 Subject: [PATCH 3/4] Use server and client values --- .../tensorflow-inception/templates/_helpers.tpl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bitnami/tensorflow-inception/templates/_helpers.tpl b/bitnami/tensorflow-inception/templates/_helpers.tpl index e57a2f2bb..ac3d50370 100644 --- a/bitnami/tensorflow-inception/templates/_helpers.tpl +++ b/bitnami/tensorflow-inception/templates/_helpers.tpl @@ -87,22 +87,28 @@ imagePullSecrets: .Values.global.imagePullSecrets }} - name: {{ . }} {{- end }} -{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +{{- else if or .Values.server.image.pullSecrets .Values.client.image.pullSecrets .Values.metrics.image.pullSecrets }} imagePullSecrets: -{{- range .Values.image.pullSecrets }} +{{- range .Values.server.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.client.image.pullSecrets }} - name: {{ . }} {{- end }} {{- range .Values.metrics.image.pullSecrets }} - name: {{ . }} {{- end }} {{- end -}} -{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +{{- else if or .Values.server.image.pullSecrets .Values.client.image.pullSecrets .Values.metrics.image.pullSecrets }} imagePullSecrets: -{{- range .Values.image.pullSecrets }} +{{- range .Values.server.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.client.image.pullSecrets }} - name: {{ . }} {{- end }} {{- range .Values.metrics.image.pullSecrets }} - name: {{ . }} {{- end }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} From cf403be2cdbed27121ac1dd4948256bb9b1381be Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 18:52:01 +0000 Subject: [PATCH 4/4] Fix typo in helpers Signed-off-by: Carlos Rodriguez Hernandez --- bitnami/tensorflow-inception/templates/_helpers.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bitnami/tensorflow-inception/templates/_helpers.tpl b/bitnami/tensorflow-inception/templates/_helpers.tpl index ac3d50370..1c4579f19 100644 --- a/bitnami/tensorflow-inception/templates/_helpers.tpl +++ b/bitnami/tensorflow-inception/templates/_helpers.tpl @@ -83,8 +83,7 @@ Also, we can not use a single if because lazy evaluation is not an option {{- if .Values.global }} {{- if .Values.global.imagePullSecrets }} imagePullSecrets: -{{- range -.Values.global.imagePullSecrets }} +{{- range .Values.global.imagePullSecrets }} - name: {{ . }} {{- end }} {{- else if or .Values.server.image.pullSecrets .Values.client.image.pullSecrets .Values.metrics.image.pullSecrets }}