AETHER-761 Add support of private image registry with auth enabled
Change-Id: I25e804570357c513bfd1822ab9d971c7ed1c5405
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/secret-registry.yaml b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/secret-registry.yaml
new file mode 100644
index 0000000..1502049
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/secret-registry.yaml
@@ -0,0 +1,18 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.images.credentials }}
+---
+kind: Secret
+apiVersion: v1
+metadata:
+ name: {{ .Release.Name }}.registry
+ labels:
+ release: {{ .Release.Name }}
+type: kubernetes.io/dockerconfigjson
+data:
+ .dockerconfigjson: {{ printf `{"auths":{%s:{"auth":"%s"}}}` (.Values.images.credentials.registry | quote) (printf "%s:%s" .Values.images.credentials.username .Values.images.credentials.password | b64enc) | b64enc | quote }}
+{{- end }}
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-nats.yaml b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-nats.yaml
index fba96bb..38157af 100644
--- a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-nats.yaml
+++ b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-nats.yaml
@@ -28,6 +28,10 @@
{{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }}
{{- end }}
serviceAccountName: accelleran-cbrs-nats
+ {{- if .Values.images.credentials }}
+ imagePullSecrets:
+ - name: {{ .Release.Name }}.registry
+ {{- end }}
containers:
- name: nats
image: {{ .Values.images.tags.nats }}
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-redis.yaml b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-redis.yaml
index b244279..ae87b35 100644
--- a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-redis.yaml
+++ b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-redis.yaml
@@ -29,6 +29,10 @@
{{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }}
{{- end }}
serviceAccountName: accelleran-cbrs-redis
+ {{- if .Values.images.credentials }}
+ imagePullSecrets:
+ - name: {{ .Release.Name }}.registry
+ {{- end }}
containers:
- name: redis
image: {{ .Values.images.tags.redis }}
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ric.yaml b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ric.yaml
index 3c92ad1..0bc589c 100644
--- a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ric.yaml
+++ b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ric.yaml
@@ -30,6 +30,10 @@
{{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }}
{{- end }}
serviceAccountName: accelleran-cbrs-ric
+ {{- if .Values.images.credentials }}
+ imagePullSecrets:
+ - name: {{ .Release.Name }}.registry
+ {{- end }}
initContainers:
- name: redis-init-dep-check
image: {{ .Values.images.tags.depCheck }}
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ricweb.yaml b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ricweb.yaml
index 8ab7958..7152ede 100644
--- a/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ricweb.yaml
+++ b/ran/accelleran-cbrs/accelleran-cbrs-common/templates/statefulset-accelleran-cbrs-ricweb.yaml
@@ -29,6 +29,10 @@
nodeSelector:
{{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }}
{{- end }}
+ {{- if .Values.images.credentials }}
+ imagePullSecrets:
+ - name: {{ .Release.Name }}.registry
+ {{- end }}
initContainers:
- name: accelleran-cbrs-ric-dep-check
image: {{ .Values.images.tags.depCheck | quote }}