[APACHECNF] Update healthcheck and add scale workflow
[demo.git] / tutorials / ApacheCNF / automation / README.md
1 # CNF automation
2
3 0. Make sure you have python 3.8.x installed and default interpreter, what is required by onap-pythonsdk
4 1. Install required packages with pipenv `pipenv install`
5 2. Run virtual environment `pipenv shell`. In case of problems you maye try also `--fancy` option
6    
7    **In case of problems with pipenv:** `venv` can be used as well. In that case, please install all required python packages in correct version according the list in `Pipfile`
8 3. Add kubeconfig file for k8s cluster that will host your CNF. Apache can be deployed on any standard cluster but with defult values it need LoadBlanacer
9    - `artifacts/kubeconfig`
10 4. Prepare onboarding packages `cd ../templates/ && make && cd ../automation/`
11 5. Modify `service_config.yaml`. Please note that the configuration file has yaml syntax but also is jinja templated
12    and values defined in the configuration file may be used also in the jinja templaring process. Templating is an iterative process unless all the values are
13    not resolved. Please not that in most cases you don't have to modify this file at all, despite the configuration of your k8s cluster.
14    We recommend to modify only values from the 'UserParams' section:
15    - cnf_name - name of CNF
16    - k8s_namespace - k8s namespace to use for deployment of CNF
17    - k8s_version - version of the k8s cluster (important for proper helm templating)
18    - k8s_region - name of the k8s region that we want to create in ONAP
19    - release_name - name of the rleease of the helm application (user for naming of k8s resources)
20    - profile_source - source of the k8s profile with values - in our case it may be used to change from LoandBalanser to NodePort service type
21    - skip_day_2 - it defined the SKIP_POST_INSTANTIATION flag in SDC models. The value is used in the SDC service model name
22 6. Verify service_config.yaml by running `python config.py`
23 7. __Important:__ Before running python scripts, some settings for `onapsdk` with information about ONAP endpoints (and socks) have to be exported. 
24    All settings for ONAP instance are located in `automation/onap_settings.py` file. To export that settings please run command inside `pipenv` or `venv` shell
25    ```shell
26    (automation) ubuntu@onap:~/automation$ export ONAP_PYTHON_SDK_SETTINGS="onap_settings"
27    ```
28 8. Run script `python create_cloud_regions.py` in order to create **k8s or openstack cloud region**
29 9. Onboard CNF `python onboard.py`
30 10. Instantiate CNF `python instantiate.py`
31 11. To run healtcheck operation execute `python healthcheck.py <status_check_max_count>` where <status_check_max_count> [int] (default 1)
32     indicates iteration number to run status check in case of failure
33 12. To run scale operation execute `python scale.py <replica_count>` where <replica_count> [int] (default 1)
34     indicates the number of desired replicas of Apache pods
35 13. Once test is done, CNF service instance can be deleted with `python delete.py` command