Merge "ensure default flags are set on execution"
[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** : If you want to change config stored in override.yaml on working deployment, you have to edit k8s
43 configmap. Due to insufficient permissions it is not possible directly in the container. After that pod have 
44 to be restarted.
45
46 **kubectl -n onap edit configmap dev-so-monitoring-app-configmap**
47
48 .. image:: ../images/configmap.png
49
50 Special care needs to be given to the indentation. Spring needs to be inline with the mso already present and others
51 added accordingly.
52
53 **Attention! The default setup of the OOM makes SO Monitoring password is being automatically generated during ONAP
54 deployment and injected through k8s secret**
55
56
57 2. Setup, retrieve and edit default SO Monitoring password
58 ----------------------------------------------------------
59
60 Automatic generation of password for SO Monitoring during ONAP deployment can be overriden. In result, password 
61 can be set up manually. Such case requires to edit ONAP config file, template of which is stored in  
62 **oom/kubernetes/onap/values.yaml** file. 
63
64 .. image:: ../images/so-monitoring-config.png
65
66 Following lines presented in fig. has to be uncommented.
67
68 If customized file is used, following code has to be paste under the SO config (be aware of indentation):
69
70 .. code-block:: bash
71
72  so:
73    ...
74    so-monitoring:
75      server:
76        monitoring:
77          password: demo123456!
78    ...
79
80 Alternative way (**not recommended**) is to add password entry in the **oom/kubernetes/so/components/so-monitoring/values.yaml**
81
82 .. code-block:: bash
83
84  ...
85  server:
86    monitoring:
87      password: demo123456!
88  ...
89
90 To retrieve actual password for SO Monitoring on existing ONAP install, run the following command:
91
92 **kubectl get secret -n onap dev-so-monitoring-app-user-creds -o json | jq -r .data.password | base64 --decode**
93
94 .. image:: ../images/so-monitoring-password.png
95
96 To change actual password on existing ONAP install, **dev-so-monitoring-app-user-creds** secret has to be modified.
97
98 **kubectl edit secret -n onap dev-so-monitoring-app-user-creds**
99
100 .. image:: ../images/so-monitoring-secret.png
101
102 Edit password entry, which has to be given in base64 form. Base64 form of password can be obtained by running:
103
104 **echo 'YOUR_PASSWORD' | base64**
105
106 .. image:: ../images/so-monitorring-base64-password.png
107
108 Once, password was edited, pod has to be restarted.
109
110
111 3. Login to SO Monitoring
112 -------------------------
113
114 Identify the external port which is mapped to SO Monitoring using the following command. The default port is 30224 :
115
116 **sudo kubectl -n onap get svc | grep so-monitoring**
117
118 .. image:: ../images/nodemap.png
119
120 Then access the UI of SO Monitoring, for example by  https://<IP>:30224/ 
121
122 .. image:: ../images/ui.png
123
124 4. Hiding the SO Monitoring service (ClusterIP)
125 ---------------------------------------
126
127 The SO Monitoring service is set to the NodePort type. It is used to expose the service at a static port.
128 Hence there is possibility to contact the NodePort Service, from outside cluster, by requesting <NodeIP>:<NodePort>.
129
130 In order to make the service only reachable from within the cluster, ClusterIP service has to be set.
131
132 Command used to edit the service configuration of SO Monitoring is:
133
134 **sudo kubectl edit svc so-monitoring -n onap**
135
136 .. image:: ../images/nodeport.png