aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common')
-rw-r--r--kubernetes/common/Makefile7
-rw-r--r--kubernetes/common/common/documentation.rst4
-rw-r--r--kubernetes/common/common/templates/_repository.tpl20
-rw-r--r--kubernetes/common/mariadb-galera/requirements.yaml5
-rw-r--r--kubernetes/common/mariadb-galera/resources/create-deployment.yml2
-rw-r--r--kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml6
-rw-r--r--kubernetes/common/mariadb-galera/templates/job.yaml8
-rw-r--r--kubernetes/common/mariadb-galera/templates/statefulset.yaml4
-rw-r--r--kubernetes/common/mariadb-galera/values.yaml11
-rw-r--r--kubernetes/common/mariadb-init/requirements.yaml5
-rw-r--r--kubernetes/common/mariadb-init/templates/job.yaml4
-rw-r--r--kubernetes/common/mariadb-init/values.yaml3
-rw-r--r--kubernetes/common/repository-wrapper/Chart.yaml18
-rw-r--r--kubernetes/common/repository-wrapper/requirements.yaml21
-rw-r--r--kubernetes/common/repository-wrapper/templates/secrets.yaml29
-rw-r--r--kubernetes/common/repository-wrapper/values.yaml15
-rw-r--r--kubernetes/common/repositoryGenerator/Chart.yaml18
-rw-r--r--kubernetes/common/repositoryGenerator/requirements.yaml14
-rw-r--r--kubernetes/common/repositoryGenerator/templates/_repository.tpl177
-rw-r--r--kubernetes/common/repositoryGenerator/values.yaml62
20 files changed, 381 insertions, 52 deletions
diff --git a/kubernetes/common/Makefile b/kubernetes/common/Makefile
index 817a2e24bc..43d62f1a82 100644
--- a/kubernetes/common/Makefile
+++ b/kubernetes/common/Makefile
@@ -20,11 +20,12 @@ SECRET_DIR := $(OUTPUT_DIR)/secrets
COMMON_CHARTS_DIR := common
EXCLUDES :=
-PROCESSED_LAST := cert-wrapper
-TO_FILTER := $(EXCLUDES) $(PROCESSED_LAST)
+PROCESSED_LAST := cert-wrapper repository-wrapper
+PROCESSED_FIRST := repositoryGenerator certInitializer
+TO_FILTER := $(PROCESSED_FIRST) $(EXCLUDES) $(PROCESSED_LAST)
HELM_BIN := helm
-HELM_CHARTS := $(filter-out $(TO_FILTER), $(sort $(patsubst %/.,%,$(wildcard */.)))) $(PROCESSED_LAST)
+HELM_CHARTS := $(PROCESSED_FIRST) $(filter-out $(TO_FILTER), $(sort $(patsubst %/.,%,$(wildcard */.)))) $(PROCESSED_LAST)
HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}")
.PHONY: $(HELM_CHARTS) $(TO_FILTER)
diff --git a/kubernetes/common/common/documentation.rst b/kubernetes/common/common/documentation.rst
index d982ab09c6..fd416c0cc8 100644
--- a/kubernetes/common/common/documentation.rst
+++ b/kubernetes/common/common/documentation.rst
@@ -77,8 +77,6 @@ only give an overview.
+----------------------------------------------------+-----------------------+
| `common.repository` | `_repository.tpl` |
+----------------------------------------------------+-----------------------+
- | `common.repository.secret` | `_repository.tpl` |
- +----------------------------------------------------+-----------------------+
| `common.flavor` | `_resources.tpl` |
+----------------------------------------------------+-----------------------+
| `common.resources` | `_resources.tpl` |
@@ -289,7 +287,7 @@ taken on mariadb-galera):
...
containers:
- name: {{ include "common.name" . }}
- image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+ image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
...
Namespace
diff --git a/kubernetes/common/common/templates/_repository.tpl b/kubernetes/common/common/templates/_repository.tpl
index 272db42125..0316ae7050 100644
--- a/kubernetes/common/common/templates/_repository.tpl
+++ b/kubernetes/common/common/templates/_repository.tpl
@@ -15,6 +15,8 @@
*/}}
{{/*
+ /!\ DEPRECATED /!\
+ Will be removed when transition to "repositoryGenerator" is finished.
Resolve the name of the common image repository.
The value for .Values.repository is used by default,
unless either override mechanism is used.
@@ -29,21 +31,3 @@
{{- default .Values.repository .Values.global.repository -}}
{{end}}
{{- end -}}
-
-
-{{/*
- Resolve the image repository secret token.
- The value for .Values.global.repositoryCred is used:
- repositoryCred:
- user: user
- password: password
- mail: email (optional)
-*/}}
-{{- define "common.repository.secret" -}}
- {{- $repo := include "common.repository" . }}
- {{- $repo := default "nexus3.onap.org:10001" $repo }}
- {{- $cred := .Values.global.repositoryCred }}
- {{- $mail := default "@" $cred.mail }}
- {{- $auth := printf "%s:%s" $cred.user $cred.password | b64enc }}
- {{- printf "{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}" $repo $cred.user $cred.password $mail $auth | b64enc -}}
-{{- end -}}
diff --git a/kubernetes/common/mariadb-galera/requirements.yaml b/kubernetes/common/mariadb-galera/requirements.yaml
index 4fbecbfab2..2509f7fcff 100644
--- a/kubernetes/common/mariadb-galera/requirements.yaml
+++ b/kubernetes/common/mariadb-galera/requirements.yaml
@@ -15,4 +15,7 @@
dependencies:
- name: common
version: ~6.x-0
- repository: 'file://../common' \ No newline at end of file
+ repository: 'file://../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../repositoryGenerator' \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/resources/create-deployment.yml b/kubernetes/common/mariadb-galera/resources/create-deployment.yml
index d81d640b0d..0f6bb5929e 100644
--- a/kubernetes/common/mariadb-galera/resources/create-deployment.yml
+++ b/kubernetes/common/mariadb-galera/resources/create-deployment.yml
@@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: {{ include "common.name" . }}
- image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+ image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
ports:
- containerPort: {{ .Values.service.internalPort }}
name: {{ .Values.service.portName }}
diff --git a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
index bce0eb9c43..1c780179be 100644
--- a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
+++ b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
@@ -45,11 +45,11 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+ image: {{ include "repositoryGenerator.image.readiness" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
name: {{ include "common.name" . }}-readiness
- name: mariadb-galera-backup-init
- image: "{{ include "common.repository" . }}/{{ .Values.backupImage }}"
+ image: {{ include "repositoryGenerator.image.mariadb" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/bash
@@ -94,7 +94,7 @@ spec:
mountPath: /var/lib/mysql
containers:
- name: mariadb-backup-validate
- image: "{{ include "common.repository" . }}/{{ .Values.backupImage }}"
+ image: {{ include "repositoryGenerator.image.mariadb" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
env:
- name: MYSQL_ROOT_PASSWORD
diff --git a/kubernetes/common/mariadb-galera/templates/job.yaml b/kubernetes/common/mariadb-galera/templates/job.yaml
index 5dc822a66f..250279ace2 100644
--- a/kubernetes/common/mariadb-galera/templates/job.yaml
+++ b/kubernetes/common/mariadb-galera/templates/job.yaml
@@ -14,7 +14,7 @@ spec:
runAsUser: 1001
containers:
- name: mariadb-job-pre-upgrade
- image: {{ .Values.global.kubectlImage}}
+ image: {{ include "repositoryGenerator.image.kubectl" . }}
imagePullPolicy: IfNotPresent
env:
- name: NAMESPACE_ENV
@@ -49,7 +49,7 @@ spec:
fsGroup: 1001
runAsUser: 0
initContainers:
- - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+ - image: {{ include "repositoryGenerator.image.readiness" . }}
name: mariadb-galera-upgrade-readiness
env:
- name: NAMESPACE
@@ -64,7 +64,7 @@ spec:
- mariadb-galera
containers:
- name: mariadb-job-post-upgrade
- image: {{ .Values.global.kubectlImage}}
+ image: {{ include "repositoryGenerator.image.kubectl" . }}
imagePullPolicy: IfNotPresent
env:
- name: NAMESPACE_ENV
@@ -99,7 +99,7 @@ spec:
spec:
containers:
- name: mariadb-job-post-delete
- image: {{ .Values.global.kubectlImage}}
+ image: {{ include "repositoryGenerator.image.kubectl" . }}
imagePullPolicy: IfNotPresent
command: ["/bin/bash", "-c", "--"]
args:
diff --git a/kubernetes/common/mariadb-galera/templates/statefulset.yaml b/kubernetes/common/mariadb-galera/templates/statefulset.yaml
index 47d1e0ef3d..eb21fe3182 100644
--- a/kubernetes/common/mariadb-galera/templates/statefulset.yaml
+++ b/kubernetes/common/mariadb-galera/templates/statefulset.yaml
@@ -61,7 +61,7 @@ spec:
- name: {{ include "common.namespace" . }}-docker-registry-key
containers:
- name: {{ include "common.name" . }}
- image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+ image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
env:
- name: POD_NAMESPACE
@@ -119,7 +119,7 @@ spec:
name: {{ include "common.fullname" . }}-data
initContainers:
- name: {{ include "common.name" . }}-prepare
- image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
+ image: {{ include "repositoryGenerator.image.busybox" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
volumeMounts:
diff --git a/kubernetes/common/mariadb-galera/values.yaml b/kubernetes/common/mariadb-galera/values.yaml
index 55606ea018..6b1676fba7 100644
--- a/kubernetes/common/mariadb-galera/values.yaml
+++ b/kubernetes/common/mariadb-galera/values.yaml
@@ -38,23 +38,12 @@ global:
backup:
mountPath: /dockerdata-nfs/backup
- repository: nexus3.onap.org:10001
-
- readinessImage: onap/oom/readiness:3.0.1
- busyboxImage: busybox:1.30
- busyboxRepository: docker.io
- # kubeclt image
- kubectlImage: "bitnami/kubectl:1.15"
-
#################################################################
# Application configuration defaults.
#################################################################
#repository: mysql
-repository: nexus3.onap.org:10001
image: adfinissygroup/k8s-mariadb-galera-centos:v002
-backupImage: library/mariadb:10.1.38
-imageInit: busybox
pullPolicy: IfNotPresent
# application configuration
diff --git a/kubernetes/common/mariadb-init/requirements.yaml b/kubernetes/common/mariadb-init/requirements.yaml
index 4fbecbfab2..2509f7fcff 100644
--- a/kubernetes/common/mariadb-init/requirements.yaml
+++ b/kubernetes/common/mariadb-init/requirements.yaml
@@ -15,4 +15,7 @@
dependencies:
- name: common
version: ~6.x-0
- repository: 'file://../common' \ No newline at end of file
+ repository: 'file://../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../repositoryGenerator' \ No newline at end of file
diff --git a/kubernetes/common/mariadb-init/templates/job.yaml b/kubernetes/common/mariadb-init/templates/job.yaml
index fb06568777..ad97cd4ed6 100644
--- a/kubernetes/common/mariadb-init/templates/job.yaml
+++ b/kubernetes/common/mariadb-init/templates/job.yaml
@@ -49,11 +49,11 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+ image: {{ include "repositoryGenerator.image.readiness" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
containers:
- name: {{ include "common.name" . }}
- image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+ image: {{ include "repositoryGenerator.image.mariadb" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/sh
diff --git a/kubernetes/common/mariadb-init/values.yaml b/kubernetes/common/mariadb-init/values.yaml
index 42a1513449..b2c0a05e46 100644
--- a/kubernetes/common/mariadb-init/values.yaml
+++ b/kubernetes/common/mariadb-init/values.yaml
@@ -16,8 +16,6 @@
# Global configuration defaults.
#################################################################
global:
- repository: nexus3.onap.org:10001
- readinessImage: onap/oom/readiness:3.0.1
mariadbGalera:
nameOverride: mariadb-galera
servicePort: 3306
@@ -45,7 +43,6 @@ secrets:
# Application configuration defaults.
#################################################################
-image: mariadb:10.1.38
pullPolicy: IfNotPresent
# These two values are used to supply commands that are run after the DB is created.
diff --git a/kubernetes/common/repository-wrapper/Chart.yaml b/kubernetes/common/repository-wrapper/Chart.yaml
new file mode 100644
index 0000000000..7f48d16877
--- /dev/null
+++ b/kubernetes/common/repository-wrapper/Chart.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+description: Wrapper chart to allow docker secret to be shared all instances
+name: repository-wrapper
+version: 6.0.0
diff --git a/kubernetes/common/repository-wrapper/requirements.yaml b/kubernetes/common/repository-wrapper/requirements.yaml
new file mode 100644
index 0000000000..02d40a57d9
--- /dev/null
+++ b/kubernetes/common/repository-wrapper/requirements.yaml
@@ -0,0 +1,21 @@
+# Copyright © 2018 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dependencies:
+ - name: common
+ version: ~6.x-0
+ repository: 'file://../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../repositoryGenerator'
diff --git a/kubernetes/common/repository-wrapper/templates/secrets.yaml b/kubernetes/common/repository-wrapper/templates/secrets.yaml
new file mode 100644
index 0000000000..21b56fadcd
--- /dev/null
+++ b/kubernetes/common/repository-wrapper/templates/secrets.yaml
@@ -0,0 +1,29 @@
+{{/*
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "common.namespace" . }}-docker-registry-key
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.name" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ include "common.release" . }}
+ heritage: {{ .Release.Service }}
+data:
+ .dockercfg: {{ include "repositoryGenerator.secret" . }}
+type: kubernetes.io/dockercfg
diff --git a/kubernetes/common/repository-wrapper/values.yaml b/kubernetes/common/repository-wrapper/values.yaml
new file mode 100644
index 0000000000..66f679c830
--- /dev/null
+++ b/kubernetes/common/repository-wrapper/values.yaml
@@ -0,0 +1,15 @@
+# Copyright © 2020 Orange
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+global: {} \ No newline at end of file
diff --git a/kubernetes/common/repositoryGenerator/Chart.yaml b/kubernetes/common/repositoryGenerator/Chart.yaml
new file mode 100644
index 0000000000..5ff53fa3d4
--- /dev/null
+++ b/kubernetes/common/repositoryGenerator/Chart.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+description: Template used to generate the right repository link
+name: repositoryGenerator
+version: 6.0.0
diff --git a/kubernetes/common/repositoryGenerator/requirements.yaml b/kubernetes/common/repositoryGenerator/requirements.yaml
new file mode 100644
index 0000000000..70ab2ecce6
--- /dev/null
+++ b/kubernetes/common/repositoryGenerator/requirements.yaml
@@ -0,0 +1,14 @@
+# Copyright © 2018 Amdocs, Bell Canada
+# Copyright © 2020 Orange
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/kubernetes/common/repositoryGenerator/templates/_repository.tpl b/kubernetes/common/repositoryGenerator/templates/_repository.tpl
new file mode 100644
index 0000000000..c351db1ba0
--- /dev/null
+++ b/kubernetes/common/repositoryGenerator/templates/_repository.tpl
@@ -0,0 +1,177 @@
+{{/*
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- define "repositoryGenerator._repositoryHelper" -}}
+ {{- $dot := default . .dot -}}
+ {{- $initRoot := default $dot.Values.repositoryGenerator .initRoot -}}
+ {{- $repoName := .repoName }}
+ {{- $overrideName := printf "%s%s" $repoName "Override" }}
+ {{- if (hasKey $dot.Values $overrideName) -}}
+ {{- printf "%s" (first (pluck $overrideName $dot.Values)) -}}
+ {{- else -}}
+ {{- first (pluck $repoName $dot.Values.global $initRoot.global) -}}
+ {{- end }}
+{{- end -}}
+
+{{/*
+ Resolve the name of the common image repository.
+
+ - .Values.global.repository : default image repository for all ONAP images
+ - .Values.repositoryOverride : override global repository on a per chart basis
+*/}}
+{{- define "repositoryGenerator.repository" -}}
+ {{- include "repositoryGenerator._repositoryHelper" (merge (dict "repoName" "repository") .) }}
+{{- end -}}
+
+{{/*
+ Resolve the name of the dockerHub image repository.
+
+ - .Values.global.dockerHubRepository : default image dockerHubRepository for all dockerHub images
+ - .Values.dockerHubRepositoryOverride : override global dockerHub repository on a per chart basis
+*/}}
+{{- define "repositoryGenerator.dockerHubRepository" -}}
+ {{- include "repositoryGenerator._repositoryHelper" (merge (dict "repoName" "dockerHubRepository") .) }}
+{{- end -}}
+
+{{/*
+ Resolve the name of the elasticRepository image repository.
+
+ - .Values.global.elasticRepository : default image elasticRepository for all images using elastic repository
+ - .Values.elasticRepositoryOverride : override global elasticRepository repository on a per chart basis
+*/}}
+{{- define "repositoryGenerator.elasticRepository" -}}
+ {{- include "repositoryGenerator._repositoryHelper" (merge (dict "repoName" "elasticRepository") .) }}
+{{- end -}}
+
+{{/*
+ Resolve the name of the googleK8sRepository image repository.
+
+ - .Values.global.googleK8sRepository : default image dockerHubRepository for all dockerHub images
+ - .Values.googleK8sRepositoryOverride : override global dockerHub repository on a per chart basis
+*/}}
+{{- define "repositoryGenerator.googleK8sRepository" -}}
+ {{- include "repositoryGenerator._repositoryHelper" (merge (dict "repoName" "googleK8sRepository") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image._helper" -}}
+ {{- $dot := default . .dot -}}
+ {{- $initRoot := default $dot.Values.repositoryGenerator .initRoot -}}
+ {{- $image := .image }}
+ {{- $repoName := first (pluck $image $initRoot.imageRepoMapping) }}
+ {{- include "repositoryGenerator._repositoryHelper" (merge (dict "repoName" $repoName ) .) }}/{{- first (pluck $image $dot.Values.global $initRoot.global) -}}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.busybox" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "busyboxImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.curl" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "curlImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.envsubst" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "envsubstImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.htpasswd" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "htpasswdImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.kubectl" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "kubectlImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.logging" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "loggingImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.mariadb" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "mariadbImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.nginx" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "nginxImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.postgres" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "postgresImage") .) }}
+{{- end -}}
+
+{{- define "repositoryGenerator.image.readiness" -}}
+ {{- include "repositoryGenerator.image._helper" (merge (dict "image" "readinessImage") .) }}
+{{- end -}}
+
+{{/*
+ Resolve the image repository secret token.
+ The value for .Values.global.repositoryCred is used if provided:
+ repositoryCred:
+ user: user
+ password: password
+ mail: email (optional)
+ You can also set the same things for dockerHub, elastic and googleK8s if
+ needed.
+*/}}
+{{- define "repositoryGenerator.secret" -}}
+ {{- $dot := default . .dot -}}
+ {{- $initRoot := default $dot.Values.repositoryGenerator .initRoot -}}
+ {{/* Our version of helm doesn't support deepCopy so we need this nasty trick */}}
+ {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }}
+ {{- $repoCreds := "" }}
+ {{- if $subchartDot.Values.global.dockerHubRepositoryCred }}
+ {{- $repo := $subchartDot.Values.global.repository }}
+ {{- $cred := $subchartDot.Values.global.repositoryCred }}
+ {{- $mail := default "@" $cred.mail }}
+ {{- $auth := printf "%s:%s" $cred.user $cred.password | b64enc }}
+ {{- $repoCreds = printf "\"%s\": {\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $repo $cred.user $cred.password $mail $auth }}
+ {{- end }}
+ {{- if $subchartDot.Values.global.dockerHubRepositoryCred }}
+ {{- $dhRepo := $subchartDot.Values.global.dockerHubRepository }}
+ {{- $dhCred := $subchartDot.Values.global.dockerHubRepositoryCred }}
+ {{- $dhMail := default "@" $dhCred.mail }}
+ {{- $dhAuth := printf "%s:%s" $dhCred.user $dhCred.password | b64enc }}
+ {{- $dhRepoCreds := printf "\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $dhRepo $dhCred.user $dhCred.password $dhMail $dhAuth }}
+ {{- if eq "" $repoCreds }}
+ {{- $repoCreds = $dhRepoCreds }}
+ {{- else }}
+ {{- $repoCreds = printf "%s, %s" $repoCreds $dhRepoCreds }}
+ {{- end }}
+ {{- end }}
+ {{- if $subchartDot.Values.global.elasticRepositoryCred }}
+ {{- $eRepo := $subchartDot.Values.global.elasticRepository }}
+ {{- $eCred := $subchartDot.Values.global.elasticRepositoryCred }}
+ {{- $eMail := default "@" $eCred.mail }}
+ {{- $eAuth := printf "%s:%s" $eCred.user $eCred.password | b64enc }}
+ {{- $eRepoCreds := printf "\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $eRepo $eCred.user $eCred.password $eMail $eAuth }}
+ {{- if eq "" $repoCreds }}
+ {{- $repoCreds = $eRepoCreds }}
+ {{- else }}
+ {{- $repoCreds = printf "%s, %s" $repoCreds $eRepoCreds }}
+ {{- end }}
+ {{- end }}
+ {{- if $subchartDot.Values.global.googleK8sRepositoryCred }}
+ {{- $gcrRepo := $subchartDot.Values.global.googleK8sRepository }}
+ {{- $gcrCred := $subchartDot.Values.global.googleK8sRepositoryCred }}
+ {{- $gcrMail := default "@" $gcrCred.mail }}
+ {{- $gcrAuth := printf "%s:%s" $gcrCred.user $gcrCred.password | b64enc }}
+ {{- $gcrRepoCreds := printf "\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $gcrRepo $gcrCred.user $gcrCred.password $gcrMail $gcrAuth }}
+ {{- if eq "" $repoCreds }}
+ {{- $repoCreds = $gcrRepoCreds }}
+ {{- else }}
+ {{- $repoCreds = printf "%s, %s" $repoCreds $gcrRepoCreds }}
+ {{- end }}
+ {{- end }}
+ {{- printf "{%s}" $repoCreds | b64enc -}}
+{{- end -}}
diff --git a/kubernetes/common/repositoryGenerator/values.yaml b/kubernetes/common/repositoryGenerator/values.yaml
new file mode 100644
index 0000000000..1ec3a35bd9
--- /dev/null
+++ b/kubernetes/common/repositoryGenerator/values.yaml
@@ -0,0 +1,62 @@
+# Copyright © 2020 Orange
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+global:
+ # Repositories used
+ repository: nexus3.onap.org:10001
+ dockerHubRepository: docker.io
+ elasticRepository: docker.elastic.co
+ googleK8sRepository: k8s.gcr.io
+
+ # common global images
+ busyboxImage: busybox:1.32
+ curlImage: curlimages/curl:7.69.1
+ envsubstImage: dibi/envsubst:1
+ # there's only latest image for htpasswd
+ htpasswdImage: xmartlabs/htpasswd:latest
+ kubectlImage: bitnami/kubectl:1.19
+ loggingImage: beats/filebeat:5.5.0
+ mariadbImage: mariadb:10.1.48
+ nginxImage: bitnami/nginx:1.18-debian-10
+ postgresImage: crunchydata/crunchy-postgres:centos7-10.11-4.2.1
+ readinessImage: onap/oom/readiness:3.0.1
+
+ # Default credentials
+ # they're optional. If the target repository doesn't need them, comment them
+ repositoryCred:
+ user: docker
+ password: docker
+ # If you want / need authentication on the repositories, please set
+ # Don't set them if the target repo is the same than others
+ # dockerHubCred:
+ # user: myuser
+ # password: mypassord
+ # elasticCred:
+ # user: myuser
+ # password: mypassord
+ # googleK8sCred:
+ # user: myuser
+ # password: mypassord
+
+imageRepoMapping:
+ busyboxImage: dockerHubRepository
+ curlImage: dockerHubRepository
+ envsubstImage: dockerHubRepository
+ htpasswdImage: dockerHubRepository
+ kubectlImage: dockerHubRepository
+ loggingImage: elasticRepository
+ mariadbImage: dockerHubRepository
+ nginxImage: dockerHubRepository
+ postgresImage: dockerHubRepository
+ readinessImage: repository