From: garciadeblas Date: Tue, 10 Sep 2024 16:50:29 +0000 (+0200) Subject: Fix installer and OSM helm chart to include git data and credentials to be used by LCM X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F14545%2F1;p=osm%2Fdevops.git Fix installer and OSM helm chart to include git data and credentials to be used by LCM Change-Id: I2bab55bba10f3274fc3c645d124979438a78c68d Signed-off-by: garciadeblas --- diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index a809215a..d5d0c3f6 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -226,7 +226,15 @@ EOF" OSM_HELM_OPTS="${OSM_HELM_OPTS} --set grafana.ingress.hosts={grafana.${OSM_DEFAULT_IP}.nip.io}" OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.ingress.hosts={prometheus.${OSM_DEFAULT_IP}.nip.io}" # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.alertmanager.ingress.hosts={alertmanager.${OSM_DEFAULT_IP}.nip.io}" - [ -z "${INSTALL_MGMT_CLUSTER}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.enabled=false}" + if [ -z "${INSTALL_MGMT_CLUSTER}" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.enabled=false" + else + source "${HOME}/.osm/.credentials/gitea_environment.rc" + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.gitBaseUrl=${GITEA_HTTP_URL}" + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.gitUser=${GITEA_STD_USERNAME}" + AGE_MGMT_PUBKEY=$(tr -d '\n' < ${HOME}/.osm/.credentials/age.mgmt.pub) + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.pubkey=${AGE_MGMT_PUBKEY}" + fi if [ -n "${INSTALL_JUJU}" ]; then OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.enabled=true" @@ -545,6 +553,10 @@ function install_osm() { echo "Options: ${MGMTCLUSTER_INSTALL_OPTS}" $OSM_DEVOPS/installers/mgmt-cluster/install_mgmt_cluster.sh ${MGMTCLUSTER_INSTALL_OPTS} || \ FATAL_TRACK mgmtcluster "install_mgmt_cluster.sh failed" + if [ -n "${INSTALL_MGMT_CLUSTER}" ]; then + echo "Credentials stored under ${HOME}/.osm/.credentials" + echo "Repos stored under ${HOME}/.osm/repos" + fi track mgmtcluster mgmt_and_aux_cluster_ok # Deploy OSM (mongodb, OSM helm chart, NGSA) diff --git a/installers/helm/osm/templates/lcm/lcm-deployment.yaml b/installers/helm/osm/templates/lcm/lcm-deployment.yaml index fd01923c..a00403a0 100644 --- a/installers/helm/osm/templates/lcm/lcm-deployment.yaml +++ b/installers/helm/osm/templates/lcm/lcm-deployment.yaml @@ -69,6 +69,10 @@ spec: - secretRef: name: {{ .Values.lcm.secretName | default "lcm-secret" }} {{- end }} + {{- if .Values.global.gitops.enabled }} + - secretRef: + name: {{ include "osm.fullname" . }}-gitops-secret + {{- end }} {{- if or .Values.vca.enabled .Values.lcm.useOsmSecret }} env: {{- if .Values.vca.enabled }} diff --git a/installers/helm/osm/templates/osm-gitops-secret.yaml b/installers/helm/osm/templates/osm-gitops-secret.yaml new file mode 100644 index 00000000..233b74c1 --- /dev/null +++ b/installers/helm/osm/templates/osm-gitops-secret.yaml @@ -0,0 +1,29 @@ +{{- if .Values.global.gitops.enabled }} +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# 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: Secret +type: Opaque +metadata: + name: {{ include "osm.fullname" . }}-gitops-secret + labels: + {{- include "osm.labels" . | nindent 4 }} +data: + OSM_GITOPS_GIT_BASE_URL: {{ ( .Values.global.gitops.gitBaseUrl | default "http://git.127.0.0.1.nip.io" ) | b64enc | quote }} + OSM_GITOPS_USER: {{ ( .Values.global.gitops.gitUser | default "osm-developer" ) | b64enc | quote }} + OSM_GITOPS_PUBKEY: {{ ( .Values.global.gitops.pubkey | default ( randAlphaNum 32 ) ) | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/installers/helm/osm/values.yaml b/installers/helm/osm/values.yaml index af9f71ac..ac850346 100644 --- a/installers/helm/osm/values.yaml +++ b/installers/helm/osm/values.yaml @@ -62,6 +62,9 @@ global: mgmtcluster: secretName: mgmtcluster-secret secretKey: kubeconfig + gitUser: osm-developer + # gitBaseUrl: http://git..nip.io + # pubkey: AGEKEY podAnnotations: {}