Use OSM bundles from CharmHub 04/11704/3
authorDavid Garcia <david.garcia@canonical.com>
Tue, 22 Feb 2022 19:14:13 +0000 (20:14 +0100)
committerbeierlm <mark.beierl@canonical.com>
Thu, 24 Feb 2022 20:00:58 +0000 (15:00 -0500)
Change-Id: I5e055b0558c445deeb2b6df9fad4e6a42fe25544
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 752cf56..e22540b 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:
-    charm: "cs:~charmed-osm/zookeeper-1"
-    channel: "stable"
+    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:
-    charm: "cs:~charmed-osm/kafka-1"
-    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-18"
+    charm: osm-nbi
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       database_commonkey: osm
       auth_backend: keystone
       log_level: DEBUG
+    resources:
+      image: opensourcemano/nbi:11.0.1
     annotations:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-10"
+    charm: osm-ro
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/ro:11.0.1
     annotations:
       gui-x: -300
       gui-y: 250
   ng-ui:
-    charm: "cs:~charmed-osm/ng-ui-25"
+    charm: osm-ng-ui
+    channel: latest/edge
     scale: 3
     series: kubernetes
+    resources:
+      image: opensourcemano/ng-ui:11.0.1
     annotations:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-15"
+    charm: osm-lcm
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
+    resources:
+      image: opensourcemano/lcm:11.0.1
     annotations:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-12"
+    charm: osm-mon
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
       keystone_enabled: true
+    resources:
+      image: opensourcemano/mon:11.0.1
     annotations:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-10"
+    charm: osm-pol
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pol:11.0.1
     annotations:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-13"
+    charm: osm-pla
+    channel: latest/edge
     scale: 3
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pla:11.0.1
     annotations:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-9"
+    charm: osm-prometheus
+    channel: latest/edge
     scale: 1
     series: kubernetes
     storage:
@@ -155,16 +172,19 @@ applications:
       gui-x: 300
       gui-y: 250
   grafana:
-    charm: "cs:~charmed-osm/grafana-10"
+    charm: osm-grafana
+    channel: latest/edge
     scale: 3
     series: kubernetes
     annotations:
       gui-x: 300
       gui-y: 500
   keystone:
-    charm: "cs:~charmed-osm/keystone-16"
+    charm: osm-keystone
+    channel: latest/edge
     scale: 1
-    series: kubernetes
+    resources:
+      keystone-image: opensourcemano/keystone:releaseeleven-daily
     annotations:
       gui-x: 300
       gui-y: -250
@@ -174,7 +194,7 @@ relations:
   - - kafka:zookeeper
     - zookeeper:zookeeper
   - - keystone:db
-    - mariadb-k8s:mysql
+    - mariadb:mysql
   - - lcm:kafka
     - kafka:kafka
   - - lcm:mongodb
@@ -211,7 +231,7 @@ relations:
     - nbi:nbi
   - - mon:keystone
     - keystone:keystone
-  - - mariadb-k8s:mysql
+  - - mariadb:mysql
     - pol:mysql
   - - grafana:db
-    - mariadb-k8s:mysql
+    - 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 9031388..421b57f 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,20 +27,28 @@ description: |
   - Stable and secure
   - Supported with Ubuntu Advantage
   - Availability of managed services
-bundle: kubernetes
 applications:
   zookeeper:
-    charm: "cs:~charmed-osm/zookeeper-1"
+    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:
@@ -50,17 +60,9 @@ applications:
     annotations:
       gui-x: -300
       gui-y: -250
-  kafka:
-    charm: "cs:~charmed-osm/kafka-1"
-    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:
@@ -69,73 +71,95 @@ applications:
       gui-x: 0
       gui-y: 0
   nbi:
-    charm: "cs:~charmed-osm/nbi-18"
+    charm: osm-nbi
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       auth_backend: keystone
       log_level: DEBUG
+    resources:
+      image: opensourcemano/nbi:11.0.1
     annotations:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-10"
+    charm: osm-ro
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/ro:11.0.1
     annotations:
       gui-x: -300
       gui-y: 250
   ng-ui:
-    charm: "cs:~charmed-osm/ng-ui-25"
+    charm: osm-ng-ui
+    channel: latest/edge
     scale: 1
     series: kubernetes
+    resources:
+      image: opensourcemano/ng-ui:11.0.1
     annotations:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-15"
+    charm: osm-lcm
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
+    resources:
+      image: opensourcemano/lcm:11.0.1
     annotations:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-12"
+    charm: osm-mon
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       database_commonkey: osm
       log_level: DEBUG
       keystone_enabled: true
+    resources:
+      image: opensourcemano/mon:11.0.1
     annotations:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-10"
+    charm: osm-pol
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pol:11.0.1
     annotations:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-13"
+    charm: osm-pla
+    channel: latest/edge
     scale: 1
     series: kubernetes
     options:
       log_level: DEBUG
+    resources:
+      image: opensourcemano/pla:11.0.1
     annotations:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-9"
+    charm: osm-prometheus
+    channel: latest/edge
     scale: 1
     series: kubernetes
     storage:
@@ -146,16 +170,19 @@ applications:
       gui-x: 300
       gui-y: 250
   grafana:
-    charm: "cs:~charmed-osm/grafana-10"
+    charm: osm-grafana
+    channel: latest/edge
     scale: 1
     series: kubernetes
     annotations:
       gui-x: 300
       gui-y: 500
   keystone:
-    charm: "cs:~charmed-osm/keystone-16"
+    charm: osm-keystone
+    channel: latest/edge
     scale: 1
-    series: kubernetes
+    resources:
+      keystone-image: opensourcemano/keystone:releaseeleven-daily
     annotations:
       gui-x: 300
       gui-y: -250
@@ -165,7 +192,7 @@ relations:
   - - kafka:zookeeper
     - zookeeper:zookeeper
   - - keystone:db
-    - mariadb-k8s:mysql
+    - mariadb:mysql
   - - lcm:kafka
     - kafka:kafka
   - - lcm:mongodb
@@ -202,7 +229,7 @@ relations:
     - nbi:nbi
   - - mon:keystone
     - keystone:keystone
-  - - mariadb-k8s:mysql
+  - - mariadb:mysql
     - pol:mysql
   - - grafana:db
-    - mariadb-k8s:mysql
+    - 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 e11b2b5..81ede58 100755 (executable)
@@ -27,15 +27,10 @@ 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=11
+OSM_BUNDLE=ch:osm
+OSM_HA_BUNDLE=ch:osm-ha
+CHARMHUB_CHANNEL=11.0/edge
+unset TAG
 
 function check_arguments(){
     while [ $# -gt 0 ] ; do
@@ -60,16 +55,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 +258,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
@@ -361,7 +356,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
@@ -376,6 +371,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