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