AETHER-761 Add support of private image registry with auth enabled
Change-Id: I25e804570357c513bfd1822ab9d971c7ed1c5405
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/secret-registry.yaml b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/secret-registry.yaml
new file mode 100644
index 0000000..1502049
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/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-cu/templates/statefulset-accelleran-cbrs-cu.yaml b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml
index 4553d66..a116822 100644
--- a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml
@@ -29,6 +29,10 @@
nodeSelector:
{{ .Values.nodeSelectors.accelleranCBRSCU.label }}: {{ .Values.nodeSelectors.accelleranCBRSCU.value }}
{{- end }}
+ {{- if .Values.images.credentials }}
+ imagePullSecrets:
+ - name: {{ .Release.Name }}.registry
+ {{- end }}
initContainers:
- name: cu-init
image: {{ .Values.images.tags.initCU }}