From 51aeaa3c3808c2288ab29d0b227fb04759f17aca Mon Sep 17 00:00:00 2001 From: dliu5 Date: Mon, 31 Oct 2022 14:24:04 +0800 Subject: [PATCH] Rename ssl related files and variable names to make it more clear. Add SMO certificate variable and mount. Signed-off-by: dliu5 Change-Id: Ia65c0a5af41731de99f092004f5e04093cc6767d --- charts/resources/scripts/init/o2api_start.sh | 2 +- charts/templates/deployment.yaml | 22 +++++++++++------- .../{serverkey_config.yaml => servercrt.yaml} | 4 ++-- charts/templates/serverkey.yaml | 27 ++++++++++++++++++++++ charts/templates/{ca_config.yaml => smocacrt.yaml} | 4 ++-- charts/values.yaml | 6 +++-- docs/installation-guide.rst | 18 +++++++++------ 7 files changed, 61 insertions(+), 22 deletions(-) rename charts/templates/{serverkey_config.yaml => servercrt.yaml} (90%) create mode 100644 charts/templates/serverkey.yaml rename charts/templates/{ca_config.yaml => smocacrt.yaml} (91%) diff --git a/charts/resources/scripts/init/o2api_start.sh b/charts/resources/scripts/init/o2api_start.sh index 6aa68a4..9b376f4 100644 --- a/charts/resources/scripts/init/o2api_start.sh +++ b/charts/resources/scripts/init/o2api_start.sh @@ -31,6 +31,6 @@ cat <>/etc/hosts EOF -flask run --host=0.0.0.0 --port=80 --cert /configs/ca.cert --key /configs/server.key +flask run --host=0.0.0.0 --port=80 --cert /configs/server.crt --key /configs/server.key sleep infinity diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index 194ca7e..bcc8dc9 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -153,14 +153,18 @@ spec: mountPath: /configs/o2app.conf subPath: config.json readOnly: true - - name: caconfig - mountPath: /configs/ca.cert + - name: servercrt + mountPath: /configs/server.crt subPath: config.json readOnly: true - - name: serverkeyconfig + - name: serverkey mountPath: /configs/server.key subPath: config.json readOnly: true + - name: smocacrt + mountPath: /configs/smoca.crt + subPath: config.json + readOnly: true - name: helmcli image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}" ports: @@ -184,10 +188,12 @@ spec: name: {{ .Chart.Name }}-application-config name: applicationconfig - configMap: - name: {{ .Chart.Name }}-serverkeyconfig - name: serverkeyconfig + name: {{ .Chart.Name }}-serverkey + name: serverkey - configMap: - name: {{ .Chart.Name }}-caconfig - name: caconfig + name: {{ .Chart.Name }}-servercrt + name: servercrt + - configMap: + name: {{ .Chart.Name }}-smocacrt + name: smocacrt --- - diff --git a/charts/templates/serverkey_config.yaml b/charts/templates/servercrt.yaml similarity index 90% rename from charts/templates/serverkey_config.yaml rename to charts/templates/servercrt.yaml index c8b8882..1e736a8 100644 --- a/charts/templates/serverkey_config.yaml +++ b/charts/templates/servercrt.yaml @@ -16,7 +16,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Chart.Name }}-serverkeyconfig + name: {{ .Chart.Name }}-servercrt namespace: {{ .Values.global.namespace }} labels: release: {{ .Release.Name }} @@ -24,4 +24,4 @@ metadata: chart: {{ .Chart.Name }} # ... binaryData: - config.json: {{ .Values.serverkeyconfig }} + config.json: {{ .Values.servercrt }} diff --git a/charts/templates/serverkey.yaml b/charts/templates/serverkey.yaml new file mode 100644 index 0000000..186195d --- /dev/null +++ b/charts/templates/serverkey.yaml @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Wind River Systems, Inc. +# +# 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: ConfigMap +metadata: + name: {{ .Chart.Name }}-serverkey + namespace: {{ .Values.global.namespace }} + labels: + release: {{ .Release.Name }} + app: {{ include "orano2.name" . }} + chart: {{ .Chart.Name }} +# ... +binaryData: + config.json: {{ .Values.serverkey }} diff --git a/charts/templates/ca_config.yaml b/charts/templates/smocacrt.yaml similarity index 91% rename from charts/templates/ca_config.yaml rename to charts/templates/smocacrt.yaml index 41c0457..765109d 100644 --- a/charts/templates/ca_config.yaml +++ b/charts/templates/smocacrt.yaml @@ -16,7 +16,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Chart.Name }}-caconfig + name: {{ .Chart.Name }}-smocacrt namespace: {{ .Values.global.namespace }} labels: release: {{ .Release.Name }} @@ -24,4 +24,4 @@ metadata: chart: {{ .Chart.Name }} # ... binaryData: - config.json: {{ .Values.caconfig }} + config.json: {{ .Values.smocacrt }} diff --git a/charts/values.yaml b/charts/values.yaml index 9a743d6..6d1fa54 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -24,9 +24,11 @@ fullnameOverride: "" applicationconfig: "" -caconfig: "" +servercrt: "" -serverkeyconfig: "" +serverkey: "" + +smocacrt: "" resources: cpu: 1 diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst index 1e0a465..9854ef6 100644 --- a/docs/installation-guide.rst +++ b/docs/installation-guide.rst @@ -179,7 +179,8 @@ The following instruction should be done outside of INF platform controller host kubectl apply -f smo-serviceaccount.yaml #export the smo account token data - export SMO_TOKEN_DATA=$(kubectl -n default describe secret $(kubectl -n default get secret | grep ${SMO_SERVICEACCOUNT} | awk '{print $1}') | grep "token:" | awk '{print $2}') + export SMO_SECRET=$(kubectl -n default get serviceaccounts $SMO_SERVICEACCOUNT -o jsonpath='{.secrets[0].name}') + export SMO_TOKEN_DATA=$(kubectl -n default get secrets $SMO_SECRET -o jsonpath='{.data.token}') #prepare the application config file cat <app.conf @@ -234,12 +235,14 @@ The following instruction should be done outside of INF platform controller host applicationconfig=`base64 app.conf -w 0` - caconfig=`base64 imsserver.crt -w 0` - serverkeyconfig=`base64 imsserver.key -w 0` + servercrt=`base64 imsserver.crt -w 0` + serverkey=`base64 imsserver.key -w 0` + smocacrt=`base64 smoca.crt -w 0` echo $applicationconfig - echo $caconfig - echo $serverkeyconfig + echo $servercrt + echo $serverkey + echo $smocacrt cat <o2service-override.yaml @@ -258,8 +261,9 @@ The following instruction should be done outside of INF platform controller host API_HOST_EXTERNAL_FLOATING: "${API_HOST_EXTERNAL_FLOATING}" applicationconfig: ${applicationconfig} - caconfig: ${caconfig} - serverkeyconfig: ${serverkeyconfig} + servercrt: ${servercrt} + serverkey: ${serverkey} + smocacrt: ${smocacrt} EOF -- 2.16.6