From da711dd6a353c79e2d8990815e18b91dfe2354b3 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Wed, 7 Apr 2021 17:22:42 +0200 Subject: [PATCH 1/1] [COMMON][CERTINIT] Generate cert with certInit Some components are http based but want to be usable from outside world. Instead of dealing with TLS part on the component itself, let's use certInitializer to generate a secret with the certs which will be usable by Ingress Issue-ID: SO-3078 Issue-ID: SO-3237 Issue-ID: CPS-281 Signed-off-by: Sylvain Desbureaux Change-Id: If166716d159586b1eb94c111e9d3d82a54c2fd6e --- .../certInitializer/resources/ingress/onboard.sh | 35 +++++++++++++++++ .../resources/{ => retrieval}/retrieval_check.sh | 3 +- .../resources/retrieval/tls_certs_configure.sh | 32 ++++++++++++++++ .../templates/_certInitializer.yaml | 9 +++++ .../certInitializer/templates/configmap.yaml | 15 +++++++- .../common/certInitializer/templates/job.yaml | 44 ++++++++++++++++++++++ kubernetes/common/certInitializer/values.yaml | 1 + 7 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 kubernetes/common/certInitializer/resources/ingress/onboard.sh rename kubernetes/common/certInitializer/resources/{ => retrieval}/retrieval_check.sh (99%) create mode 100644 kubernetes/common/certInitializer/resources/retrieval/tls_certs_configure.sh create mode 100644 kubernetes/common/certInitializer/templates/job.yaml diff --git a/kubernetes/common/certInitializer/resources/ingress/onboard.sh b/kubernetes/common/certInitializer/resources/ingress/onboard.sh new file mode 100644 index 0000000000..9cc5ec580e --- /dev/null +++ b/kubernetes/common/certInitializer/resources/ingress/onboard.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +{{/* +# Copyright © 2020 Orange +# +# 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. +*/ -}} + +echo "*** retrieving certificates and keys" +export CRT=$(cat {{ .Values.credsPath }}/certs/tls.crt | base64 -w 0) +export KEY=$(cat {{ .Values.credsPath }}/certs/tls.key | base64 -w 0) +export CACERT=$(cat {{ .Values.credsPath }}/certs/cacert.pem | base64 -w 0) +echo "*** creating tls secret" +cat <