Prepare installer and pods for Rel TWELVE
[osm/devops.git] / installers / charm / pol-k8s / README.md
1 <!--
2 Copyright 2020 Canonical Ltd.
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6     http://www.apache.org/licenses/LICENSE-2.0
7     Unless required by applicable law or agreed to in writing, software
8     distributed under the License is distributed on an "AS IS" BASIS,
9     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10     See the License for the specific language governing permissions and
11     limitations under the License. -->
12
13 # Overview
14
15 POL for Juju CAAS
16
17 ## Testing
18
19 The tests of this charm are done using tox and Zaza.
20
21
22
23 ### Prepare environment
24
25 The machine in which the tests are run needs access to a juju k8s controller. The easiest way to approach this is by executing the following commands:
26
27 ```
28 sudo apt install tox -y
29 sudo snap install microk8s --classic
30 sudo snap install juju
31
32 microk8s.status --wait-ready
33 microk8s.enable storage dashboard dns
34
35 juju bootstrap microk8s k8s-cloud
36 ```
37
38 If /usr/bin/python does not exist, you should probably need to do this:
39
40 ```
41 sudo ln -s /usr/bin/python3 /usr/bin/python
42 ```
43 ### Build Charm
44
45 **Download dependencies:**
46
47 ```
48 mkdir -p ~/charm/layers ~/charm/build ~/charm/interfaces
49 git clone https://git.launchpad.net/canonical-osm ~/canonical-osm
50
51 cd ~/charm/layers
52 git clone https://git.launchpad.net/charm-osm-pol pol-k8s
53 git clone https://git.launchpad.net/charm-osm-ro ro-k8s
54 git clone https://git.launchpad.net/charm-k8s-kafka kafka-k8s ~/charm/interfaces
55 git clone https://git.launchpad.net/charm-k8s-zookeeper zookeeper-k8s
56 git clone https://git.launchpad.net/charm-k8s-mongodb mongodb-k8s
57
58 cd ~/charm/interfaces
59 mv ~/canonical-osm/charms/interfaces/* .
60 git clone https://git.launchpad.net/interface-mongodb mongodb
61
62 ```
63
64 **Charm structure:**
65
66 ```
67 ├── config.yaml
68 ├── icon.svg
69 ├── layer.yaml
70 ├── metadata.yaml
71 ├── reactive
72 │   ├── spec_template.yaml
73 │   └── pol.py
74 ├── README.md
75 └── tox.ini
76 ```
77
78 **Setup environment variables:**
79
80 ```
81 export CHARM_LAYERS_DIR=~/charm/layers
82 export CHARM_BUILD_DIR=~/charm/build
83 export CHARM_INTERFACES_DIR=~/charm/interfaces
84 ```
85
86 **Build:**
87
88 ```
89 mkdir ~/charm/layers/pol-k8s/tests/build
90 charm build ~/charm/layers/pol-k8s
91 charm build ~/charm/layers/kafka-k8s
92 charm build ~/charm/layers/zookeeper-k8s
93 charm build ~/charm/layers/mongodb-k8s
94 mv ~/charm/build/* ~/charm/layers/pol-k8s/tests/build/
95 ```