Align to new rls template
[dcaegen2.git] / docs / sections / installation_oom.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 DCAE Deployment (using Helm and Cloudify)
5 =========================================
6
7 This document describes the details of the Helm chart based deployment process for ONAP and how DCAE is deployed through this process.
8
9
10 Deployment Overview
11 -------------------
12
13 ONAP deployments are done on kubernetes through OOM/Helm charts. Kubernetes is a container orchestration technology that organizes containers into composites of various patterns for easy deployment, management, and scaling.
14 ONAP uses Kubernetes as the foundation for fulfilling its platform maturity promises.
15
16 ONAP manages Kubernetes specifications using Helm charts (in OOM project), under which all Kubernetes yaml-formatted resource specifications and additional files
17 are organized into a hierarchy of charts, sub-charts, and resources.  These yaml files are further augmented with Helm's templating, which makes dependencies
18 and cross-references of parameters and parameter derivatives among resources manageable for a large and complex Kubernetes system such as ONAP.
19
20 At deployment time, with a single **helm deploy** command, Helm resolves all the templates and compiles the chart hierarchy into Kubernetes resource definitions,
21 and invokes Kubernetes deployment operations for all the resources.
22
23 All ONAP Helm charts are organized under the **kubernetes** directory of the **OOM** project, where roughly each ONAP component occupies a subdirectory.
24 DCAE charts are placed under the **dcaegen2** directory.
25
26 All DCAE platform components  have corresponding Helm chart which will be used to trigger the deployment. 
27 All DCAE Services are deployed through Cloudify Blueprint. The default ONAP DCAE deployment includes small subset of DCAE services deployed through Bootstrap pod to meet
28 ONAP Integration usecases. Optionally operators can deploy on-demand other MS required for their usecases as described in `On-demand MS Installation
29 <installation_MS_ondemand>`_.
30
31 The PNDA data platform is an optional DCAE component that is placed under the **pnda**
32 directory. Details for how to configure values to enable PNDA installation during Helm install
33 are described in `Installing PNDA through Helm Chart
34 <installation_pnda>`_.
35
36
37 DCAE Chart Organization
38 -----------------------
39
40 Following Helm conventions, the DCAE Helm chart directory (``oom/kubernetes/dcaegen2``) consists of the following files and subdirectories:
41
42 * ``Chart.yaml``: metadata.
43 * ``requirements.yaml``: dependency charts.
44 * ``values.yaml``: values for Helm templating engine to expand templates.
45 * ``resources``: subdirectory for additional resource definitions such as configuration, scripts, etc.
46 * ``Makefile``: make file to build DCAE charts
47 * ``components``: subdirectory for DCAE sub-charts.
48
49 The dcaegen2 chart has the following sub-charts:
50
51 * ``dcae-bootstrap``: deploys the DCAE bootstrap service that performs some DCAE initialization and deploys additional DCAE components.
52 * ``dcae-cloudify-manager``: deploys the DCAE Cloudify Manager instance.
53 * ``dcae-config-binding-service``: deploys the DCAE config binding service.
54 * ``dcae-deployment-handler``: deploys the DCAE deployment handler service.
55 * ``dcae-healthcheck``: deploys the DCAE healthcheck service that provides an API to check the health of all DCAE components.
56 * ``dcae-policy-handler``: deploys the DCAE policy handler service.
57 * ``dcae-redis``: deploys the DCAE Redis cluster.
58 * ``dcae-dashboard``: deploys the DCAE Dashboard for managing DCAE microservices deployments
59 * ``dcae-servicechange-handler``: deploys the DCAE service change handler service.  A subchart (``dcae-inventory-api``) deploys the DCAE inventory API service.
60
61 DCAE Deployment
62 ---------------
63
64 At deployment time, when the **helm deploy** command is executed,
65 all DCAE resources defined within the subcharts above are deployed.
66 These include:
67
68 * the DCAE bootstrap service
69 * the DCAE healthcheck service
70 * the DCAE platform components:
71
72   * Cloudify Manager
73   * Config binding service
74   * Deployment handler
75   * Policy handler
76   * Service change handler
77   * Inventory API service (launched as a subchart of service change handler)
78   * Inventory postgres database service (launched as a dependency of the inventory API service)
79   * DCAE postgres database service (launched as a dependency of the bootstrap service)
80   * DCAE Redis cluster
81
82 Some of the DCAE subcharts include an initContainer that checks to see if
83 other services that they need in order to run have become ready.  The installation
84 of these subcharts will pause until the needed services are available.
85
86 In addition, DCAE operations depends on a Consul server cluster.
87 For ONAP OOM deployment, the Consul cluster is provided as a shared
88 resource. Its charts are defined under the ``oom/kubernetes/consul``
89 directory, not as part of the DCAE chart hierarchy.
90
91 The dcae-bootstrap service has a number of prerequisites because the subsequently deployed DCAE components depends on a number of resources having entered their normal operation state.  DCAE bootstrap job will not start before these resources are ready.  They are:
92
93  
94   * dcae-cloudify-manager
95   * consul-server
96   * msb-discovery
97   * kube2msb
98   * dcae-config-binding-service
99   * dcae-db
100   * dcae-mongodb
101   * dcae-inventory-api
102   
103 Additionaly tls-init-container invoked during component deployment relies on AAF to generate the required certificate hence AAF
104 must be enabled under OOM deployment configuration. 
105
106 Once started, the DCAE bootstrap service will call Cloudify Manager to deploy
107 a series of blueprints which specify the additional DCAE microservice components.
108 These blueprints use the DCAE Kubernetes plugin (``k8splugin``) to deploy
109 Docker images into the ONAP Kubernetes cluster.  For each component, the plugin
110 creates a Kubernetes deployment and other Kubernetes resources (services, volumes, logging sidecar, etc.)
111 as needed.
112
113 The DCAE bootstrap service creates the following Kubernetes deployments:
114
115 * deploy/dep-dcae-hv-ves-collector
116 * deploy/dep-dcae-prh
117 * deploy/dep-dcae-tca-analytics
118 * deploy/dep-dcae-tcagen2
119 * deploy/dep-dcae-ves-collector
120 * deploy/dep-holmes-engine-mgmt
121 * deploy/dep-holmes-rule-mgmt
122
123 After deploying all of the blueprints, the DCAE bootstrap service
124 continues to run.   The bootstrap container can be useful for
125 troubleshooting or for launching additional components.  The bootstrap
126 container logs (accessed using the ``kubectl logs`` command) show the
127 details of all of the component deployments.
128
129 DCAE Configuration
130 ------------------
131
132 Deployment time configuration of DCAE components are defined in several places.
133
134   * Helm Chart templates:
135      * Helm/Kubernetes template files can contain static values for configuration parameters;
136   * Helm Chart resources:
137      * Helm/Kubernetes resources files can contain static values for configuration parameters;
138   * Helm values.yaml files:
139      * The values.yaml files supply the values that Helm templating engine uses to expand any templates defined in Helm templates;
140      * In a Helm chart hierarchy, values defined in values.yaml files in higher level supersedes values defined in values.yaml files in lower level;
141      * Helm command line supplied values supersedes values defined in any values.yaml files.
142
143 In addition, for DCAE components deployed through Cloudify Manager blueprints, their configuration parameters are defined in the following places:
144
145      * The blueprint files can contain static values for configuration parameters;
146         * The blueprint files are defined under the ``blueprints`` directory of the ``dcaegen2/platform/blueprints`` repo, named with "k8s" prefix.
147      * The blueprint files can specify input parameters and the values of these parameters will be used for configuring parameters in Blueprints.  The values for these input parameters can be supplied in several ways as listed below in the order of precedence (low to high):
148         * The blueprint files can define default values for the input parameters;
149         * The blueprint input files can contain static values for input parameters of blueprints.  These input files are provided as config resources under the dcae-bootstrap chart;
150         * The blueprint input files may contain Helm templates, which are resolved into actual deployment time values following the rules for Helm values.
151
152
153 Now we walk through an example, how to configure the Docker image for the DCAE VESCollector, which is deployed by Cloudify Manager.
154
155 In the  `k8s-ves.yaml <https://git.onap.org/dcaegen2/platform/blueprints/tree/blueprints/k8s-ves.yaml>`_ blueprint, the Docker image to use is defined as an input parameter with a default value:
156
157 .. code-block:: yaml
158
159     tag_version:
160     type: string
161     default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.5.4"
162     
163 The corresponding input file, ``https://git.onap.org/oom/tree/kubernetes/dcaegen2/components/dcae-bootstrap/resources/inputs/k8s-ves-inputs-tls.yaml``,
164 it is defined again as:
165
166 .. code-block:: yaml
167   {{ if .Values.componentImages.ves }}
168   tag_version: {{ include "common.repository" . }}/{{ .Values.componentImages.ves }}
169   {{ end }}
170   
171
172 Thus, when ``common.repository`` and ``componentImages.ves`` are defined in the ``values.yaml`` files,
173 their values will be plugged in here and the resulting ``tag_version`` value
174 will be passed to the blueprint as the Docker image tag to use instead of the default value in the blueprint.
175
176 The ``componentImages.ves`` value is provided in the ``oom/kubernetes/dcaegen2/charts/dcae-bootstrap/values.yaml`` file:
177
178 .. code-block:: yaml
179
180   componentImages:
181     ves: onap/org.onap.dcaegen2.collectors.ves.vescollector:1.5.4
182
183
184 The final result is that when DCAE bootstrap calls Cloudify Manager to deploy the DCAE VES collector, the 1.5.4 image will be deployed.
185
186 DCAE Service Endpoints
187 ----------------------
188
189 Below is a table of default hostnames and ports for DCAE component service endpoints in Kubernetes deployment:
190     ==================   =================================   ======================================================
191     Component            Cluster Internal (host:port)        Cluster external (svc_name:port)
192     ==================   =================================   ======================================================
193     VES                  dcae-ves-collector:8443             xdcae-ves-collector.onap:30417
194     HV-VES               dcae-hv-ves-collector:6061          xdcae-hv-ves-collector.onap:30222
195     TCA                  dcae-tca-analytics:11011            xdcae-tca-analytics.onap:32010
196     TCA-Gen2             dcae-tcagen2:9091                   NA
197     PRH                  dcae-prh:8100                       NA
198     Policy Handler       policy-handler:25577                NA
199     Deployment Handler   deployment-handler:8443             NA
200     Inventory            inventory:8080                      NA
201     Config binding       config-binding-service:10000/10001  config-binding-service:30415
202     DCAE Healthcheck     dcae-healthcheck:80                 NA
203     Cloudify Manager     dcae-cloudify-manager:80            NA
204     DCAE Dashboard       dcae-dashboard:8443                 xdcae-dashboard:30419
205     ==================   =================================   ======================================================
206
207 In addition, a number of ONAP service endpoints that are used by DCAE components are listed as follows
208 for reference by DCAE developers and testers:
209
210     ====================   ============================      ================================
211     Component              Cluster Internal (host:port)      Cluster external (svc_name:port)
212     ====================   ============================      ================================
213     Consul Server          consul-server:8500                consul-server:30270
214     Robot                  robot:88                          robot:30209 TCP
215     Message router         message-router:3904               message-router:30227
216     Message router         message-router:3905               message-router:30226
217     Message router Kafka   message-router-kafka:9092         NA
218     MSB Discovery          msb-discovery:10081               msb-discovery:30281
219     Logging                log-kibana:5601                   log-kibana:30253
220     AAI                    aai:8080                          aai:30232
221     AAI                    aai:8443                          aai:30233
222     ====================   ============================      ================================
223
224 Uninstalling DCAE
225 -----------------
226
227 All of the DCAE components deployed using the OOM Helm charts will be
228 deleted by the ``helm undeploy`` command.  This command can be used to
229 uninstall all of ONAP by undeploying the top-level Helm release that was
230 created by the ``helm deploy`` command.  The command can also be used to
231 uninstall just DCAE, by having the command undeploy the `top_level_release_name`-``dcaegen2``
232 Helm sub-release.
233
234 Helm will undeploy only the components that were originally deployed using
235 Helm charts.  Components deployed by Cloudify Manager are not deleted by
236 the Helm operations.
237
238 When uninstalling all of ONAP, it is sufficient to delete the namespace
239 used for the deployment (typically ``onap``) after running the undeploy
240 operation.  Deleting the namespace will get rid of any remaining resources
241 in the namespace, including the components deployed by Cloudify Manager.
242
243 When uninstalling DCAE alone, deleting the namespace would delete the
244 rest of ONAP as well.  To delete DCAE alone, and to make sure all of the
245 DCAE components deployed by Cloudify Manager are uninstalled:
246
247 * Find the Cloudify Manager pod identifier, using a command like:
248
249   ``kubectl -n onap get pods | grep dcae-cloudify-manager``
250 * Execute the DCAE cleanup script on the Cloudify Manager pod, using a command like:
251
252   ``kubectl -n onap exec`` `cloudify-manager-pod-id` ``-- /scripts/dcae-cleanup.sh``
253 * Finally, run ``helm undeploy`` against the DCAE Helm subrelease
254
255 The DCAE cleanup script uses Cloudify Manager and the DCAE Kubernetes
256 plugin to instruct Kubernetes to delete the components deployed by Cloudify
257 Manager.  This includes the components deployed when the DCAE bootstrap
258 service ran and any components deployed after bootstrap.