Replace alpine git image by bitnami git

This commit is contained in:
Carlos Rodriguez Hernandez
2018-10-23 20:40:01 +00:00
parent a560a551e5
commit 8dfd7bed8a
10 changed files with 68 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
name: mean
version: 4.2.0
version: 4.2.1
appVersion: 3.6.4
description: MEAN is a free and open-source JavaScript software stack for building dynamic web sites and web applications. The MEAN stack is MongoDB, Express.js, Angular, and Node.js. Because all components of the MEAN stack support programs written in JavaScript, MEAN applications can be written in one language for both server-side and client-side execution environments.
keywords:

View File

@@ -53,14 +53,14 @@ The following table lists the configurable parameters of the MEAN chart and thei
|-----------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `image.registry` | NodeJS image registry | `docker.io` |
| `image.repository` | NodeJS Image name | `bitnami/node` |
| `image.tag` | NodeJS Image tag | `{VERSION}` |
| `image.repository` | NodeJS image name | `bitnami/node` |
| `image.tag` | NodeJS image tag | `{VERSION}` |
| `image.pullPolicy` | NodeJS image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
| `gitImage.registry` | Git image registry | `docker.io` |
| `gitImage.repository` | Git Image name | `alpine/git` |
| `gitImage.tag` | Git Image tag | `latest` |
| `gitImage.pullPolicy` | Git image pull policy | IfNotPresent` |
| `git.registry` | Git image registry | `docker.io` |
| `git.repository` | Git image name | `bitnami/git` |
| `git.tag` | Git image tag | `latest` |
| `git.pullPolicy` | Git image pull policy | IfNotPresent` |
| `repository` | Repo of the application | `https://github.com/bitnami/sample-mean.git` |
| `revision` | Revision to checkout | `master` |
| `replicas` | Number of replicas for the application | `1` |

View File

@@ -63,3 +63,26 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper Git image name
*/}}
{{- define "git.image" -}}
{{- $registryName := .Values.git.registry -}}
{{- $repositoryName := .Values.git.repository -}}
{{- $tag := .Values.git.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}

View File

@@ -28,8 +28,8 @@ spec:
{{- end }}
initContainers:
- name: git-clone-repository
image: "{{ .Values.gitImage.registry }}/{{ .Values.gitImage.repository }}:{{ .Values.gitImage.tag }}"
imagePullPolicy: {{ .Values.gitImage.pullPolicy | quote }}
image: "{{ template "git.image" . }}"
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
command: [ '/bin/sh', '-c' , 'git clone {{ .Values.repository }} /app && cd /app && git checkout {{ .Values.revision }}']
volumeMounts:
- name: app

View File

@@ -23,9 +23,9 @@ image:
# pullSecrets:
# - myRegistrKeySecretName
gitImage:
git:
registry: docker.io
repository: alpine/git
repository: bitnami/git
tag: latest
pullPolicy: IfNotPresent

View File

@@ -1,5 +1,5 @@
name: node
version: 6.2.0
version: 6.2.1
appVersion: 10.7.0
description: Event-driven I/O server-side JavaScript environment based on V8
keywords:

View File

@@ -53,15 +53,14 @@ The following table lists the configurable parameters of the Node chart and thei
|-----------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `image.registry` | NodeJS image registry | `docker.io` |
| `image.repository` | NodeJS Image name | `bitnami/node` |
| `image.tag` | NodeJS Image tag | `{VERSION}` |
| `image.repository` | NodeJS image name | `bitnami/node` |
| `image.tag` | NodeJS image tag | `{VERSION}` |
| `image.pullPolicy` | NodeJS image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
| `gitImage.registry` | Git image registry | `docker.io` |
| `gitImage.repository` | Git Image name | `alpine/git` |
| `gitImage.tag` | Git Image tag | `latest` |
| `gitImage.pullPolicy` | Git image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
| `gitImage` | Image used for initContainers | `alpine/git` |
| `git.registry` | Git image registry | `docker.io` |
| `git.repository` | Git image name | `bitnami/git` |
| `git.tag` | Git image tag | `latest` |
| `git.pullPolicy` | Git image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
| `repository` | Repo of the application | `https://github.com/bitnami/sample-mean.git` |
| `revision` | Revision to checkout | `master` |
| `replicas` | Number of replicas for the application | `1` |

View File

@@ -63,3 +63,26 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper git image name
*/}}
{{- define "git.image" -}}
{{- $registryName := .Values.git.registry -}}
{{- $repositoryName := .Values.git.repository -}}
{{- $tag := .Values.git.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}

View File

@@ -29,8 +29,8 @@ spec:
{{- end }}
initContainers:
- name: git-clone-repository
image: "{{ .Values.gitImage.registry }}/{{ .Values.gitImage.repository }}:{{ .Values.gitImage.tag }}"
imagePullPolicy: {{ .Values.gitImage.pullPolicy | quote }}
image: "{{ template "git.image" . }}"
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
command: [ '/bin/sh', '-c' , 'git clone {{ .Values.repository }} /app && cd /app && git checkout {{ .Values.revision }}']
volumeMounts:
- name: app

View File

@@ -23,9 +23,9 @@ image:
# pullSecrets:
# - myRegistrKeySecretName
gitImage:
git:
registry: docker.io
repository: alpine/git
repository: bitnami/git
tag: latest
pullPolicy: IfNotPresent