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