From: David Garcia Date: Mon, 28 Jun 2021 14:50:42 +0000 (+0200) Subject: Feature 10884: Juju 2.9 support X-Git-Tag: v10.1.0-rc1~17 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F21%2F11621%2F1;p=osm%2Fdevops.git Feature 10884: Juju 2.9 support OSM LTS Support - Update osm bundles (charmed) - Update Juju version (snap and agent version) (charmed and k8s) - Update to new mongodb charm (charmed and k8s) - Fix ingress issue by adding an ingress_class config - Charmed installer: point to local bundles until all charms are in CharmHub Change-Id: I6ff8328e5db6719bbf9d5d4c9b5490f478b2ace8 Signed-off-by: David Garcia --- diff --git a/installers/charm/bundles/osm-ha/bundle.yaml b/installers/charm/bundles/osm-ha/bundle.yaml index f48bae2a..0909160e 100644 --- a/installers/charm/bundles/osm-ha/bundle.yaml +++ b/installers/charm/bundles/osm-ha/bundle.yaml @@ -68,22 +68,17 @@ applications: annotations: gui-x: 0 gui-y: 250 - mongodb-k8s: - charm: "cs:~charmed-osm/mongodb-k8s" - channel: "stable" + mongodb: + charm: ch:mongodb-k8s scale: 3 series: kubernetes storage: - database: 50M - options: - replica-set: rs0 - namespace: osm - enable-sidecar: true + db: 50M annotations: gui-x: 0 gui-y: 0 nbi: - charm: "cs:~charmed-osm/nbi-12" + charm: "cs:~charmed-osm/nbi-13" scale: 3 series: kubernetes options: @@ -94,7 +89,7 @@ applications: gui-x: 0 gui-y: -250 ro: - charm: "cs:~charmed-osm/ro-4" + charm: "cs:~charmed-osm/ro-5" scale: 3 series: kubernetes options: @@ -103,14 +98,14 @@ applications: gui-x: -300 gui-y: 250 ng-ui: - charm: "cs:~charmed-osm/ng-ui-21" + charm: "cs:~charmed-osm/ng-ui-22" scale: 3 series: kubernetes annotations: gui-x: 600 gui-y: 0 lcm: - charm: "cs:~charmed-osm/lcm-8" + charm: "cs:~charmed-osm/lcm-9" scale: 3 series: kubernetes options: @@ -120,7 +115,7 @@ applications: gui-x: -300 gui-y: 0 mon: - charm: "cs:~charmed-osm/mon-5" + charm: "cs:~charmed-osm/mon-6" scale: 1 series: kubernetes options: @@ -131,7 +126,7 @@ applications: gui-x: 300 gui-y: 0 pol: - charm: "cs:~charmed-osm/pol-4" + charm: "cs:~charmed-osm/pol-5" scale: 3 series: kubernetes options: @@ -140,7 +135,7 @@ applications: gui-x: -300 gui-y: 500 pla: - charm: "cs:~charmed-osm/pla-9" + charm: "cs:~charmed-osm/pla-10" scale: 3 series: kubernetes options: @@ -149,7 +144,7 @@ applications: gui-x: 600 gui-y: -250 prometheus: - charm: "cs:~charmed-osm/prometheus-4" + charm: "cs:~charmed-osm/prometheus-5" scale: 1 series: kubernetes storage: @@ -160,14 +155,14 @@ applications: gui-x: 300 gui-y: 250 grafana: - charm: "cs:~charmed-osm/grafana-4" + charm: "cs:~charmed-osm/grafana-5" scale: 3 series: kubernetes annotations: gui-x: 300 gui-y: 500 keystone: - charm: "cs:~charmed-osm/keystone-9" + charm: "cs:~charmed-osm/keystone-11" scale: 1 series: kubernetes annotations: @@ -183,27 +178,27 @@ relations: - - lcm:kafka - kafka-k8s:kafka - - lcm:mongodb - - mongodb-k8s:mongo + - mongodb:database - - ro:ro - lcm:ro - - ro:kafka - kafka-k8s:kafka - - ro:mongodb - - mongodb-k8s:mongo + - mongodb:database - - pol:kafka - kafka-k8s:kafka - - pol:mongodb - - mongodb-k8s:mongo + - mongodb:database - - mon:mongodb - - mongodb-k8s:mongo + - mongodb:database - - mon:kafka - kafka-k8s:kafka - - pla:kafka - kafka-k8s:kafka - - pla:mongodb - - mongodb-k8s:mongo + - mongodb:database - - nbi:mongodb - - mongodb-k8s:mongo + - mongodb:database - - nbi:kafka - kafka-k8s:kafka - - nbi:prometheus diff --git a/installers/charm/bundles/osm/bundle.yaml b/installers/charm/bundles/osm/bundle.yaml index c6ba49e1..bdd4cd63 100644 --- a/installers/charm/bundles/osm/bundle.yaml +++ b/installers/charm/bundles/osm/bundle.yaml @@ -61,22 +61,17 @@ applications: annotations: gui-x: 0 gui-y: 250 - mongodb-k8s: - charm: "cs:~charmed-osm/mongodb-k8s" - channel: "stable" + mongodb: + charm: ch:mongodb-k8s scale: 1 series: kubernetes storage: - database: 50M - options: - replica-set: rs0 - namespace: osm - enable-sidecar: true + db: 50M annotations: gui-x: 0 gui-y: 0 nbi: - charm: "cs:~charmed-osm/nbi-12" + charm: "cs:~charmed-osm/nbi-13" scale: 1 series: kubernetes options: @@ -87,7 +82,7 @@ applications: gui-x: 0 gui-y: -250 ro: - charm: "cs:~charmed-osm/ro-4" + charm: "cs:~charmed-osm/ro-5" scale: 1 series: kubernetes options: @@ -96,14 +91,14 @@ applications: gui-x: -300 gui-y: 250 ng-ui: - charm: "cs:~charmed-osm/ng-ui-21" + charm: "cs:~charmed-osm/ng-ui-22" scale: 1 series: kubernetes annotations: gui-x: 600 gui-y: 0 lcm: - charm: "cs:~charmed-osm/lcm-8" + charm: "cs:~charmed-osm/lcm-9" scale: 1 series: kubernetes options: @@ -113,7 +108,7 @@ applications: gui-x: -300 gui-y: 0 mon: - charm: "cs:~charmed-osm/mon-5" + charm: "cs:~charmed-osm/mon-6" scale: 1 series: kubernetes options: @@ -124,7 +119,7 @@ applications: gui-x: 300 gui-y: 0 pol: - charm: "cs:~charmed-osm/pol-4" + charm: "cs:~charmed-osm/pol-5" scale: 1 series: kubernetes options: @@ -133,7 +128,7 @@ applications: gui-x: -300 gui-y: 500 pla: - charm: "cs:~charmed-osm/pla-9" + charm: "cs:~charmed-osm/pla-10" scale: 1 series: kubernetes options: @@ -142,7 +137,7 @@ applications: gui-x: 600 gui-y: -250 prometheus: - charm: "cs:~charmed-osm/prometheus-4" + charm: "cs:~charmed-osm/prometheus-5" scale: 1 series: kubernetes storage: @@ -153,14 +148,14 @@ applications: gui-x: 300 gui-y: 250 grafana: - charm: "cs:~charmed-osm/grafana-4" + charm: "cs:~charmed-osm/grafana-5" scale: 1 series: kubernetes annotations: gui-x: 300 gui-y: 500 keystone: - charm: "cs:~charmed-osm/keystone-9" + charm: "cs:~charmed-osm/keystone-11" scale: 1 series: kubernetes annotations: @@ -176,27 +171,27 @@ relations: - - lcm:kafka - kafka-k8s:kafka - - lcm:mongodb - - mongodb-k8s:mongo + - mongodb:database - - ro:ro - lcm:ro - - ro:kafka - kafka-k8s:kafka - - ro:mongodb - - mongodb-k8s:mongo + - mongodb:database - - pol:kafka - kafka-k8s:kafka - - pol:mongodb - - mongodb-k8s:mongo + - mongodb:database - - mon:mongodb - - mongodb-k8s:mongo + - mongodb:database - - mon:kafka - kafka-k8s:kafka - - pla:kafka - kafka-k8s:kafka - - pla:mongodb - - mongodb-k8s:mongo + - mongodb:database - - nbi:mongodb - - mongodb-k8s:mongo + - mongodb:database - - nbi:kafka - kafka-k8s:kafka - - nbi:prometheus diff --git a/installers/charm/grafana/config.yaml b/installers/charm/grafana/config.yaml index 19274e53..3a7e63fc 100644 --- a/installers/charm/grafana/config.yaml +++ b/installers/charm/grafana/config.yaml @@ -27,6 +27,11 @@ options: of Keystone, it may need to be configured to handle the requested size. Note: if set to 0, there is no limit. default: 0 + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/grafana/src/charm.py b/installers/charm/grafana/src/charm.py index bf6fbd9d..28be79aa 100755 --- a/installers/charm/grafana/src/charm.py +++ b/installers/charm/grafana/src/charm.py @@ -51,6 +51,7 @@ class ConfigModel(ModelValidator): osm_dashboards: bool site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] @@ -174,8 +175,10 @@ class GrafanaCharm(CharmedOsmBase): str(config.max_file_size) + "m" if config.max_file_size > 0 else config.max_file_size - ), + ) } + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/kafka-exporter/config.yaml b/installers/charm/kafka-exporter/config.yaml index 8d3703e4..706e330d 100644 --- a/installers/charm/kafka-exporter/config.yaml +++ b/installers/charm/kafka-exporter/config.yaml @@ -20,6 +20,11 @@ ## options: + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/kafka-exporter/src/charm.py b/installers/charm/kafka-exporter/src/charm.py index 123fa0b2..a15abc84 100755 --- a/installers/charm/kafka-exporter/src/charm.py +++ b/installers/charm/kafka-exporter/src/charm.py @@ -49,6 +49,7 @@ PORT = 9308 class ConfigModel(ModelValidator): site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] @@ -195,6 +196,8 @@ class KafkaExporterCharm(CharmedOsmBase): if config.site_url: parsed = urlparse(config.site_url) annotations = {} + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/keystone/config.yaml b/installers/charm/keystone/config.yaml index 402096ca..9a7acd5e 100644 --- a/installers/charm/keystone/config.yaml +++ b/installers/charm/keystone/config.yaml @@ -20,6 +20,11 @@ options: If there is a reverse proxy in front of Keystone, it may need to be configured to handle the requested size. default: 5 + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/keystone/src/charm.py b/installers/charm/keystone/src/charm.py index b5ce0cc6..2a0a5216 100755 --- a/installers/charm/keystone/src/charm.py +++ b/installers/charm/keystone/src/charm.py @@ -78,6 +78,7 @@ class ConfigModel(ModelValidator): token_expiration: int max_file_size: int site_url: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] mysql_host: Optional[str] @@ -364,8 +365,10 @@ class KeystoneCharm(CharmedOsmBase): str(config.max_file_size) + "m" if config.max_file_size > 0 else config.max_file_size - ), + ) } + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/mongodb-exporter/config.yaml b/installers/charm/mongodb-exporter/config.yaml index 206bca55..727598b9 100644 --- a/installers/charm/mongodb-exporter/config.yaml +++ b/installers/charm/mongodb-exporter/config.yaml @@ -20,6 +20,11 @@ ## options: + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/mongodb-exporter/src/charm.py b/installers/charm/mongodb-exporter/src/charm.py index fd318faf..149940a6 100755 --- a/installers/charm/mongodb-exporter/src/charm.py +++ b/installers/charm/mongodb-exporter/src/charm.py @@ -49,6 +49,7 @@ PORT = 9216 class ConfigModel(ModelValidator): site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] mongodb_uri: Optional[str] @@ -215,6 +216,8 @@ class MongodbExporterCharm(CharmedOsmBase): if config.site_url: parsed = urlparse(config.site_url) annotations = {} + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/mysqld-exporter/config.yaml b/installers/charm/mysqld-exporter/config.yaml index f1192a15..a7702a3f 100644 --- a/installers/charm/mysqld-exporter/config.yaml +++ b/installers/charm/mysqld-exporter/config.yaml @@ -20,6 +20,11 @@ ## options: + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/mysqld-exporter/src/charm.py b/installers/charm/mysqld-exporter/src/charm.py index 2ae7d837..bcd43b54 100755 --- a/installers/charm/mysqld-exporter/src/charm.py +++ b/installers/charm/mysqld-exporter/src/charm.py @@ -49,6 +49,7 @@ PORT = 9104 class ConfigModel(ModelValidator): site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] mysql_uri: Optional[str] @@ -211,6 +212,8 @@ class MysqlExporterCharm(CharmedOsmBase): if config.site_url: parsed = urlparse(config.site_url) annotations = {} + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/nbi/config.yaml b/installers/charm/nbi/config.yaml index a3d94bc2..7f327527 100644 --- a/installers/charm/nbi/config.yaml +++ b/installers/charm/nbi/config.yaml @@ -27,6 +27,11 @@ options: of Keystone, it may need to be configured to handle the requested size. Note: if set to 0, there is no limit. default: 0 + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/nbi/src/charm.py b/installers/charm/nbi/src/charm.py index bbbf5ece..d3a22519 100755 --- a/installers/charm/nbi/src/charm.py +++ b/installers/charm/nbi/src/charm.py @@ -57,6 +57,7 @@ class ConfigModel(ModelValidator): max_file_size: int site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] mongodb_uri: Optional[str] @@ -250,6 +251,8 @@ class NbiCharm(CharmedOsmBase): ), "nginx.ingress.kubernetes.io/backend-protocol": "HTTPS", } + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/ng-ui/config.yaml b/installers/charm/ng-ui/config.yaml index df096983..39d3b2d9 100644 --- a/installers/charm/ng-ui/config.yaml +++ b/installers/charm/ng-ui/config.yaml @@ -31,6 +31,11 @@ options: of Keystone, it may need to be configured to handle the requested size. Note: if set to 0, there is no limit. default: 0 + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/ng-ui/src/charm.py b/installers/charm/ng-ui/src/charm.py index 5efaaaef..5388466e 100755 --- a/installers/charm/ng-ui/src/charm.py +++ b/installers/charm/ng-ui/src/charm.py @@ -51,6 +51,7 @@ class ConfigModel(ModelValidator): max_file_size: int site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] @@ -148,8 +149,10 @@ class NgUiCharm(CharmedOsmBase): str(config.max_file_size) + "m" if config.max_file_size > 0 else config.max_file_size - ), + ) } + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charm/prometheus/config.yaml b/installers/charm/prometheus/config.yaml index a5f5e8a1..c1c0fb93 100644 --- a/installers/charm/prometheus/config.yaml +++ b/installers/charm/prometheus/config.yaml @@ -35,6 +35,11 @@ options: of Keystone, it may need to be configured to handle the requested size. Note: if set to 0, there is no limit. default: 0 + ingress_class: + type: string + description: | + Ingress class name. This is useful for selecting the ingress to be used + in case there are multiple ingresses in the underlying k8s clusters. ingress_whitelist_source_range: type: string description: | diff --git a/installers/charm/prometheus/src/charm.py b/installers/charm/prometheus/src/charm.py index 5fdee723..e3e0e424 100755 --- a/installers/charm/prometheus/src/charm.py +++ b/installers/charm/prometheus/src/charm.py @@ -56,6 +56,7 @@ class ConfigModel(ModelValidator): max_file_size: int site_url: Optional[str] cluster_issuer: Optional[str] + ingress_class: Optional[str] ingress_whitelist_source_range: Optional[str] tls_secret_name: Optional[str] enable_web_admin_api: bool @@ -196,8 +197,10 @@ class PrometheusCharm(CharmedOsmBase): str(config.max_file_size) + "m" if config.max_file_size > 0 else config.max_file_size - ), + ) } + if config.ingress_class: + annotations["kubernetes.io/ingress.class"] = config.ingress_class ingress_resource_builder = IngressResourceV3Builder( f"{self.app.name}-ingress", annotations ) diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index 22144ad1..d40ef15c 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -16,8 +16,8 @@ # set -eux LXD_VERSION=4.0 -JUJU_VERSION=2.8 -JUJU_AGENT_VERSION=2.8.13 +JUJU_VERSION=2.9 +JUJU_AGENT_VERSION=2.9.22 K8S_CLOUD_NAME="k8s-cloud" KUBECTL="microk8s.kubectl" MICROK8S_VERSION=1.20 @@ -27,8 +27,14 @@ PATH=/snap/bin:${PATH} MODEL_NAME=osm -OSM_BUNDLE=cs:osm-66 -OSM_HA_BUNDLE=cs:osm-ha-51 +# 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 function check_arguments(){ @@ -460,7 +466,7 @@ if [ -v ONLY_VCA ]; then hostname=`cat /etc/hostname` echo "Use the following command to register the installed VCA to your OSM:" - echo -e " osm vca-add --endpoints $vca_host:$vca_port \ \n --user $vca_user \ \n --secret $vca_secret \ \n --cacert $vca_cacert \ \n --lxd-cloud lxd-cloud \ \n --lxd-credentials lxd-cloud \ \n --k8s-cloud microk8s \ \n --k8s-credentials microk8s\ \n $hostname-vca" + echo -e " osm vca-add --endpoints $vca_host:$vca_port \\\n --user $vca_user \\\n --secret $vca_secret \\\n --cacert $vca_cacert \\\n --lxd-cloud lxd-cloud \\\n --lxd-credentials lxd-cloud \\\n --k8s-cloud microk8s \\\n --k8s-credentials microk8s\\\n $hostname-vca" else deploy_charmed_osm install_osmclient diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index b232b4c2..f157c1c2 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -1001,13 +1001,7 @@ function deploy_osm_services() { #deploy charmed services function deploy_charmed_services() { juju add-model $OSM_STACK_NAME $OSM_VCA_K8S_CLOUDNAME - # deploy mongodb charm - namespace=$OSM_STACK_NAME - juju deploy cs:~charmed-osm/mongodb-k8s \ - --config enable-sidecar=true \ - --config replica-set=rs0 \ - --config namespace=$namespace \ - -m $namespace + juju deploy ch:mongodb-k8s -m $OSM_STACK_NAME } function deploy_osm_pla_service() { @@ -1629,8 +1623,8 @@ function parse_docker_registry_url() { } LXD_VERSION=4.0 -JUJU_VERSION=2.8 -JUJU_AGENT_VERSION=2.8.13 +JUJU_VERSION=2.9 +JUJU_AGENT_VERSION=2.9.22 UNINSTALL="" DEVELOP="" UPDATE=""