charts: add supprot to pull images from private registry 91/9491/4
authorJackie Huang <jackie.huang@windriver.com>
Mon, 7 Nov 2022 01:48:13 +0000 (09:48 +0800)
committerBin Yang <bin.yang@windriver.com>
Mon, 7 Nov 2022 07:46:17 +0000 (07:46 +0000)
* Set all images in values.yaml so they can be overridden
  to pull from other private/public registry

* Set imagePullSecrets to be list to support for multible
  private registries, the one in default value is used for
  registry.local:9001 on StarlingX

* Change the default values for binaryData which can't be
  empty string, or it fails with:
  Error: unable to build kubernetes objects from release manifest: error
  validating "": error validating data: unknown object type "nil" in
  ConfigMap.binaryData.config.json

* docs: keep the o2 image name in local registry consistent
  with the upstream one:
  - nexus3.o-ran-sc.org:10004/o-ran-sc/pti-o2imsdms:2.0.0
  - registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0

Issue-ID: INF-336

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I125f9f01661cc4618bf1d81f4e0fc59d46bb9d99

README-o2imsbuilder.md
charts/templates/deployment.yaml
charts/values.yaml
docs/installation-guide.rst

index a11a844..bd4cfba 100644 (file)
@@ -49,8 +49,8 @@ exit
 ### Push O2 service images to local registry (with auth user admin)
 
 ```sh
-sudo docker tag o2imsdms:latest registry.local:9001/admin/o2imsdms:0.1.4
-sudo docker image push registry.local:9001/admin/o2imsdms:0.1.4
+sudo docker tag o2imsdms:latest registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
+sudo docker image push registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
 
 ```
 
@@ -63,11 +63,15 @@ kubectl create ns ${NAMESPACE}
 cd /home/sysadmin/
 source /etc/platform/openrc
 cat <<EOF>ocloud-override.yaml
+imagePullSecrets:
+  - default-registry-key
+
 o2ims:
   serviceaccountname: admin-oran-o2
   image:
-    repository: registry.local:9001/admin/o2imsdms
-    tag: 0.1.4
+    img_o2: registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
+    img_postgres: postgres:9.6
+    img_redis: redis:alpine
     pullPolicy: IfNotPresent
   logginglevel: "DEBUG"
 
index 0976512..402fe02 100644 (file)
@@ -31,17 +31,19 @@ spec:
         app: o2api
     spec:
       serviceAccountName: {{ .Values.o2ims.serviceaccountname }}
-      # imagePullSecrets:
-      #   - name: {{ .Values.o2ims.imagePullSecrets }}
+      {{- if .Values.imagePullSecrets }}
       imagePullSecrets:
-        - name: {{ .Values.o2ims.serviceaccountname }}-registry-secret
+        {{- range .Values.imagePullSecrets }}
+        - name: {{ . }}
+        {{- end }}
+      {{- end }}
 {{- if .Values.o2ims.affinity }}
       affinity:
 {{ toYaml .Values.o2ims.affinity | indent 8 }}
 {{- end }}
       containers:
         - name: postgres
-          image: postgres:9.6
+          image: "{{ .Values.o2ims.image.img_postgres }}"
           ports:
             - containerPort: 5432
           env:
@@ -58,11 +60,11 @@ spec:
             - name: db-pv
               mountPath: /var/lib/postgresql/data
         - name: redis
-          image: redis:alpine
+          image: "{{ .Values.o2ims.image.img_redis }}"
           ports:
             - containerPort: 6379
         - name: o2pubsub
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
+          image: "{{ .Values.o2ims.image.img_o2 }}"
           command: ["/bin/bash", "/opt/o2pubsub_start.sh"]
           env:
             - name: DB_HOST
@@ -94,7 +96,7 @@ spec:
               mountPath: /configs/smoca.crt
               subPath: config.json
         - name: watcher
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
+          image: "{{ .Values.o2ims.image.img_o2 }}"
           command: ["/bin/bash", "/opt/o2watcher_start.sh"]
           env:
             - name: API_HOST_EXTERNAL_FLOATING
@@ -123,7 +125,7 @@ spec:
               subPath: config.json
               readOnly: true
         - name: o2api
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
+          image: "{{ .Values.o2ims.image.img_o2 }}"
           ports:
             - containerPort: 80
           env:
@@ -170,7 +172,7 @@ spec:
               readOnly: true
         {{- if .Values.o2dms.helm_cli_enable }}
         - name: helmcli
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
+          image: "{{ .Values.o2ims.image.img_o2 }}"
           ports:
             - containerPort: 22
           env:
index f0a9708..01b7f4a 100644 (file)
@@ -22,13 +22,14 @@ replicaCount: 1
 nameOverride: ""
 fullnameOverride: ""
 
-applicationconfig: ""
-
-servercrt: ""
-
-serverkey: ""
-
-smocacrt: ""
+# The default value "" doesn't work with binaryData,
+# So generate the value with:
+# echo "" | base64
+# Cg==
+applicationconfig: Cg==
+servercrt: Cg==
+serverkey: Cg==
+smocacrt: Cg==
 
 resources:
   cpu: 1
@@ -40,11 +41,18 @@ global:
 db:
   storageSize: 10Gi
 
+# ImagePullSecrets for operator ServiceAccount, list of secrets in the same
+# namespace used to pull operator image. Must be set for any cluster configured
+# with private docker registry.
+imagePullSecrets:
+  - default-registry-key
+
 o2ims:
   serviceaccountname: admin-oran-o2
   image:
-    repository: registry.local:9001/admin/o2imsdms
-    tag: 0.1.1
+    img_o2: nexus3.o-ran-sc.org:10004/o-ran-sc/pti-o2imsdms:2.0.0
+    img_postgres: postgres:9.6
+    img_redis: redis:alpine
     pullPolicy: IfNotPresent
   logginglevel: "WARNING"
 
index cac7eb6..2674eac 100644 (file)
@@ -252,11 +252,15 @@ The following instruction should be done outside of INF platform controller host
 
 
   cat <<EOF>o2service-override.yaml
+  imagePullSecrets:
+    - default-registry-key
+
   o2ims:
     serviceaccountname: admin-oran-o2
     image:
-      repository: nexus3.o-ran-sc.org:10004/o-ran-sc/pti-o2imsdms
-      tag: 2.0.0
+      img_o2: nexus3.o-ran-sc.org:10004/o-ran-sc/pti-o2imsdms:2.0.0
+      img_postgres: postgres:9.6
+      img_redis: redis:alpine
       pullPolicy: IfNotPresent
     logginglevel: "DEBUG"