Feature 11006: make juju installation optional in community installer 44/13944/8
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 10 Oct 2023 08:52:29 +0000 (10:52 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 21 Nov 2023 08:36:53 +0000 (09:36 +0100)
Change-Id: Id00504e76f8492e4bd146bca430b50df8061e92b
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
installers/full_install_osm.sh
installers/helm/osm/templates/lcm/lcm-deployment.yaml
installers/helm/osm/templates/mon/mon-deployment.yaml
installers/helm/osm/values.yaml
installers/install_juju.sh
jenkins/ci-pipelines/ci_stage_3.groovy

index e053bd7..ad46adc 100755 (executable)
@@ -266,19 +266,24 @@ function deploy_osm_services() {
 
     # Generate helm values to be passed with -f osm-values.yaml
     sudo mkdir -p ${OSM_HELM_WORK_DIR}
-    sudo bash -c "cat << EOF > ${OSM_HELM_WORK_DIR}/osm-values.yaml
+    if [ -n "${INSTALL_JUJU}" ]; then
+        sudo bash -c "cat << EOF > ${OSM_HELM_WORK_DIR}/osm-values.yaml
 vca:
   pubkey: \"${OSM_VCA_PUBKEY}\"
 EOF"
+    fi
 
     # Generate helm values to be passed with --set
     OSM_HELM_OPTS=""
     # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mysql.dbHostPath=${OSM_NAMESPACE_VOL}"
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.host=${OSM_VCA_HOST}"
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.secret=${OSM_VCA_SECRET}"
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.cacert=${OSM_VCA_CACERT}"
+    if [ -n "${INSTALL_JUJU}" ]; then
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.enabled=true"
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.host=${OSM_VCA_HOST}"
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.secret=${OSM_VCA_SECRET}"
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.cacert=${OSM_VCA_CACERT}"
+    fi
     [ -n "$OSM_VCA_APIPROXY" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set lcm.config.OSMLCM_VCA_APIPROXY=${OSM_VCA_APIPROXY}"
     [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.tag=${OSM_DOCKER_TAG}"
     [ -n "${INSTALL_NGSA}" ] || OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.oldServiceAssurance=true"
@@ -289,9 +294,11 @@ EOF"
         [ -n "${NO_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.NO_PROXY=${NO_PROXY}"
     fi
 
-    echo "helm -n $OSM_NAMESPACE install $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm -f ${OSM_HELM_WORK_DIR}/osm-values.yaml ${OSM_HELM_OPTS}"
-    helm -n $OSM_NAMESPACE install $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm -f ${OSM_HELM_WORK_DIR}/osm-values.yaml ${OSM_HELM_OPTS}
-
+    if [ -n "${INSTALL_JUJU}" ]; then
+        OSM_HELM_OPTS="-f ${OSM_HELM_WORK_DIR}/osm-values.yaml ${OSM_HELM_OPTS}"
+    fi
+    echo "helm install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS}"
+    helm install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS}
     # Override existing values.yaml with the final values.yaml used to install OSM
     helm -n $OSM_NAMESPACE get values $OSM_NAMESPACE | sudo tee -a ${OSM_HELM_WORK_DIR}/osm-values.yaml
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
@@ -440,7 +447,9 @@ function install_osm() {
 
     check_osm_behind_proxy
     check_packages "git wget curl tar snapd"
-    sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
+    if [ -n "${INSTALL_JUJU}" ]; then
+        sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
+    fi
     find_devops_folder
 
     track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none os_info $os_info none none
@@ -465,8 +474,8 @@ function install_osm() {
     # configure apt proxy
     [ -n "$APT_PROXY_URL" ] && configure_apt_proxy $APT_PROXY_URL
 
-    # if no host is passed in, we need to install lxd, unless explicilty asked not to
-    if [ -z "$OSM_VCA_HOST" ] && [ -z "$INSTALL_NOLXD" ] && [ -z "$LXD_CLOUD_FILE" ]; then
+    # if lxd is requested, we will install it
+    if [ -n "$INSTALL_LXD" ]; then
         LXD_INSTALL_OPTS="-D ${OSM_DEVOPS} -i ${OSM_DEFAULT_IF} ${DEBUG_INSTALL}"
         [ -n "${OSM_BEHIND_PROXY}" ] && LXD_INSTALL_OPTS="${LXD_INSTALL_OPTS} -P"
         $OSM_DEVOPS/installers/install_lxd.sh ${LXD_INSTALL_OPTS} || FATAL_TRACK lxd "install_lxd.sh failed"
@@ -491,14 +500,16 @@ function install_osm() {
     FATAL_TRACK k8scluster "install_kubeadm_cluster.sh failed"
     track k8scluster k8scluster_ok
 
-    JUJU_OPTS="-D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -i ${OSM_DEFAULT_IP} ${DEBUG_INSTALL} ${INSTALL_NOJUJU} ${INSTALL_CACHELXDIMAGES}"
-    [ -n "${OSM_VCA_HOST}" ] && JUJU_OPTS="$JUJU_OPTS -H ${OSM_VCA_HOST}"
-    [ -n "${LXD_CLOUD_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -l ${LXD_CLOUD_FILE}"
-    [ -n "${LXD_CRED_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -L ${LXD_CRED_FILE}"
-    [ -n "${CONTROLLER_NAME}" ] && JUJU_OPTS="$JUJU_OPTS -K ${CONTROLLER_NAME}"
-    [ -n "${OSM_BEHIND_PROXY}" ] && JUJU_OPTS="${JUJU_OPTS} -P"
-    $OSM_DEVOPS/installers/install_juju.sh ${JUJU_OPTS} || FATAL_TRACK juju "install_juju.sh failed"
-    set_vca_variables
+    if [ -n "${INSTALL_JUJU}" ]; then
+        JUJU_OPTS="-D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -i ${OSM_DEFAULT_IP} ${DEBUG_INSTALL} ${INSTALL_CACHELXDIMAGES}"
+        [ -n "${OSM_VCA_HOST}" ] && JUJU_OPTS="$JUJU_OPTS -H ${OSM_VCA_HOST}"
+        [ -n "${LXD_CLOUD_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -l ${LXD_CLOUD_FILE}"
+        [ -n "${LXD_CRED_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -L ${LXD_CRED_FILE}"
+        [ -n "${CONTROLLER_NAME}" ] && JUJU_OPTS="$JUJU_OPTS -K ${CONTROLLER_NAME}"
+        [ -n "${OSM_BEHIND_PROXY}" ] && JUJU_OPTS="${JUJU_OPTS} -P"
+        $OSM_DEVOPS/installers/install_juju.sh ${JUJU_OPTS} || FATAL_TRACK juju "install_juju.sh failed"
+        set_vca_variables
+    fi
     track juju juju_ok
 
     # Deploy OSM services
@@ -622,13 +633,12 @@ function dump_vars(){
     echo "DOCKER_USER=$DOCKER_USER"
     echo "INSTALL_CACHELXDIMAGES=$INSTALL_CACHELXDIMAGES"
     echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE"
+    echo "INSTALL_JUJU=$INSTALL_JUJU"
     echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR"
     echo "INSTALL_LIGHTWEIGHT=$INSTALL_LIGHTWEIGHT"
     echo "INSTALL_LXD=$INSTALL_LXD"
     echo "INSTALL_NGSA=$INSTALL_NGSA"
     echo "INSTALL_NODOCKER=$INSTALL_NODOCKER"
-    echo "INSTALL_NOJUJU=$INSTALL_NOJUJU"
-    echo "INSTALL_NOLXD=$INSTALL_NOLXD"
     echo "INSTALL_ONLY=$INSTALL_ONLY"
     echo "INSTALL_PLA=$INSTALL_PLA"
     echo "INSTALL_TO_OPENSTACK=$INSTALL_TO_OPENSTACK"
@@ -709,9 +719,8 @@ OPENSTACK_VM_NAME="server-osm"
 OPENSTACK_PYTHON_VENV="$HOME/.virtual-envs/osm"
 INSTALL_ONLY=""
 TO_REBUILD=""
-INSTALL_NOLXD=""
 INSTALL_NODOCKER=""
-INSTALL_NOJUJU=""
+INSTALL_JUJU=""
 INSTALL_NOHOSTCLIENT=""
 INSTALL_CACHELXDIMAGES=""
 OSM_DEVOPS=
@@ -868,11 +877,13 @@ while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o;
             [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
             [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue
             [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue
-            [ "${OPTARG}" == "nolxd" ] && INSTALL_NOLXD="y" && continue
+            [ "${OPTARG}" == "lxd" ] && INSTALL_LXD="y" && continue
+            [ "${OPTARG}" == "nolxd" ] && INSTALL_LXD="" && continue
             [ "${OPTARG}" == "nodocker" ] && INSTALL_NODOCKER="y" && continue
             [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
             [ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue
-            [ "${OPTARG}" == "nojuju" ] && INSTALL_NOJUJU="--nojuju" && continue
+            [ "${OPTARG}" == "juju" ] && INSTALL_JUJU="y" && continue
+            [ "${OPTARG}" == "nojuju" ] && INSTALL_JUJU="" && continue
             [ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue
             [ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue
             [ "${OPTARG}" == "pullimages" ] && continue
@@ -880,7 +891,6 @@ while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o;
             [ "${OPTARG}" == "charmed" ] && CHARMED="y" && OSM_INSTALLATION_TYPE="Charmed" && continue
             [ "${OPTARG}" == "bundle" ] && continue
             [ "${OPTARG}" == "k8s" ] && continue
-            [ "${OPTARG}" == "lxd" ] && continue
             [ "${OPTARG}" == "lxd-cred" ] && continue
             [ "${OPTARG}" == "microstack" ] && continue
             [ "${OPTARG}" == "overlay" ] && continue
index 11c5baa..b714f50 100644 (file)
@@ -65,11 +65,13 @@ spec:
           envFrom:
             - configMapRef:
                 name: {{ include "osm.fullname" . }}-lcm-configmap
-          {{- if not .Values.lcm.useOsmSecret }}
+            {{- if not .Values.lcm.useOsmSecret }}
             - secretRef:
                 name: {{ .Values.lcm.secretName | default "lcm-secret" }}
-          {{- end }}
+            {{- end }}
+          {{- if or .Values.vca.enabled .Values.lcm.useOsmSecret }}
           env:
+            {{- if .Values.vca.enabled }}
             - name: OSMLCM_VCA_HOST
               valueFrom:
                 secretKeyRef:
@@ -90,12 +92,14 @@ spec:
                 secretKeyRef:
                   name: {{ include "osm.fullname" . }}-vca-secret
                   key: OSM_VCA_CACERT
-          {{- if .Values.lcm.useOsmSecret }}
+            {{- end }}
+            {{- if .Values.lcm.useOsmSecret }}
             - name: OSMLCM_DATABASE_COMMONKEY
               valueFrom:
                 secretKeyRef:
                   name: {{ include "osm.fullname" . }}-secret
                   key: OSM_DATABASE_COMMONKEY
+            {{- end }}
           {{- end }}
           volumeMounts:
             - mountPath: /etc/ssl/certs/osm-ca.crt
index 6d70356..04bb6b2 100644 (file)
@@ -76,7 +76,9 @@ spec:
             - secretRef:
                 name: {{ .Values.mon.secretName | default "mon-secret" }}
           {{- end }}
+          {{- if or .Values.vca.enabled .Values.mon.useOsmSecret }}
           env:
+            {{- if .Values.vca.enabled }}
             - name: OSMMON_VCA_HOST
               valueFrom:
                 secretKeyRef:
@@ -92,12 +94,14 @@ spec:
                 secretKeyRef:
                   name: {{ include "osm.fullname" . }}-vca-secret
                   key: OSM_VCA_CACERT
-          {{- if .Values.mon.useOsmSecret }}
+            {{- end }}
+            {{- if .Values.mon.useOsmSecret }}
             - name: OSMMON_DATABASE_COMMONKEY
               valueFrom:
                 secretKeyRef:
                   name: {{ include "osm.fullname" . }}-secret
                   key: OSM_DATABASE_COMMONKEY
+            {{- end }}
           {{- end }}
       {{- with .Values.global.nodeSelector }}
       nodeSelector:
index f4683f2..7b0538e 100644 (file)
@@ -195,7 +195,7 @@ ro:
   # secretName: "ro-secret"
 
 vca:
-  enabled: true
+  enabled: false
   # host: ""
   # secret: ""
   # cacert: ""
index f00443f..7be5f99 100755 (executable)
@@ -29,7 +29,6 @@ function usage(){
     echo -e "     -K:             Specifies the name of the controller to use - The controller must be already bootstrapped"
     echo -e "     --debug:        debug mode"
     echo -e "     --cachelxdimages:  cache local lxd images, create cronjob for that cache (will make installation longer)"
-    echo -e "     --nojuju:       do not juju, assumes already installed"
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
@@ -195,7 +194,6 @@ while getopts ":D:i:s:H:l:L:K:-: hP" o; do
         -)
             [ "${OPTARG}" == "help" ] && usage && exit 0
             [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue
-            [ "${OPTARG}" == "nojuju" ] && INSTALL_NOJUJU="y" && continue
             [ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="y" && continue
             echo -e "Invalid option: '--$OPTARG'\n" >&2
             usage && exit 1
index e3a99b9..90cd9f7 100644 (file)
@@ -569,7 +569,10 @@ node("${params.NODE}") {
                         // Run -k8s installer here specifying internal docker registry and docker proxy
                         osm_installation_options = ""
                         if (params.TRY_OLD_SERVICE_ASSURANCE) {
-                            osm_installation_options = "--old-sa"
+                            osm_installation_options = "${osm_installation_options} --old-sa"
+                        }
+                        if (params.TRY_JUJU_INSTALLATION) {
+                            osm_installation_options = "${osm_installation_options} --juju --lxd"
                         }
                         withCredentials([gitlabCredentialsMap]) {
                             sshCommand remote: remote, command: """