Prepare installer and pods for Rel TWELVE
[osm/devops.git] / installers / charm / kafka-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 Kafka 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 ```
50 sudo ln -s /usr/bin/python3 /usr/bin/python
51 ```
52
53 ### Build Charm
54
55 **Download dependencies:**
56
57 ```
58 mkdir -p ~/charm/layers ~/charm/build
59 cd ~/charm/layers
60 git clone https://git.launchpad.net/charm-k8s-kafka kafka-k8s
61 git clone https://git.launchpad.net/charm-k8s-zookeeper zookeeper-k8s
62 git clone https://git.launchpad.net/charm-osm-common osm-common
63 ```
64
65 **Charm structure:**
66
67 ```
68 ├── config.yaml
69 ├── icon.svg
70 ├── layer.yaml
71 ├── metadata.yaml
72 ├── reactive
73 │   ├── spec_template.yaml
74 │   └── kafka.py
75 ├── README.md
76 ├── test-requirements.txt
77 ├── tests
78 │   ├── basic_deployment.py
79 │   ├── bundles
80 │   │   ├── kafka-ha.yaml
81 │   │   └── kafka.yaml
82 │   └── tests.yaml
83 └── tox.ini
84 ```
85
86 **Setup environment variables:**
87
88 ```
89 export CHARM_LAYERS_DIR=~/charm/layers
90 export CHARM_BUILD_DIR=~/charm/build
91 ```
92
93 **Build:**
94
95 ```
96 mkdir ~/charm/layers/kafka-k8s/tests/build
97 charm build ~/charm/layers/kafka-k8s
98 charm build ~/charm/layers/zookeeper-k8s
99 mv ~/charm/build/* ~/charm/layers/kafka-k8s/tests/build/
100 ```
101
102 ### Test charm with Tox
103
104 ```
105 cd ~/charm/layers/kafka-k8s
106 tox -e func
107 ```