Use OSM bundles from CharmHub 06/11706/2
authorDavid Garcia <david.garcia@canonical.com>
Wed, 23 Feb 2022 16:00:31 +0000 (17:00 +0100)
committerbeierlm <mark.beierl@canonical.com>
Thu, 24 Feb 2022 20:23:31 +0000 (15:23 -0500)
Change-Id: I88a1c3c7b6d7118b6879a0a5b145fd14f86d9100
Signed-off-by: David Garcia <david.garcia@canonical.com>
installers/charm/bundles/.gitignore [new file with mode: 0644]
installers/charm/bundles/osm-ha/README.md
installers/charm/bundles/osm-ha/bundle.yaml
installers/charm/bundles/osm-ha/charmcraft.yaml [new file with mode: 0644]
installers/charm/bundles/osm/bundle.yaml
installers/charm/bundles/osm/charmcraft.yaml [new file with mode: 0644]
installers/charmed_install.sh

diff --git a/installers/charm/bundles/.gitignore b/installers/charm/bundles/.gitignore
new file mode 100644 (file)
index 0000000..00b9f63
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright 2022 ETSI
+#
+# 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.
+
+*.zip
+*build/
\ No newline at end of file
index 8a60592..da834a7 100644 (file)
@@ -1,5 +1,5 @@
 <!--
- Copyright 2020 Canonical Ltd.
+ Copyright 2022 Canonical Ltd.
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-# Installation
-
-Go to the [OSM User Guide](https://osm.etsi.org/docs/user-guide/03-installing-osm.html#charmed-installation) for the highly available production-grade deployment.
-For a more minimal cluster suitable for testing, deploy the [single instance OSM bundle](https://jaas.ai/osm/bundle).
+# Charmed OSM
 
 # Bundle Components
 
 - [grafana](https://jaas.ai/u/charmed-osm/grafana/0): A CAAS charm to deploy grafana for metrics visualization
-- [kafka k8s](https://jaas.ai/u/charmed-osm/kafka-k8s): A CAAS charm to deploy Kafka used as a messaging bus between OSM components
+- [kafka k8s](https://charmhub.io/kafka-k8s): A CAAS charm to deploy Kafka used as a messaging bus between OSM components
 - [lcm](https://jaas.ai/u/charmed-osm/lcm/0): A CAAS charm to deploy OSM's Lifecycle Management (LCM) component responsible for network services orchestration.
 - [mariadb k8s](https://jaas.ai/u/charmed-osm/mariadb-k8s): A Juju charm deploying and managing database server (MariaDB) on Kubernetes
 - [mon](https://jaas.ai/u/charmed-osm/mon/0): A CAAS charm to deploy OSM's Monitoring Interface (MON) responsible for metrics collection
@@ -39,8 +36,4 @@ If you have any trouble with the installation, please contact us, we will be gla
 
 You can directly contact the team:
 
-- David GarcĂ­a ([david.garcia@canonical.com](david.garcia@canonical.com))
-- Eduardo Sousa ([eduardo.sousa@canonical.com](eduardo.sousa@canonical.com))
-- Mark Beierl ([mark.beierl@canonical.com](mark.beierl@canonical.com))
-- Guillermo Calvino ([guillermo.calvino@canonical.com](guillermo.calvino@canonical.com))
-- Wajeeha Hamid ([wajeeha.hamid@canonical.com](wajeeha.hamid@canonical.com))
+- 
\ No newline at end of file
index 0909160..9d3f312 100644 (file)
@@ -11,6 +11,8 @@
 #     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.
+name: osm-ha
+bundle: kubernetes
 description: |
   **A high-available Charmed OSM cluster**
 
@@ -26,23 +28,28 @@ description: |
   - Highly Available and resilient against failures
   - Supported with Ubuntu Advantage
   - Availability of managed services
-bundle: kubernetes
 applications:
-  zookeeper-k8s:
-    charm: "cs:~charmed-osm/zookeeper-k8s"
-    channel: "stable"
+  zookeeper:
+    charm: zookeeper-k8s
+    channel: latest/edge
     scale: 3
-    series: kubernetes
     storage:
-      database: 100M
-    options:
-      zookeeper-units: 3
+      data: 100M
     annotations:
       gui-x: 0
       gui-y: 500
-  mariadb-k8s:
-    charm: "cs:~charmed-osm/mariadb-k8s"
-    channel: "stable"
+  kafka:
+    charm: kafka-k8s
+    channel: latest/edge
+    scale: 3
+    trust: true
+    storage:
+      data: 100M
+    annotations:
+      gui-x: 0
+      gui-y: 250
+  mariadb:
+    charm: charmed-osm-mariadb-k8s
     scale: 3
     series: kubernetes
     storage:
@@ -55,21 +62,9 @@ applications:
     annotations:
       gui-x: -300
       gui-y: -250
-  kafka-k8s:
-    charm: "cs:~charmed-osm/kafka-k8s"
-    channel: "stable"
-    scale: 3
-    series: kubernetes
-    storage:
-      database: 100M
-    options:
-      zookeeper-units: 3
-      kafka-units: 3
-    annotations:
-      gui-x: 0
-      gui-y: 250
   mongodb:
-    charm: ch:mongodb-k8s
+    charm: mongodb-k8s
+    channel: latest/stable
     scale: 3
     series: kubernetes
     storage:
@@ -78,73 +73,95 @@ applications:
       gui-x: 0
       gui-y: 0
   nbi:
-    charm: "cs:~charmed-osm/nbi-13"
+    charm: osm-nbi
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       database_commonkey: osm
       auth_backend: keystone
       log_level: DEBUG
+    resources:
+      image: opensourcemano/nbi:10.0.3
     annotations:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-5"
+    charm: osm-ro
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/ro:10.0.3
     annotations:
       gui-x: -300
       gui-y: 250
   ng-ui:
-    charm: "cs:~charmed-osm/ng-ui-22"
+    charm: osm-ng-ui
+    channel: latest/edge
     scale: 3
     series: kubernetes
+    resources:
+      image: opensourcemano/ng-ui:10.0.3
     annotations:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-9"
+    charm: osm-lcm
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
+    resources:
+      image: opensourcemano/lcm:10.0.3
     annotations:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-6"
+    charm: osm-mon
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
       keystone_enabled: true
+    resources:
+      image: opensourcemano/mon:10.0.3
     annotations:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-5"
+    charm: osm-pol
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pol:10.0.3
     annotations:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-10"
+    charm: osm-pla
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pla:10.0.3
     annotations:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-5"
+    charm: osm-prometheus
+    channel: latest/edge
     scale: 1
     series: kubernetes
     storage:
@@ -155,52 +172,55 @@ applications:
       gui-x: 300
       gui-y: 250
   grafana:
-    charm: "cs:~charmed-osm/grafana-5"
+    charm: osm-grafana
+    channel: latest/edge
     scale: 3
     series: kubernetes
     annotations:
       gui-x: 300
       gui-y: 500
   keystone:
-    charm: "cs:~charmed-osm/keystone-11"
+    charm: osm-keystone
+    channel: latest/edge
     scale: 1
-    series: kubernetes
+    resources:
+      keystone-image: opensourcemano/keystone:releaseten-daily
     annotations:
       gui-x: 300
       gui-y: -250
 relations:
   - - grafana:prometheus
     - prometheus:prometheus
-  - - kafka-k8s:zookeeper
-    - zookeeper-k8s:zookeeper
+  - - kafka:zookeeper
+    - zookeeper:zookeeper
   - - keystone:db
-    - mariadb-k8s:mysql
+    - mariadb:mysql
   - - lcm:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - lcm:mongodb
     - mongodb:database
   - - ro:ro
     - lcm:ro
   - - ro:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - ro:mongodb
     - mongodb:database
   - - pol:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pol:mongodb
     - mongodb:database
   - - mon:mongodb
     - mongodb:database
   - - mon:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pla:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pla:mongodb
     - mongodb:database
   - - nbi:mongodb
     - mongodb:database
   - - nbi:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - nbi:prometheus
     - prometheus:prometheus
   - - nbi:keystone
@@ -211,5 +231,7 @@ relations:
     - nbi:nbi
   - - mon:keystone
     - keystone:keystone
-  - - mariadb-k8s:mysql
+  - - mariadb:mysql
     - pol:mysql
+  - - grafana:db
+    - mariadb:mysql
diff --git a/installers/charm/bundles/osm-ha/charmcraft.yaml b/installers/charm/bundles/osm-ha/charmcraft.yaml
new file mode 100644 (file)
index 0000000..111b05c
--- /dev/null
@@ -0,0 +1,14 @@
+# Copyright 2022 Canonical Ltd.
+#
+# 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.
+type: bundle
index bdd4cd6..548ecd2 100644 (file)
@@ -11,6 +11,8 @@
 #     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.
+name: osm
+bundle: kubernetes
 description: |
   **Single instance Charmed OSM**
 
@@ -25,21 +27,28 @@ description: |
   - Stable and secure
   - Supported with Ubuntu Advantage
   - Availability of managed services
-bundle: kubernetes
 applications:
-  zookeeper-k8s:
-    charm: "cs:~charmed-osm/zookeeper-k8s"
-    channel: "stable"
+  zookeeper:
+    charm: zookeeper-k8s
+    channel: latest/edge
     scale: 1
-    series: kubernetes
     storage:
-      database: 100M
+      data: 100M
     annotations:
       gui-x: 0
       gui-y: 500
-  mariadb-k8s:
-    charm: "cs:~charmed-osm/mariadb-k8s"
-    channel: "stable"
+  kafka:
+    charm: kafka-k8s
+    channel: latest/edge
+    scale: 1
+    trust: true
+    storage:
+      data: 100M
+    annotations:
+      gui-x: 0
+      gui-y: 250
+  mariadb:
+    charm: charmed-osm-mariadb-k8s
     scale: 1
     series: kubernetes
     storage:
@@ -51,18 +60,9 @@ applications:
     annotations:
       gui-x: -300
       gui-y: -250
-  kafka-k8s:
-    charm: "cs:~charmed-osm/kafka-k8s"
-    channel: "stable"
-    scale: 1
-    series: kubernetes
-    storage:
-      database: 100M
-    annotations:
-      gui-x: 0
-      gui-y: 250
   mongodb:
-    charm: ch:mongodb-k8s
+    charm: mongodb-k8s
+    channel: latest/stable
     scale: 1
     series: kubernetes
     storage:
@@ -71,73 +71,95 @@ applications:
       gui-x: 0
       gui-y: 0
   nbi:
-    charm: "cs:~charmed-osm/nbi-13"
+    charm: osm-nbi
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       auth_backend: keystone
       log_level: DEBUG
+    resources:
+      image: opensourcemano/nbi:10.0.3
     annotations:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-5"
+    charm: osm-ro
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/ro:10.0.3
     annotations:
       gui-x: -300
       gui-y: 250
   ng-ui:
-    charm: "cs:~charmed-osm/ng-ui-22"
+    charm: osm-ng-ui
+    channel: latest/edge
     scale: 1
     series: kubernetes
+    resources:
+      image: opensourcemano/ng-ui:10.0.3
     annotations:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-9"
+    charm: osm-lcm
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
+    resources:
+      image: opensourcemano/lcm:10.0.3
     annotations:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-6"
+    charm: osm-mon
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
       keystone_enabled: true
+    resources:
+      image: opensourcemano/mon:10.0.3
     annotations:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-5"
+    charm: osm-pol
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pol:10.0.3
     annotations:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-10"
+    charm: osm-pla
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pla:10.0.3
     annotations:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-5"
+    charm: osm-prometheus
+    channel: latest/edge
     scale: 1
     series: kubernetes
     storage:
@@ -148,52 +170,55 @@ applications:
       gui-x: 300
       gui-y: 250
   grafana:
-    charm: "cs:~charmed-osm/grafana-5"
+    charm: osm-grafana
+    channel: latest/edge
     scale: 1
     series: kubernetes
     annotations:
       gui-x: 300
       gui-y: 500
   keystone:
-    charm: "cs:~charmed-osm/keystone-11"
+    charm: osm-keystone
+    channel: latest/edge
     scale: 1
-    series: kubernetes
+    resources:
+      keystone-image: opensourcemano/keystone:releaseten-daily
     annotations:
       gui-x: 300
       gui-y: -250
 relations:
   - - grafana:prometheus
     - prometheus:prometheus
-  - - kafka-k8s:zookeeper
-    - zookeeper-k8s:zookeeper
+  - - kafka:zookeeper
+    - zookeeper:zookeeper
   - - keystone:db
-    - mariadb-k8s:mysql
+    - mariadb:mysql
   - - lcm:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - lcm:mongodb
     - mongodb:database
   - - ro:ro
     - lcm:ro
   - - ro:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - ro:mongodb
     - mongodb:database
   - - pol:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pol:mongodb
     - mongodb:database
   - - mon:mongodb
     - mongodb:database
   - - mon:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pla:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - pla:mongodb
     - mongodb:database
   - - nbi:mongodb
     - mongodb:database
   - - nbi:kafka
-    - kafka-k8s:kafka
+    - kafka:kafka
   - - nbi:prometheus
     - prometheus:prometheus
   - - nbi:keystone
@@ -204,5 +229,7 @@ relations:
     - nbi:nbi
   - - mon:keystone
     - keystone:keystone
-  - - mariadb-k8s:mysql
+  - - mariadb:mysql
     - pol:mysql
+  - - grafana:db
+    - mariadb:mysql
diff --git a/installers/charm/bundles/osm/charmcraft.yaml b/installers/charm/bundles/osm/charmcraft.yaml
new file mode 100644 (file)
index 0000000..111b05c
--- /dev/null
@@ -0,0 +1,14 @@
+# Copyright 2022 Canonical Ltd.
+#
+# 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.
+type: bundle
index 25c9806..fcb8c25 100755 (executable)
@@ -27,15 +27,11 @@ PATH=/snap/bin:${PATH}
 
 MODEL_NAME=osm
 
-# Latest bundles using old mongodb-k8s
-# OSM_BUNDLE=cs:osm-68
-# OSM_HA_BUNDLE=cs:osm-ha-54
-# The charm store does not support referencing charms from CharmHub,
-# therefore we will point to the local bundles until we migrate all
-# charms to CharmHub.
-OSM_BUNDLE=/usr/share/osm-devops/installers/charm/bundles/osm/bundle.yaml
-OSM_HA_BUNDLE=/usr/share/osm-devops/installers/charm/bundles/osm-ha/bundle.yaml
-TAG=10
+
+OSM_BUNDLE=ch:osm
+OSM_HA_BUNDLE=ch:osm-ha
+CHARMHUB_CHANNEL=10.0/edge
+unset TAG
 
 function check_arguments(){
     while [ $# -gt 0 ] ; do
@@ -60,16 +56,16 @@ function check_arguments(){
 
 function install_snaps(){
     if [ ! -v KUBECFG ]; then
+        KUBEGRP="microk8s"
         sudo snap install microk8s --classic --channel=${MICROK8S_VERSION}/stable
+        sudo usermod -a -G microk8s `whoami`
         sudo cat /var/snap/microk8s/current/args/kube-apiserver | grep advertise-address || (
                 echo "--advertise-address $DEFAULT_IP" | sudo tee -a /var/snap/microk8s/current/args/kube-apiserver
-                microk8s.stop
-                microk8s.start
+                sg ${KUBEGRP} -c microk8s.stop
+                sg ${KUBEGRP} -c microk8s.start
             )
-        sudo usermod -a -G microk8s `whoami`
         mkdir -p ~/.kube
         sudo chown -f -R `whoami` ~/.kube
-        KUBEGRP="microk8s"
         sg ${KUBEGRP} -c "microk8s status --wait-ready"
         KUBECONFIG=~/.osm/microk8s-config.yaml
         sg ${KUBEGRP} -c "microk8s config" | tee ${KUBECONFIG}
@@ -263,9 +259,9 @@ function deploy_charmed_osm(){
     fi
 
     if [ -v BUNDLE ]; then
-        juju deploy -m $MODEL_NAME $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay
+        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay
     else
-        juju deploy -m $MODEL_NAME $OSM_BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay
+        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $OSM_BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay
     fi
 
     if [ ! -v KUBECFG ]; then
@@ -357,7 +353,7 @@ EOF
 function generate_images_overlay(){
     echo "applications:" > /tmp/images-overlay.yaml
 
-    charms_with_resources="nbi lcm mon pol ng-ui ro pla keystone"
+    charms_with_resources="nbi lcm mon pol ng-ui ro pla"
     for charm in $charms_with_resources; do
         cat << EOF > /tmp/${charm}_registry.yaml
 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
@@ -372,6 +368,23 @@ EOF
     resources:
       image: /tmp/${charm}_registry.yaml
 
+EOF
+    done
+    ch_charms_with_resources="keystone"
+    for charm in $ch_charms_with_resources; do
+        cat << EOF > /tmp/${charm}_registry.yaml
+registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
+EOF
+        if [ ! -z "$REGISTRY_USERNAME" ] ; then
+            echo username: $REGISTRY_USERNAME >> /tmp/${charm}_registry.yaml
+            echo password: $REGISTRY_PASSWORD >> /tmp/${charm}_registry.yaml
+        fi
+
+        cat << EOF >> /tmp/images-overlay.yaml
+  ${charm}:
+    resources:
+      ${charm}-image: /tmp/${charm}_registry.yaml
+
 EOF
     done