Fix docs issues
[so.git] / docs / developer_info / Working_with_so_monitoring.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 Huawei Technologies Co., Ltd.
4 .. Modifications Copyright (c) 2020 Nokia
5
6 Working with SO Monitoring
7 ==========================
8
9 Starting from Guilin release SO Monitoring uses https and NodePort service during communication with operator.
10 Certificates used for communication are generated automatically using AAF and certInitializer, when SO Monitoring 
11 is deployed using OOM. For that reason, no additional tasks are needed in order to access the SO Monitoring ui, 
12 when the SO is fully deployed. 
13
14 SO Monitoring contains also pre-installed certs which can be used in local development environment. **They are 
15 for development purpose only!**
16
17 1. Credentials to login and initial setup
18 ---------------------------------------------
19
20 Defalut credentials and certs of SO Monitoring, if you want to develop SO Monitoring out of ONAP cluster,
21 are stored in the app. Credentials are as follows:
22
23 .. code-block:: bash
24
25  spring:
26    main:
27      allow-bean-definition-overriding: true
28    security:
29      usercredentials:
30      -                                         
31        username: demo
32        password: '$2a$10$ndkDhATUid4a3g0JJVRv2esX4rtB.vzCn7iBhKyR1qZ/wDdvNzjTS'
33        role: GUI-Client
34
35 Username - demo. Password (**demo123456!**) is bcrypted.
36
37
38 This setup is overridden by the override.yaml file which is stored in the OOM project.
39 Override.yaml file can be edited directly in case of local ONAP setup. This file is loaded into
40 container through configmap.
41
42 .. note::
43  If you want to change config stored in override.yaml on working deployment, you have to edit k8s
44  configmap. Due to insufficient permissions it is not possible directly in the container. After that pod have 
45  to be restarted.
46
47 .. code-block:: bash
48
49   kubectl -n onap edit configmap dev-so-monitoring-app-configmap
50
51 .. image:: ../images/configmap.png
52
53 Special care needs to be given to the indentation. Spring needs to be inline with the mso already present and others
54 added accordingly.
55
56 .. warning::
57   Attention! The default setup of the OOM makes SO Monitoring password is being automatically generated during ONAP
58   deployment and injected through k8s secret
59
60 2. Setup, retrieve and edit default SO Monitoring password
61 ----------------------------------------------------------
62
63 Automatic generation of password for SO Monitoring during ONAP deployment can be overriden. In result, password 
64 can be set up manually. Such case requires to edit ONAP config file, template of which is stored in  
65 **oom/kubernetes/onap/values.yaml** file. 
66
67 .. image:: ../images/so-monitoring-config.png
68
69 Following lines presented in fig. has to be uncommented.
70
71 If customized file is used, following code has to be paste under the SO config (be aware of indentation):
72
73 .. code-block:: bash
74
75  so:
76    ...
77    so-monitoring:
78      server:
79        monitoring:
80          password: demo123456!
81    ...
82
83 Alternative way (**not recommended**) is to add password entry in the **oom/kubernetes/so/components/so-monitoring/values.yaml**
84
85 .. code-block:: bash
86
87  ...
88  server:
89    monitoring:
90      password: demo123456!
91  ...
92
93 To retrieve actual password for SO Monitoring on existing ONAP install, run the following command:
94
95 .. code-block:: bash
96
97  kubectl get secret -n onap dev-so-monitoring-app-user-creds -o json | jq -r .data.password | base64 --decode
98
99 .. image:: ../images/so-monitoring-password.png
100
101 To change actual password on existing ONAP install, **dev-so-monitoring-app-user-creds** secret has to be modified.
102
103 .. code-block:: bash
104
105  kubectl edit secret -n onap dev-so-monitoring-app-user-creds
106
107 .. image:: ../images/so-monitoring-secret.png
108
109 Edit password entry, which has to be given in base64 form. Base64 form of password can be obtained by running:
110
111 .. code-block:: bash
112  
113  echo 'YOUR_PASSWORD' | base64
114
115 .. image:: ../images/so-monitorring-base64-password.png
116
117 Once, password was edited, pod has to be restarted.
118
119
120 3. Login to SO Monitoring
121 -------------------------
122
123 Identify the external port which is mapped to SO Monitoring using the following command. The default port is 30224 :
124
125 .. code-block:: bash
126
127  sudo kubectl -n onap get svc | grep so-monitoring
128
129 .. image:: ../images/nodemap.png
130
131 Then access the UI of SO Monitoring, by default https://<k8s-worker-ip>:30224/
132
133 .. image:: ../images/ui.png
134
135 4. Hiding the SO Monitoring service (ClusterIP)
136 -----------------------------------------------
137
138 The SO Monitoring service is set to the NodePort type. It is used to expose the service at a static port.
139 Hence there is possibility to contact the NodePort Service, from outside cluster, by requesting <NodeIP>:<NodePort>.
140
141 In order to make the service only reachable from within the cluster, ClusterIP service has to be set.
142
143 Command used to edit the service configuration of SO Monitoring is:
144
145 .. code-block:: bash
146
147  sudo kubectl edit svc so-monitoring -n onap
148
149 .. image:: ../images/nodeport.png