Merge v8.0 Into Master
This is a combination of all the commits.
=======================================================================
Enable Robot Tests
Enabling robot tests in CI/CD pipeline
Propagate the parameter DO_ROBOT to stage_3-merge
Setting OSM_HOSTNAME for robot test execution
Adding prometheus_hostname env variable for ci/cd tests
Archive containers logs in robot test execution
Signed-off-by: beierlm <mark.beierl@canonical.com>
Author: Felipe Vicens <felipe.vicens@atos.net>
8716 - K8s Proxy Charms
This commit contains the following changes:
- Changes to LCM Charm to configure vca k8s cloud
- K8s installation:
- Add storageclass to K8s
- Add k8s to VCA
- Configure lcm.env to pass k8s cloud name
- Pass k8s cloud name to LCM Charm in charmed
installation
- Pin juju version tu 2.8/stable
- Instal juju after Microk8s in charmed
installation
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
Add PLA charm
Signed-off-by: David Garcia <david.garcia@canonical.com>
Add NG-UI Charm
Signed-off-by: David Garcia <david.garcia@canonical.com>
Fix bugs in NG-UI charm
Signed-off-by: David Garcia <david.garcia@canonical.com>
Updated Dockerfiles to use ReleaseEIGHT-daily repo by default
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Fix bug 1124: K8s added to juju after k8s has been initialized
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Helm and k8s storage initialization for k8s-based installation
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Fix bug 1125: iptables must be installed and configured if not present
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Fix bug 1129: juju_addk8s requires the storage class
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Fix issue in UI charm
Scale policy is only available in stateful pods
Signed-off-by: David Garcia <david.garcia@canonical.com>
Adds image overlay to bundle
When installing using a bundle, the image overlay was not being
generated, resulting in the --tag option being ignored.
Bug 1130
Signed-off-by: beierlm <mark.beierl@canonical.com>
Fix uninstall process, will fix issues is daily-stage4
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Fix PLA relations, add missing ENVs, and include it in the bundle
Signed-off-by: David Garcia <david.garcia@canonical.com>
Fix 1127 bug: Use config instead of resources for SSL certificates
Signed-off-by: David Garcia <david.garcia@canonical.com>
Remove unused config from PLA overlayx
Signed-off-by: David Garcia <david.garcia@canonical.com>
Installer: refactor file generation, improved ng-ui and light-ui separation, fixes in PLA
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Pin libjuju version to 2.8.2
This fixes bug 1144
Signed-off-by: David Garcia <david.garcia@canonical.com>
Pin libjuju version to 2.8.2
Fixes bug 1144
Signed-off-by: Mark Beierl <mark.beierl@canonical.com>
Remove api_proxy variable in charmed installer
- Fixes bug 1154
Signed-off-by: David Garcia <david.garcia@canonical.com>
Add waiting period to Storage Class creation
This commit adds a waiting period until the
storage class is available.
It also fixes a minor bug in the juju add-k8s
command.
This fixes Bug 1155
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
Remove api_proxy from osm bundles
Signed-off-by: David Garcia <david.garcia@canonical.com>
Make Charmed Installer Idempotent
By default, the charmed installer will create a controller called
'controller', unless an external VCA is specified using the --vca
option. Upon uninstall, it is not known or safe to remove this
Juju controller as there might be other applications using it.
This change shows that message on uninstall, giving the user the
opportunity to remove it with a command.
Also, as part of the installation, this change checks for the
controller and if it exists, presents the user with options for
how to resolve the situation.
Fixes bug 1126
Signed-off-by: beierlm <mark.beierl@canonical.com>
Remove unneeded mysql interface in PLA, fix osm-ha bundle, and add README.md to bundles
Signed-off-by: David Garcia <david.garcia@canonical.com>
Expose NBI and NG-UI
Adds ingress rules for K8s installation to expose the NBI, the
NG-UI and allow for unlimited content size.
Fixes bug 1171
Signed-off-by: beierlm <mark.beierl@canonical.com>
Installer Quits Too Soon
Increases the timeout and provides more feedback on progress.
Signed-off-by: beierlm <mark.beierl@canonical.com>
Change in returned storage status format from microk8s
Signed-off-by: calvinosanc1 <guillermo.calvino@canonical.com>
========================================================================================
Change-Id: I9223675bb9ad25a0da1f20215e79ef392e544eb5
Signed-off-by: beierlm <mark.beierl@canonical.com>
diff --git a/installers/charm/pla/.yamllint.yaml b/installers/charm/pla/.yamllint.yaml
new file mode 100644
index 0000000..ab52c60
--- /dev/null
+++ b/installers/charm/pla/.yamllint.yaml
@@ -0,0 +1,23 @@
+# Copyright 2020 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.
+---
+extends: default
+
+yaml-files:
+ - "*.yaml"
+ - "*.yml"
+ - ".yamllint"
+ignore: |
+ .tox
+ mod
diff --git a/installers/charm/pla/README.md b/installers/charm/pla/README.md
new file mode 100644
index 0000000..8d486d0
--- /dev/null
+++ b/installers/charm/pla/README.md
@@ -0,0 +1,14 @@
+<!-- # Copyright 2020 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. -->
+# PLA Charm
\ No newline at end of file
diff --git a/installers/charm/pla/config.yaml b/installers/charm/pla/config.yaml
new file mode 100644
index 0000000..e0aeca4
--- /dev/null
+++ b/installers/charm/pla/config.yaml
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 Arctos Labs Scandinavia AB
+#
+# 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.
+
+options:
+ image:
+ description: Docker image name
+ type: string
+ default: opensourcemano/pla:8
+ port:
+ description: Port number
+ type: int
+ default: 8080 # Fake port
+ log_level:
+ description: Log level
+ type: string
+ default: INFO
+ database:
+ description: Database name
+ type: string
+ default: pla
+ database_common_key:
+ description: Common Key for Mongo database
+ type: string
+ default: osm
diff --git a/installers/charm/pla/hooks/install b/installers/charm/pla/hooks/install
new file mode 120000
index 0000000..25b1f68
--- /dev/null
+++ b/installers/charm/pla/hooks/install
@@ -0,0 +1 @@
+../src/charm.py
\ No newline at end of file
diff --git a/installers/charm/pla/hooks/start b/installers/charm/pla/hooks/start
new file mode 120000
index 0000000..25b1f68
--- /dev/null
+++ b/installers/charm/pla/hooks/start
@@ -0,0 +1 @@
+../src/charm.py
\ No newline at end of file
diff --git a/installers/charm/pla/hooks/upgrade-charm b/installers/charm/pla/hooks/upgrade-charm
new file mode 120000
index 0000000..25b1f68
--- /dev/null
+++ b/installers/charm/pla/hooks/upgrade-charm
@@ -0,0 +1 @@
+../src/charm.py
\ No newline at end of file
diff --git a/installers/charm/pla/lib/ops b/installers/charm/pla/lib/ops
new file mode 120000
index 0000000..d934193
--- /dev/null
+++ b/installers/charm/pla/lib/ops
@@ -0,0 +1 @@
+../mod/operator/ops
\ No newline at end of file
diff --git a/installers/charm/pla/metadata.yaml b/installers/charm/pla/metadata.yaml
new file mode 100644
index 0000000..90c9d40
--- /dev/null
+++ b/installers/charm/pla/metadata.yaml
@@ -0,0 +1,29 @@
+# Copyright 2020 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.
+
+name: pla
+summary: A Placement charm for Opensource MANO
+description: |
+ Placement module for OSM
+series:
+ - kubernetes
+min-juju-version: 2.7.0
+deployment:
+ type: stateless
+ service: cluster
+requires:
+ kafka:
+ interface: kafka
+ mongo:
+ interface: mongodb
diff --git a/installers/charm/pla/mod/operator b/installers/charm/pla/mod/operator
new file mode 160000
index 0000000..a84ce87
--- /dev/null
+++ b/installers/charm/pla/mod/operator
@@ -0,0 +1 @@
+Subproject commit a84ce8776b368a8b2bccdb173716e342db9a6b36
diff --git a/installers/charm/pla/src/charm.py b/installers/charm/pla/src/charm.py
new file mode 100755
index 0000000..1fc6386
--- /dev/null
+++ b/installers/charm/pla/src/charm.py
@@ -0,0 +1,147 @@
+#!/usr/bin/env python3
+# Copyright 2020 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.
+
+import sys
+import logging
+
+sys.path.append("lib")
+
+from ops.charm import CharmBase
+from ops.framework import StoredState, Object
+from ops.main import main
+from ops.model import (
+ ActiveStatus,
+ MaintenanceStatus,
+ WaitingStatus,
+)
+
+from glob import glob
+from pathlib import Path
+from string import Template
+
+logger = logging.getLogger(__name__)
+
+
+class PLACharm(CharmBase):
+ state = StoredState()
+
+ def __init__(self, framework, key):
+ super().__init__(framework, key)
+ self.state.set_default(spec=None)
+ self.state.set_default(kafka_host=None)
+ self.state.set_default(kafka_port=None)
+ self.state.set_default(mongodb_uri=None)
+
+ # Observe Charm related events
+ self.framework.observe(self.on.config_changed, self.on_config_changed)
+ self.framework.observe(self.on.start, self.on_start)
+ self.framework.observe(self.on.upgrade_charm, self.on_upgrade_charm)
+
+ # Relations
+ self.framework.observe(
+ self.on.kafka_relation_changed, self.on_kafka_relation_changed
+ )
+ self.framework.observe(
+ self.on.mongo_relation_changed, self.on_mongo_relation_changed
+ )
+
+ def _apply_spec(self):
+ # Only apply the spec if this unit is a leader.
+ unit = self.model.unit
+ if not unit.is_leader():
+ unit.status = ActiveStatus("ready")
+ return
+ if not self.state.kafka_host or not self.state.kafka_port:
+ unit.status = WaitingStatus("Waiting for Kafka")
+ return
+ if not self.state.mongodb_uri:
+ unit.status = WaitingStatus("Waiting for MongoDB")
+ return
+
+ unit.status = MaintenanceStatus("Applying new pod spec")
+
+ new_spec = self.make_pod_spec()
+ if new_spec == self.state.spec:
+ unit.status = ActiveStatus("ready")
+ return
+ self.framework.model.pod.set_spec(new_spec)
+ self.state.spec = new_spec
+ unit.status = ActiveStatus("ready")
+
+ def make_pod_spec(self):
+ config = self.framework.model.config
+
+ ports = [
+ {"name": "port", "containerPort": config["port"], "protocol": "TCP", },
+ ]
+
+ config_spec = {
+ "OSMPLA_MESSAGE_DRIVER": "kafka",
+ "OSMPLA_MESSAGE_HOST": self.state.kafka_host,
+ "OSMPLA_MESSAGE_PORT": self.state.kafka_port,
+ "OSMPLA_DATABASE_DRIVER": "mongo",
+ "OSMPLA_DATABASE_URI": self.state.mongodb_uri,
+ "OSMPLA_GLOBAL_LOG_LEVEL": config["log_level"],
+ "OSMPLA_DATABASE_COMMONKEY": config["database_common_key"],
+ }
+
+ spec = {
+ "version": 2,
+ "containers": [
+ {
+ "name": self.framework.model.app.name,
+ "image": config["image"],
+ "ports": ports,
+ "config": config_spec,
+ }
+ ],
+ }
+
+ return spec
+
+ def on_config_changed(self, event):
+ """Handle changes in configuration"""
+ self._apply_spec()
+
+ def on_start(self, event):
+ """Called when the charm is being installed"""
+ self._apply_spec()
+
+ def on_upgrade_charm(self, event):
+ """Upgrade the charm."""
+ unit = self.model.unit
+ unit.status = MaintenanceStatus("Upgrading charm")
+ self.on_start(event)
+
+ def on_kafka_relation_changed(self, event):
+ unit = self.model.unit
+ if not unit.is_leader():
+ return
+ self.state.kafka_host = event.relation.data[event.unit].get("host")
+ self.state.kafka_port = event.relation.data[event.unit].get("port")
+ self._apply_spec()
+
+ def on_mongo_relation_changed(self, event):
+ unit = self.model.unit
+ if not unit.is_leader():
+ return
+ self.state.mongodb_uri = event.relation.data[event.unit].get(
+ "connection_string"
+ )
+ self._apply_spec()
+
+
+if __name__ == "__main__":
+ main(PLACharm)
diff --git a/installers/charm/pla/tox.ini b/installers/charm/pla/tox.ini
new file mode 100644
index 0000000..d2a8c53
--- /dev/null
+++ b/installers/charm/pla/tox.ini
@@ -0,0 +1,56 @@
+# Copyright 2020 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.
+
+[tox]
+envlist = pep8
+skipsdist = True
+
+[testenv]
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONHASHSEED=0
+whitelist_externals = juju
+passenv = HOME TERM CS_API_* OS_* AMULET_*
+deps = -r{toxinidir}/test-requirements.txt
+install_command =
+ pip install {opts} {packages}
+
+[testenv:black]
+basepython = python3
+deps =
+ black
+ yamllint
+commands =
+ black --check --diff src
+ yamllint .
+
+[testenv:pep8]
+basepython = python3
+deps=charm-tools
+commands = charm-proof
+
+[testenv:func-noop]
+basepython = python3
+commands =
+ true
+
+[testenv:func]
+basepython = python3
+commands = functest-run-suite
+
+[testenv:func-smoke]
+basepython = python3
+commands = functest-run-suite --keep-model --smoke
+
+[testenv:venv]
+commands = {posargs}