From bfef5abc0d2803a55e945d104195258491a9dab8 Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Thu, 27 Oct 2022 18:48:13 +0800 Subject: [PATCH] Fix configmap to inject arbitrary data with binaryData binaryData takes base64 encoded string Issue-ID: INF-322 Signed-off-by: Bin Yang Change-Id: I6d0e95db2f354546c2c5634f77501a5f8e01937d --- charts/templates/application_config.yaml | 5 ++--- charts/templates/ca_config.yaml | 5 ++--- charts/templates/serverkey_config.yaml | 5 ++--- docs/installation-guide.rst | 24 ++++++++++++++++++------ 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/charts/templates/application_config.yaml b/charts/templates/application_config.yaml index 1381032..844fbe6 100644 --- a/charts/templates/application_config.yaml +++ b/charts/templates/application_config.yaml @@ -23,6 +23,5 @@ metadata: app: {{ include "orano2.name" . }} chart: {{ .Chart.Name }} # ... -data: - config.json: | -{{ .Values.applicationconfig | indent 4 }} +binaryData: + config.json: {{ .Values.applicationconfig }} diff --git a/charts/templates/ca_config.yaml b/charts/templates/ca_config.yaml index b8703d7..41c0457 100644 --- a/charts/templates/ca_config.yaml +++ b/charts/templates/ca_config.yaml @@ -23,6 +23,5 @@ metadata: app: {{ include "orano2.name" . }} chart: {{ .Chart.Name }} # ... -data: - config.json: | -{{ .Values.caconfig | indent 4 }} +binaryData: + config.json: {{ .Values.caconfig }} diff --git a/charts/templates/serverkey_config.yaml b/charts/templates/serverkey_config.yaml index 1949ff5..c8b8882 100644 --- a/charts/templates/serverkey_config.yaml +++ b/charts/templates/serverkey_config.yaml @@ -23,6 +23,5 @@ metadata: app: {{ include "orano2.name" . }} chart: {{ .Chart.Name }} # ... -data: - config.json: | -{{ .Values.serverkeyconfig | indent 4 }} +binaryData: + config.json: {{ .Values.serverkeyconfig }} diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst index 3df0015..1e0a465 100644 --- a/docs/installation-guide.rst +++ b/docs/installation-guide.rst @@ -232,12 +232,22 @@ The following instruction should be done outside of INF platform controller host echo 'keyUsage = critical, cRLSign, keyCertSign'; \ echo 'extendedKeyUsage = serverAuth, clientAuth') + + applicationconfig=`base64 app.conf -w 0` + caconfig=`base64 imsserver.crt -w 0` + serverkeyconfig=`base64 imsserver.key -w 0` + + echo $applicationconfig + echo $caconfig + echo $serverkeyconfig + + cat <o2service-override.yaml o2ims: serviceaccountname: admin-oran-o2 image: repository: nexus3.o-ran-sc.org:10004/o-ran-sc/pti-o2imsdms - tag: 1.0.0 + tag: 2.0.0 pullPolicy: IfNotPresent logginglevel: "DEBUG" @@ -245,21 +255,23 @@ The following instruction should be done outside of INF platform controller host OS_AUTH_URL: "${OS_AUTH_URL}" OS_USERNAME: "${OS_USERNAME}" OS_PASSWORD: "${OS_PASSWORD}" - K8S_KUBECONFIG: "/opt/k8s_kube.conf" API_HOST_EXTERNAL_FLOATING: "${API_HOST_EXTERNAL_FLOATING}" + applicationconfig: ${applicationconfig} + caconfig: ${caconfig} + serverkeyconfig: ${serverkeyconfig} + EOF + cat o2service-override.yaml + 2.3 Deploy by helm cli ~~~~~~~~~~~~~~~~~~~~~~ .. code:: shell - config_data=`cat ./path/to/app.conf` - certification_data=`cat ./path/to/imsserver.crt` - key_data=`cat ./path/to/imsserver.key` - helm install o2service o2/charts --set caconfig="$certification_data" --set applicationconfig="$config_data" --set serverkeyconfig="$key_data" -f o2service-override.yaml + helm install o2service o2/charts -f o2service-override.yaml helm list |grep o2service kubectl -n ${NAMESPACE} get pods |grep o2api kubectl -n ${NAMESPACE} get services |grep o2api -- 2.16.6