Merge "[SO] Add more debug when password is not well set"
[oom.git] / docs / oom_user_guide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. Copyright 2018-2020 Amdocs, Bell Canada, Orange, Samsung
5 .. _oom_user_guide:
6
7 .. Links
8 .. _Curated applications for Kubernetes: https://github.com/kubernetes/charts
9 .. _Services: https://kubernetes.io/docs/concepts/services-networking/service/
10 .. _ReplicaSet: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
11 .. _StatefulSet: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
12 .. _Helm Documentation: https://docs.helm.sh/helm/
13 .. _Helm: https://docs.helm.sh/
14 .. _Kubernetes: https://Kubernetes.io/
15 .. _Kubernetes LoadBalancer: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
16 .. _`Docker installation guide`: https://docs.docker.com/engine/install/
17 .. _user-guide-label:
18
19 OOM User Guide
20 ##############
21
22 The ONAP Operations Manager (OOM) provide the ability to manage the entire
23 life-cycle of an ONAP installation, from the initial deployment to final
24 decommissioning. This guide provides instructions for users of ONAP to
25 use the Kubernetes_/Helm_ system as a complete ONAP management system.
26
27 This guide provides many examples of Helm command line operations.  For a
28 complete description of these commands please refer to the `Helm
29 Documentation`_.
30
31 .. figure:: oomLogoV2-medium.png
32    :align: right
33
34 The following sections describe the life-cycle operations:
35
36 - Deploy_ - with built-in component dependency management
37 - Configure_ - unified configuration across all ONAP components
38 - Monitor_ - real-time health monitoring feeding to a Consul UI and Kubernetes
39 - Heal_- failed ONAP containers are recreated automatically
40 - Scale_ - cluster ONAP services to enable seamless scaling
41 - Upgrade_ - change-out containers or configuration with little or no service
42   impact
43 - Delete_ - cleanup individual containers or entire deployments
44
45 .. figure:: oomLogoV2-Deploy.png
46    :align: right
47
48 Deploy
49 ======
50
51 The OOM team with assistance from the ONAP project teams, have built a
52 comprehensive set of Helm charts, yaml files very similar to TOSCA files, that
53 describe the composition of each of the ONAP components and the relationship
54 within and between components. Using this model Helm is able to deploy all of
55 ONAP with a few simple commands.
56
57 Pre-requisites
58 --------------
59 Your environment must have Docker installed as well as both the Kubernetes
60 `kubectl` and Helm setup as a one time activity.
61
62 Install Docker
63 ~~~~~~~~~~~~~~
64 Follow official `Docker installation guide`_.
65
66 Install Kubectl
67 ~~~~~~~~~~~~~~~
68 Enter the following to install kubectl (on Ubuntu, there are slight differences
69 on other O/Ss), the Kubernetes command line interface used to manage a
70 Kubernetes cluster::
71
72   > curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
73   > chmod +x ./kubectl
74   > sudo mv ./kubectl /usr/local/bin/kubectl
75   > mkdir ~/.kube
76
77 Paste kubectl config from Rancher (see the :ref:`cloud-setup-guide-label` for
78 alternative Kubernetes environment setups) into the `~/.kube/config` file.
79
80 Verify that the Kubernetes config is correct::
81
82   > kubectl get pods --all-namespaces
83
84 At this point you should see six Kubernetes pods running.
85
86 Install Helm
87 ~~~~~~~~~~~~
88 Helm is used by OOM for package and configuration management. To install Helm,
89 enter the following::
90
91   > wget http://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
92   > tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
93   > sudo mv linux-amd64/helm /usr/local/bin/helm
94
95 Verify the Helm version with::
96
97   > helm version
98
99 Install the Helm Tiller application and initialize with::
100
101   > helm init
102
103 Install the Helm Repo
104 ---------------------
105 Once kubectl and Helm are setup, one needs to setup a local Helm server to
106 server up the ONAP charts::
107
108   > helm install osn/onap
109
110 .. note::
111   The osn repo is not currently available so creation of a local repository is
112   required.
113
114 Helm is able to use charts served up from a repository and comes setup with a
115 default CNCF provided `Curated applications for Kubernetes`_ repository called
116 stable which should be removed to avoid confusion::
117
118   > helm repo remove stable
119
120 .. To setup the Open Source Networking Nexus repository for helm enter::
121 ..  > helm repo add osn 'https://nexus3.onap.org:10001/helm/helm-repo-in-nexus/master/'
122
123 To prepare your system for an installation of ONAP, you'll need to::
124
125   > git clone -b frankfurt --recurse-submodules -j2 http://gerrit.onap.org/r/oom
126   > cd oom/kubernetes
127
128
129 To setup a local Helm server to server up the ONAP charts::
130
131   > helm init
132   > helm serve &
133
134 Note the port number that is listed and use it in the Helm repo add as
135 follows::
136
137   > helm repo add local http://127.0.0.1:8879
138
139 To get a list of all of the available Helm chart repositories::
140
141   > helm repo list
142   NAME   URL
143   local  http://127.0.0.1:8879
144
145 Then build your local Helm repository::
146
147   > make SKIP_LINT=TRUE [HELM_BIN=<HELM_PATH>] all
148
149 `HELM_BIN`
150   Sets the helm binary to be used. The default value use helm from PATH. Allow the user to have
151   multiple version of helm in operating system and choose which one to use.
152
153 The Helm search command reads through all of the repositories configured on the
154 system, and looks for matches::
155
156   > helm search -l
157   NAME                    VERSION    DESCRIPTION
158   local/appc              7.0.0      Application Controller
159   local/clamp             7.0.0      ONAP Clamp
160   local/common            7.0.0      Common templates for inclusion in other charts
161   local/onap              7.0.0      Open Network Automation Platform (ONAP)
162   local/robot             7.0.0      A helm Chart for kubernetes-ONAP Robot
163   local/so                7.0.0      ONAP Service Orchestrator
164
165 In any case, setup of the Helm repository is a one time activity.
166
167 Next, install Helm Plugins required to deploy the ONAP Casablanca release::
168
169   > cp -R helm/plugins/ ~/.helm
170
171 Once the repo is setup, installation of ONAP can be done with a single
172 command::
173
174   > helm deploy development local/onap --namespace onap
175
176 This will install ONAP from a local repository in a 'development' Helm release.
177 As described below, to override the default configuration values provided by
178 OOM, an environment file can be provided on the command line as follows::
179
180   > helm deploy development local/onap --namespace onap -f overrides.yaml
181
182 To get a summary of the status of all of the pods (containers) running in your
183 deployment::
184
185   > kubectl get pods --all-namespaces -o=wide
186
187 .. note::
188   The Kubernetes namespace concept allows for multiple instances of a component
189   (such as all of ONAP) to co-exist with other components in the same
190   Kubernetes cluster by isolating them entirely.  Namespaces share only the
191   hosts that form the cluster thus providing isolation between production and
192   development systems as an example.  The OOM deployment of ONAP in Beijing is
193   now done within a single Kubernetes namespace where in Amsterdam a namespace
194   was created for each of the ONAP components.
195
196 .. note::
197   The Helm `--name` option refers to a release name and not a Kubernetes namespace.
198
199
200 To install a specific version of a single ONAP component (`so` in this example)
201 with the given release name enter::
202
203   > helm deploy so onap/so --version 3.0.1
204
205 To display details of a specific resource or group of resources type::
206
207   > kubectl describe pod so-1071802958-6twbl
208
209 where the pod identifier refers to the auto-generated pod identifier.
210
211 .. figure:: oomLogoV2-Configure.png
212    :align: right
213
214 Configure
215 =========
216
217 Each project within ONAP has its own configuration data generally consisting
218 of: environment variables, configuration files, and database initial values.
219 Many technologies are used across the projects resulting in significant
220 operational complexity and an inability to apply global parameters across the
221 entire ONAP deployment. OOM solves this problem by introducing a common
222 configuration technology, Helm charts, that provide a hierarchical
223 configuration with the ability to override values with higher
224 level charts or command line options.
225
226 The structure of the configuration of ONAP is shown in the following diagram.
227 Note that key/value pairs of a parent will always take precedence over those
228 of a child. Also note that values set on the command line have the highest
229 precedence of all.
230
231 .. graphviz::
232
233    digraph config {
234       {
235          node     [shape=folder]
236          oValues  [label="values.yaml"]
237          demo     [label="onap-demo.yaml"]
238          prod     [label="onap-production.yaml"]
239          oReq     [label="requirements.yaml"]
240          soValues [label="values.yaml"]
241          soReq    [label="requirements.yaml"]
242          mdValues [label="values.yaml"]
243       }
244       {
245          oResources  [label="resources"]
246       }
247       onap -> oResources
248       onap -> oValues
249       oResources -> environments
250       oResources -> oReq
251       oReq -> so
252       environments -> demo
253       environments -> prod
254       so -> soValues
255       so -> soReq
256       so -> charts
257       charts -> mariadb
258       mariadb -> mdValues
259
260    }
261
262 The top level onap/values.yaml file contains the values required to be set
263 before deploying ONAP.  Here is the contents of this file:
264
265 .. include:: ../kubernetes/onap/values.yaml
266    :code: yaml
267
268 One may wish to create a value file that is specific to a given deployment such
269 that it can be differentiated from other deployments.  For example, a
270 onap-development.yaml file may create a minimal environment for development
271 while onap-production.yaml might describe a production deployment that operates
272 independently of the developer version.
273
274 For example, if the production OpenStack instance was different from a
275 developer's instance, the onap-production.yaml file may contain a different
276 value for the vnfDeployment/openstack/oam_network_cidr key as shown below.
277
278 .. code-block:: yaml
279
280   nsPrefix: onap
281   nodePortPrefix: 302
282   apps: consul msb mso message-router sdnc vid robot portal policy appc aai
283   sdc dcaegen2 log cli multicloud clamp vnfsdk aaf kube2msb
284   dataRootDir: /dockerdata-nfs
285
286   # docker repositories
287   repository:
288     onap: nexus3.onap.org:10001
289     oom: oomk8s
290     aai: aaionap
291     filebeat: docker.elastic.co
292
293   image:
294     pullPolicy: Never
295
296   # vnf deployment environment
297   vnfDeployment:
298     openstack:
299       ubuntu_14_image: "Ubuntu_14.04.5_LTS"
300       public_net_id: "e8f51956-00dd-4425-af36-045716781ffc"
301       oam_network_id: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6"
302       oam_subnet_id: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e"
303       oam_network_cidr: "192.168.30.0/24"
304   <...>
305
306
307 To deploy ONAP with this environment file, enter::
308
309   > helm deploy local/onap -n onap -f environments/onap-production.yaml
310
311 .. include:: environments_onap_demo.yaml
312    :code: yaml
313
314 When deploying all of ONAP a requirements.yaml file control which and what
315 version of the ONAP components are included.  Here is an excerpt of this
316 file:
317
318 .. code-block:: yaml
319
320   # Referencing a named repo called 'local'.
321   # Can add this repo by running commands like:
322   # > helm serve
323   # > helm repo add local http://127.0.0.1:8879
324   dependencies:
325   <...>
326     - name: so
327       version: ~2.0.0
328       repository: '@local'
329       condition: so.enabled
330   <...>
331
332 The ~ operator in the `so` version value indicates that the latest "2.X.X"
333 version of `so` shall be used thus allowing the chart to allow for minor
334 upgrades that don't impact the so API; hence, version 2.0.1 will be installed
335 in this case.
336
337 The onap/resources/environment/onap-dev.yaml (see the excerpt below) enables
338 for fine grained control on what components are included as part of this
339 deployment. By changing this `so` line to `enabled: false` the `so` component
340 will not be deployed.  If this change is part of an upgrade the existing `so`
341 component will be shut down. Other `so` parameters and even `so` child values
342 can be modified, for example the `so`'s `liveness` probe could be disabled
343 (which is not recommended as this change would disable auto-healing of `so`).
344
345 .. code-block:: yaml
346
347   #################################################################
348   # Global configuration overrides.
349   #
350   # These overrides will affect all helm charts (ie. applications)
351   # that are listed below and are 'enabled'.
352   #################################################################
353   global:
354   <...>
355
356   #################################################################
357   # Enable/disable and configure helm charts (ie. applications)
358   # to customize the ONAP deployment.
359   #################################################################
360   aaf:
361     enabled: false
362   <...>
363   so: # Service Orchestrator
364     enabled: true
365
366     replicaCount: 1
367
368     liveness:
369       # necessary to disable liveness probe when setting breakpoints
370       # in debugger so K8s doesn't restart unresponsive container
371       enabled: true
372
373   <...>
374
375 Accessing the ONAP Portal using OOM and a Kubernetes Cluster
376 ------------------------------------------------------------
377
378 The ONAP deployment created by OOM operates in a private IP network that isn't
379 publicly accessible (i.e. OpenStack VMs with private internal network) which
380 blocks access to the ONAP Portal. To enable direct access to this Portal from a
381 user's own environment (a laptop etc.) the portal application's port 8989 is
382 exposed through a `Kubernetes LoadBalancer`_ object.
383
384 Typically, to be able to access the Kubernetes nodes publicly a public address
385 is assigned. In OpenStack this is a floating IP address.
386
387 When the `portal-app` chart is deployed a Kubernetes service is created that
388 instantiates a load balancer.  The LB chooses the private interface of one of
389 the nodes as in the example below (10.0.0.4 is private to the K8s cluster only).
390 Then to be able to access the portal on port 8989 from outside the K8s &
391 OpenStack environment, the user needs to assign/get the floating IP address that
392 corresponds to the private IP as follows::
393
394   > kubectl -n onap get services|grep "portal-app"
395   portal-app  LoadBalancer   10.43.142.201   10.0.0.4   8989:30215/TCP,8006:30213/TCP,8010:30214/TCP   1d   app=portal-app,release=dev
396
397
398 In this example, use the 10.0.0.4 private address as a key find the
399 corresponding public address which in this example is 10.12.6.155. If you're
400 using OpenStack you'll do the lookup with the horizon GUI or the OpenStack CLI
401 for your tenant (openstack server list).  That IP is then used in your
402 `/etc/hosts` to map the fixed DNS aliases required by the ONAP Portal as shown
403 below::
404
405   10.12.6.155 portal.api.simpledemo.onap.org
406   10.12.6.155 vid.api.simpledemo.onap.org
407   10.12.6.155 sdc.api.fe.simpledemo.onap.org
408   10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
409   10.12.6.155 sdc.dcae.plugin.simpledemo.onap.org
410   10.12.6.155 portal-sdk.simpledemo.onap.org
411   10.12.6.155 policy.api.simpledemo.onap.org
412   10.12.6.155 aai.api.sparky.simpledemo.onap.org
413   10.12.6.155 cli.api.simpledemo.onap.org
414   10.12.6.155 msb.api.discovery.simpledemo.onap.org
415   10.12.6.155 msb.api.simpledemo.onap.org
416   10.12.6.155 clamp.api.simpledemo.onap.org
417   10.12.6.155 so.api.simpledemo.onap.org
418   10.12.6.155 sdc.workflow.plugin.simpledemo.onap.org
419
420 Ensure you've disabled any proxy settings the browser you are using to access
421 the portal and then simply access now the new ssl-encrypted URL:
422 ``https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm``
423
424 .. note::
425   Using the HTTPS based Portal URL the Browser needs to be configured to accept
426   unsecure credentials.
427   Additionally when opening an Application inside the Portal, the Browser
428   might block the content, which requires to disable the blocking and reloading
429   of the page
430
431 .. note::
432   Besides the ONAP Portal the Components can deliver additional user interfaces,
433   please check the Component specific documentation.
434
435 .. note::
436
437    | Alternatives Considered:
438
439    -  Kubernetes port forwarding was considered but discarded as it would require
440       the end user to run a script that opens up port forwarding tunnels to each of
441       the pods that provides a portal application widget.
442
443    -  Reverting to a VNC server similar to what was deployed in the Amsterdam
444       release was also considered but there were many issues with resolution, lack
445       of volume mount, /etc/hosts dynamic update, file upload that were a tall order
446       to solve in time for the Beijing release.
447
448    Observations:
449
450    -  If you are not using floating IPs in your Kubernetes deployment and directly attaching
451       a public IP address (i.e. by using your public provider network) to your K8S Node
452       VMs' network interface, then the output of 'kubectl -n onap get services | grep "portal-app"'
453       will show your public IP instead of the private network's IP. Therefore,
454       you can grab this public IP directly (as compared to trying to find the floating
455       IP first) and map this IP in /etc/hosts.
456
457 .. figure:: oomLogoV2-Monitor.png
458    :align: right
459
460 Monitor
461 =======
462
463 All highly available systems include at least one facility to monitor the
464 health of components within the system.  Such health monitors are often used as
465 inputs to distributed coordination systems (such as etcd, Zookeeper, or Consul)
466 and monitoring systems (such as Nagios or Zabbix). OOM provides two mechanisms
467 to monitor the real-time health of an ONAP deployment:
468
469 - a Consul GUI for a human operator or downstream monitoring systems and
470   Kubernetes liveness probes that enable automatic healing of failed
471   containers, and
472 - a set of liveness probes which feed into the Kubernetes manager which
473   are described in the Heal section.
474
475 Within ONAP, Consul is the monitoring system of choice and deployed by OOM in
476 two parts:
477
478 - a three-way, centralized Consul server cluster is deployed as a highly
479   available monitor of all of the ONAP components, and
480 - a number of Consul agents.
481
482 The Consul server provides a user interface that allows a user to graphically
483 view the current health status of all of the ONAP components for which agents
484 have been created - a sample from the ONAP Integration labs follows:
485
486 .. figure:: consulHealth.png
487    :align: center
488
489 To see the real-time health of a deployment go to: ``http://<kubernetes IP>:30270/ui/``
490 where a GUI much like the following will be found:
491
492
493 .. figure:: oomLogoV2-Heal.png
494    :align: right
495
496 Heal
497 ====
498
499 The ONAP deployment is defined by Helm charts as mentioned earlier.  These Helm
500 charts are also used to implement automatic recoverability of ONAP components
501 when individual components fail. Once ONAP is deployed, a "liveness" probe
502 starts checking the health of the components after a specified startup time.
503
504 Should a liveness probe indicate a failed container it will be terminated and a
505 replacement will be started in its place - containers are ephemeral. Should the
506 deployment specification indicate that there are one or more dependencies to
507 this container or component (for example a dependency on a database) the
508 dependency will be satisfied before the replacement container/component is
509 started. This mechanism ensures that, after a failure, all of the ONAP
510 components restart successfully.
511
512 To test healing, the following command can be used to delete a pod::
513
514   > kubectl delete pod [pod name] -n [pod namespace]
515
516 One could then use the following command to monitor the pods and observe the
517 pod being terminated and the service being automatically healed with the
518 creation of a replacement pod::
519
520   > kubectl get pods --all-namespaces -o=wide
521
522 .. figure:: oomLogoV2-Scale.png
523    :align: right
524
525 Scale
526 =====
527
528 Many of the ONAP components are horizontally scalable which allows them to
529 adapt to expected offered load.  During the Beijing release scaling is static,
530 that is during deployment or upgrade a cluster size is defined and this cluster
531 will be maintained even in the presence of faults. The parameter that controls
532 the cluster size of a given component is found in the values.yaml file for that
533 component.  Here is an excerpt that shows this parameter:
534
535 .. code-block:: yaml
536
537   # default number of instances
538   replicaCount: 1
539
540 In order to change the size of a cluster, an operator could use a helm upgrade
541 (described in detail in the next section) as follows::
542
543   > helm upgrade --set replicaCount=3 onap/so/mariadb
544
545 The ONAP components use Kubernetes provided facilities to build clustered,
546 highly available systems including: Services_ with load-balancers, ReplicaSet_,
547 and StatefulSet_.  Some of the open-source projects used by the ONAP components
548 directly support clustered configurations, for example ODL and MariaDB Galera.
549
550 The Kubernetes Services_ abstraction to provide a consistent access point for
551 each of the ONAP components, independent of the pod or container architecture
552 of that component.  For example, SDN-C uses OpenDaylight clustering with a
553 default cluster size of three but uses a Kubernetes service to and change the
554 number of pods in this abstract this cluster from the other ONAP components
555 such that the cluster could change size and this change is isolated from the
556 other ONAP components by the load-balancer implemented in the ODL service
557 abstraction.
558
559 A ReplicaSet_ is a construct that is used to describe the desired state of the
560 cluster.  For example 'replicas: 3' indicates to Kubernetes that a cluster of 3
561 instances is the desired state.  Should one of the members of the cluster fail,
562 a new member will be automatically started to replace it.
563
564 Some of the ONAP components many need a more deterministic deployment; for
565 example to enable intra-cluster communication. For these applications the
566 component can be deployed as a Kubernetes StatefulSet_ which will maintain a
567 persistent identifier for the pods and thus a stable network id for the pods.
568 For example: the pod names might be web-0, web-1, web-{N-1} for N 'web' pods
569 with corresponding DNS entries such that intra service communication is simple
570 even if the pods are physically distributed across multiple nodes. An example
571 of how these capabilities can be used is described in the Running Consul on
572 Kubernetes tutorial.
573
574 .. figure:: oomLogoV2-Upgrade.png
575    :align: right
576
577 Upgrade
578 =======
579
580 Helm has built-in capabilities to enable the upgrade of pods without causing a
581 loss of the service being provided by that pod or pods (if configured as a
582 cluster).  As described in the OOM Developer's Guide, ONAP components provide
583 an abstracted 'service' end point with the pods or containers providing this
584 service hidden from other ONAP components by a load balancer. This capability
585 is used during upgrades to allow a pod with a new image to be added to the
586 service before removing the pod with the old image. This 'make before break'
587 capability ensures minimal downtime.
588
589 Prior to doing an upgrade, determine of the status of the deployed charts::
590
591   > helm list
592   NAME REVISION UPDATED                  STATUS    CHART     NAMESPACE
593   so   1        Mon Feb 5 10:05:22 2018  DEPLOYED  so-2.0.1  default
594
595 When upgrading a cluster a parameter controls the minimum size of the cluster
596 during the upgrade while another parameter controls the maximum number of nodes
597 in the cluster.  For example, SNDC configured as a 3-way ODL cluster might
598 require that during the upgrade no fewer than 2 pods are available at all times
599 to provide service while no more than 5 pods are ever deployed across the two
600 versions at any one time to avoid depleting the cluster of resources. In this
601 scenario, the SDNC cluster would start with 3 old pods then Kubernetes may add
602 a new pod (3 old, 1 new), delete one old (2 old, 1 new), add two new pods (2
603 old, 3 new) and finally delete the 2 old pods (3 new).  During this sequence
604 the constraints of the minimum of two pods and maximum of five would be
605 maintained while providing service the whole time.
606
607 Initiation of an upgrade is triggered by changes in the Helm charts.  For
608 example, if the image specified for one of the pods in the SDNC deployment
609 specification were to change (i.e. point to a new Docker image in the nexus3
610 repository - commonly through the change of a deployment variable), the
611 sequence of events described in the previous paragraph would be initiated.
612
613 For example, to upgrade a container by changing configuration, specifically an
614 environment value::
615
616   > helm deploy onap onap/so --version 2.0.1 --set enableDebug=true
617
618 Issuing this command will result in the appropriate container being stopped by
619 Kubernetes and replaced with a new container with the new environment value.
620
621 To upgrade a component to a new version with a new configuration file enter::
622
623   > helm deploy onap onap/so --version 2.0.2 -f environments/demo.yaml
624
625 To fetch release history enter::
626
627   > helm history so
628   REVISION UPDATED                  STATUS     CHART     DESCRIPTION
629   1        Mon Feb 5 10:05:22 2018  SUPERSEDED so-2.0.1  Install complete
630   2        Mon Feb 5 10:10:55 2018  DEPLOYED   so-2.0.2  Upgrade complete
631
632 Unfortunately, not all upgrades are successful.  In recognition of this the
633 lineup of pods within an ONAP deployment is tagged such that an administrator
634 may force the ONAP deployment back to the previously tagged configuration or to
635 a specific configuration, say to jump back two steps if an incompatibility
636 between two ONAP components is discovered after the two individual upgrades
637 succeeded.
638
639 This rollback functionality gives the administrator confidence that in the
640 unfortunate circumstance of a failed upgrade the system can be rapidly brought
641 back to a known good state.  This process of rolling upgrades while under
642 service is illustrated in this short YouTube video showing a Zero Downtime
643 Upgrade of a web application while under a 10 million transaction per second
644 load.
645
646 For example, to roll-back back to previous system revision enter::
647
648   > helm rollback so 1
649
650   > helm history so
651   REVISION UPDATED                  STATUS     CHART     DESCRIPTION
652   1        Mon Feb 5 10:05:22 2018  SUPERSEDED so-2.0.1  Install complete
653   2        Mon Feb 5 10:10:55 2018  SUPERSEDED so-2.0.2  Upgrade complete
654   3        Mon Feb 5 10:14:32 2018  DEPLOYED   so-2.0.1  Rollback to 1
655
656 .. note::
657
658   The description field can be overridden to document actions taken or include
659   tracking numbers.
660
661 Many of the ONAP components contain their own databases which are used to
662 record configuration or state information.  The schemas of these databases may
663 change from version to version in such a way that data stored within the
664 database needs to be migrated between versions. If such a migration script is
665 available it can be invoked during the upgrade (or rollback) by Container
666 Lifecycle Hooks. Two such hooks are available, PostStart and PreStop, which
667 containers can access by registering a handler against one or both. Note that
668 it is the responsibility of the ONAP component owners to implement the hook
669 handlers - which could be a shell script or a call to a specific container HTTP
670 endpoint - following the guidelines listed on the Kubernetes site. Lifecycle
671 hooks are not restricted to database migration or even upgrades but can be used
672 anywhere specific operations need to be taken during lifecycle operations.
673
674 OOM uses Helm K8S package manager to deploy ONAP components. Each component is
675 arranged in a packaging format called a chart - a collection of files that
676 describe a set of k8s resources. Helm allows for rolling upgrades of the ONAP
677 component deployed. To upgrade a component Helm release you will need an
678 updated Helm chart. The chart might have modified, deleted or added values,
679 deployment yamls, and more.  To get the release name use::
680
681   > helm ls
682
683 To easily upgrade the release use::
684
685   > helm upgrade [RELEASE] [CHART]
686
687 To roll back to a previous release version use::
688
689   > helm rollback [flags] [RELEASE] [REVISION]
690
691 For example, to upgrade the onap-so helm release to the latest SO container
692 release v1.1.2:
693
694 - Edit so values.yaml which is part of the chart
695 - Change "so: nexus3.onap.org:10001/openecomp/so:v1.1.1" to
696   "so: nexus3.onap.org:10001/openecomp/so:v1.1.2"
697 - From the chart location run::
698
699   > helm upgrade onap-so
700
701 The previous so pod will be terminated and a new so pod with an updated so
702 container will be created.
703
704 .. figure:: oomLogoV2-Delete.png
705    :align: right
706
707 Delete
708 ======
709
710 Existing deployments can be partially or fully removed once they are no longer
711 needed.  To minimize errors it is recommended that before deleting components
712 from a running deployment the operator perform a 'dry-run' to display exactly
713 what will happen with a given command prior to actually deleting anything.  For
714 example::
715
716   > helm undeploy onap --dry-run
717
718 will display the outcome of deleting the 'onap' release from the
719 deployment.
720 To completely delete a release and remove it from the internal store enter::
721
722   > helm undeploy onap --purge
723
724 One can also remove individual components from a deployment by changing the
725 ONAP configuration values.  For example, to remove `so` from a running
726 deployment enter::
727
728   > helm undeploy onap-so --purge
729
730 will remove `so` as the configuration indicates it's no longer part of the
731 deployment. This might be useful if a one wanted to replace just `so` by
732 installing a custom version.