Skip to content
Snippets Groups Projects
Commit d680be4f authored by garciadav's avatar garciadav
Browse files

Add charmcraft.yaml debug_mode to charmed-osm


- Added a debug_mode option to lcm, mon, nbi, pol, and ro charms
- Added a script to prepare pods for debugging:
  - setup .ssh/config to easily ssh from vscode to the pods
- Added a README that explains how to prepare the environment for
testing

Change-Id: Ieb56b565c15e61c68ad000b60897abd27e1eeb0e
Signed-off-by: default avatarDavid Garcia <david.garcia@canonical.com>
parent 3ddbbd1f
No related branches found
No related tags found
No related merge requests found
Showing
with 196 additions and 43 deletions
......@@ -14,17 +14,15 @@
# limitations under the License.
function build() {
cd $1 && tox -e build && cd ..
cd $1 && tox -qe build && cd ..
}
charms="ro nbi pla pol mon lcm ng-ui keystone grafana prometheus keystone mariadb-k8s mongodb-k8s zookeeper-k8s kafka-k8s mongodb-exporter kafka-exporter mysqld-exporter"
charms="ro nbi pla pol mon lcm ng-ui keystone grafana prometheus mariadb-k8s mongodb-k8s zookeeper-k8s kafka-k8s mongodb-exporter kafka-exporter mysqld-exporter"
if [ -z `which charmcraft` ]; then
sudo snap install charmcraft --edge
fi
for charm_directory in $charms; do
echo "Building charm $charm_directory..."
# cd $charm_directory
build $charm_directory
# cd ..
build $charm_directory &
done
wait
\ No newline at end of file
......@@ -78,7 +78,7 @@ applications:
gui-x: 0
gui-y: 0
nbi:
charm: "cs:~charmed-osm/nbi-13"
charm: "cs:~charmed-osm/nbi-16"
scale: 3
series: kubernetes
options:
......@@ -89,7 +89,7 @@ applications:
gui-x: 0
gui-y: -250
ro:
charm: "cs:~charmed-osm/ro-5"
charm: "cs:~charmed-osm/ro-8"
scale: 3
series: kubernetes
options:
......@@ -98,14 +98,14 @@ applications:
gui-x: -300
gui-y: 250
ng-ui:
charm: "cs:~charmed-osm/ng-ui-22"
charm: "cs:~charmed-osm/ng-ui-23"
scale: 3
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
charm: "cs:~charmed-osm/lcm-10"
charm: "cs:~charmed-osm/lcm-13"
scale: 3
series: kubernetes
options:
......@@ -115,7 +115,7 @@ applications:
gui-x: -300
gui-y: 0
mon:
charm: "cs:~charmed-osm/mon-6"
charm: "cs:~charmed-osm/mon-9"
scale: 1
series: kubernetes
options:
......@@ -126,7 +126,7 @@ applications:
gui-x: 300
gui-y: 0
pol:
charm: "cs:~charmed-osm/pol-5"
charm: "cs:~charmed-osm/pol-8"
scale: 3
series: kubernetes
options:
......@@ -135,7 +135,7 @@ applications:
gui-x: -300
gui-y: 500
pla:
charm: "cs:~charmed-osm/pla-10"
charm: "cs:~charmed-osm/pla-11"
scale: 3
series: kubernetes
options:
......@@ -144,7 +144,7 @@ applications:
gui-x: 600
gui-y: -250
prometheus:
charm: "cs:~charmed-osm/prometheus-5"
charm: "cs:~charmed-osm/prometheus-6"
scale: 1
series: kubernetes
storage:
......@@ -155,14 +155,14 @@ applications:
gui-x: 300
gui-y: 250
grafana:
charm: "cs:~charmed-osm/grafana-5"
charm: "cs:~charmed-osm/grafana-6"
scale: 3
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
charm: "cs:~charmed-osm/keystone-11"
charm: "cs:~charmed-osm/keystone-12"
scale: 1
series: kubernetes
annotations:
......
......@@ -71,7 +71,7 @@ applications:
gui-x: 0
gui-y: 0
nbi:
charm: "cs:~charmed-osm/nbi-13"
charm: "cs:~charmed-osm/nbi-16"
scale: 1
series: kubernetes
options:
......@@ -82,7 +82,7 @@ applications:
gui-x: 0
gui-y: -250
ro:
charm: "cs:~charmed-osm/ro-5"
charm: "cs:~charmed-osm/ro-8"
scale: 1
series: kubernetes
options:
......@@ -91,14 +91,14 @@ applications:
gui-x: -300
gui-y: 250
ng-ui:
charm: "cs:~charmed-osm/ng-ui-22"
charm: "cs:~charmed-osm/ng-ui-23"
scale: 1
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
charm: "cs:~charmed-osm/lcm-10"
charm: "cs:~charmed-osm/lcm-13"
scale: 1
series: kubernetes
options:
......@@ -108,7 +108,7 @@ applications:
gui-x: -300
gui-y: 0
mon:
charm: "cs:~charmed-osm/mon-6"
charm: "cs:~charmed-osm/mon-9"
scale: 1
series: kubernetes
options:
......@@ -119,7 +119,7 @@ applications:
gui-x: 300
gui-y: 0
pol:
charm: "cs:~charmed-osm/pol-5"
charm: "cs:~charmed-osm/pol-8"
scale: 1
series: kubernetes
options:
......@@ -128,7 +128,7 @@ applications:
gui-x: -300
gui-y: 500
pla:
charm: "cs:~charmed-osm/pla-10"
charm: "cs:~charmed-osm/pla-11"
scale: 1
series: kubernetes
options:
......@@ -137,7 +137,7 @@ applications:
gui-x: 600
gui-y: -250
prometheus:
charm: "cs:~charmed-osm/prometheus-5"
charm: "cs:~charmed-osm/prometheus-6"
scale: 1
series: kubernetes
storage:
......@@ -148,14 +148,14 @@ applications:
gui-x: 300
gui-y: 250
grafana:
charm: "cs:~charmed-osm/grafana-5"
charm: "cs:~charmed-osm/grafana-6"
scale: 1
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
charm: "cs:~charmed-osm/keystone-11"
charm: "cs:~charmed-osm/keystone-12"
scale: 1
series: kubernetes
annotations:
......
# Copyright 2021 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.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact: legal@canonical.com
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
##
type: charm
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
parts:
charm:
build-packages: [git]
......@@ -108,15 +108,15 @@ class GrafanaCharm(CharmedOsmBase):
files_builder = FilesV3Builder()
files_builder.add_file(
"dashboard_osm.yaml",
Path("files/default_dashboards.yaml").read_text(),
Path("templates/default_dashboards.yaml").read_text(),
)
if config.osm_dashboards:
osm_dashboards_mapping = {
"kafka_exporter_dashboard.json": "files/kafka_exporter_dashboard.json",
"mongodb_exporter_dashboard.json": "files/mongodb_exporter_dashboard.json",
"mysql_exporter_dashboard.json": "files/mysql_exporter_dashboard.json",
"nodes_exporter_dashboard.json": "files/nodes_exporter_dashboard.json",
"summary_dashboard.json": "files/summary_dashboard.json",
"kafka_exporter_dashboard.json": "templates/kafka_exporter_dashboard.json",
"mongodb_exporter_dashboard.json": "templates/mongodb_exporter_dashboard.json",
"mysql_exporter_dashboard.json": "templates/mysql_exporter_dashboard.json",
"nodes_exporter_dashboard.json": "templates/nodes_exporter_dashboard.json",
"summary_dashboard.json": "templates/summary_dashboard.json",
}
for file_name, path in osm_dashboards_mapping.items():
files_builder.add_file(file_name, Path(path).read_text())
......@@ -126,7 +126,7 @@ class GrafanaCharm(CharmedOsmBase):
files_builder = FilesV3Builder()
files_builder.add_file(
"datasource_prometheus.yaml",
Template(Path("files/default_datasources.yaml").read_text()).substitute(
Template(Path("templates/default_datasources.yaml").read_text()).substitute(
prometheus_host=self.prometheus_client.hostname,
prometheus_port=self.prometheus_client.port,
),
......
......@@ -95,19 +95,22 @@ commands = yamllint .
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
deps = charmcraft
whitelist_externals =
charmcraft
cp
sh
commands =
charmcraft build
cp -r build release
sh -c 'ubuntu_version=20.04; \
architectures="amd64-aarch64-arm64"; \
charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \
mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm'
#######################################################################################
[flake8]
ignore =
W291,
W293,
W503,
E123,
E125,
E226,
......
# Copyright 2021 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.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact: legal@canonical.com
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
##
type: charm
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
parts:
charm:
build-packages: [git]
......@@ -137,7 +137,7 @@ class KafkaExporterCharm(CharmedOsmBase):
if self.unit.is_leader():
self.dashboard_target.publish_info(
name="osm-kafka",
dashboard=Path("files/kafka_exporter_dashboard.json").read_text(),
dashboard=Path("templates/kafka_exporter_dashboard.json").read_text(),
)
def _check_missing_dependencies(self, config: ConfigModel):
......
......@@ -95,13 +95,15 @@ commands = yamllint .
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
deps = charmcraft
whitelist_externals =
charmcraft
cp
sh
commands =
charmcraft build
cp -r build release
sh -c 'ubuntu_version=20.04; \
architectures="amd64-aarch64-arm64"; \
charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \
mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm'
#######################################################################################
[flake8]
......
# Copyright 2021 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.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact: legal@canonical.com
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
##
type: charm
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
parts:
charm:
build-packages: [git]
......@@ -95,13 +95,15 @@ commands = yamllint .
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
deps = charmcraft
whitelist_externals =
charmcraft
cp
sh
commands =
charmcraft build
cp -r build release
sh -c 'ubuntu_version=20.04; \
architectures="amd64-aarch64-arm64"; \
charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \
mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm'
#######################################################################################
[flake8]
......
# Copyright 2021 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.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact: legal@canonical.com
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
##
type: charm
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
parts:
charm:
build-packages: [git]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment