blob: a2ccc1ba60244c2cba7476470c9efa1b1c2b049b [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.. _Helm: https://docs.helm.sh/
Roger Maitlandac643812018-03-28 09:52:34 -04007.. _Helm Charts: https://github.com/kubernetes/charts
Roger Maitland953b5f12018-03-22 15:24:04 -04008.. _Kubernetes: https://Kubernetes.io/
9.. _Docker: https://www.docker.com/
10.. _Nexus: https://nexus.onap.org/#welcome
11.. _AWS Elastic Block Store: https://aws.amazon.com/ebs/
12.. _Azure File: https://docs.microsoft.com/en-us/azure/storage/files/storage-files-introduction
13.. _GCE Persistent Disk: https://cloud.google.com/compute/docs/disks/
14.. _Gluster FS: https://www.gluster.org/
15.. _Kubernetes Storage Class: https://Kubernetes.io/docs/concepts/storage/storage-classes/
16.. _Assigning Pods to Nodes: https://Kubernetes.io/docs/concepts/configuration/assign-pod-node/
17
Roger Maitlandac643812018-03-28 09:52:34 -040018
Roger Maitland953b5f12018-03-22 15:24:04 -040019.. _developer-guide-label:
20
21OOM Developer Guide
22###################
23
24.. figure:: oomLogoV2-medium.png
25 :align: right
26
27ONAP consists of a large number of components, each of which are substantial
28projects within themselves, which results in a high degree of complexity in
29deployment and management. To cope with this complexity the ONAP Operations
30Manager (OOM) uses a Helm_ model of ONAP - Helm being the primary management
31system for Kubernetes_ container systems - to drive all user driven life-cycle
32management operations. The Helm model of ONAP is composed of a set of
33hierarchical Helm charts that define the structure of the ONAP components and
34the configuration of these components. These charts are fully parameterized
35such that a single environment file defines all of the parameters needed to
36deploy ONAP. A user of ONAP may maintain several such environment files to
37control the deployment of ONAP in multiple environments such as development,
38pre-production, and production.
39
40The following sections describe how the ONAP Helm charts are constructed.
41
42.. contents::
43 :depth: 3
44 :local:
45..
46
47Container Background
48====================
49Linux containers allow for an application and all of its operating system
50dependencies to be packaged and deployed as a single unit without including a
51guest operating system as done with virtual machines. The most popular
52container solution is Docker_ which provides tools for container management
53like the Docker Host (dockerd) which can create, run, stop, move, or delete a
54container. Docker has a very popular registry of containers images that can be
55used by any Docker system; however, in the ONAP context, Docker images are
56built by the standard CI/CD flow and stored in Nexus_ repositories. OOM uses
57the "standard" ONAP docker containers and three new ones specifically created
58for OOM.
59
60Containers are isolated from each other primarily via name spaces within the
61Linux kernel without the need for multiple guest operating systems. As such,
62multiple containers can be deployed with little overhead such as all of ONAP
63can be deployed on a single host. With some optimization of the ONAP components
64(e.g. elimination of redundant database instances) it may be possible to deploy
65ONAP on a single laptop computer.
66
67Helm Charts
68===========
Roger Maitlandac643812018-03-28 09:52:34 -040069A Helm chart is a collection of files that describe a related set of Kubernetes
70resources. A simple chart might be used to deploy something simple, like a
71memcached pod, while a complex chart might contain many micro-service arranged
72in a hierarchy as found in the `aai` ONAP component.
Roger Maitland953b5f12018-03-22 15:24:04 -040073
Roger Maitlandac643812018-03-28 09:52:34 -040074Charts are created as files laid out in a particular directory tree, then they
75can be packaged into versioned archives to be deployed. There is a public
76archive of `Helm Charts`_ on GitHub that includes many technologies applicable
77to ONAP. Some of these charts have been used in ONAP and all of the ONAP charts
78have been created following the guidelines provided.
Roger Maitland953b5f12018-03-22 15:24:04 -040079
Roger Maitlandac643812018-03-28 09:52:34 -040080The top level of the ONAP charts is shown below:
Roger Maitland953b5f12018-03-22 15:24:04 -040081
82.. graphviz::
83
Roger Maitlandac643812018-03-28 09:52:34 -040084 digraph onap_top_chart {
85 rankdir="LR";
Roger Maitland953b5f12018-03-22 15:24:04 -040086 {
Roger Maitlandac643812018-03-28 09:52:34 -040087 node [shape=folder]
88 oValues [label="values.yaml"]
89 oChart [label="Chart.yaml"]
90 dev [label="dev.yaml"]
91 prod [label="prod.yaml"]
92 crb [label="clusterrolebindings.yaml"]
93 secrets [label="secrets.yaml"]
Roger Maitland953b5f12018-03-22 15:24:04 -040094 }
95 {
Roger Maitlandac643812018-03-28 09:52:34 -040096 node [style=dashed]
97 vCom [label="component"]
Roger Maitland953b5f12018-03-22 15:24:04 -040098 }
99
Roger Maitlandac643812018-03-28 09:52:34 -0400100 onap -> oValues
101 onap -> oChart
102 onap -> templates
103 onap -> resources
104 oValues -> vCom
105 resources -> environments
106 environments -> dev
107 environments -> prod
108 templates -> crb
109 templates -> secrets
Roger Maitland953b5f12018-03-22 15:24:04 -0400110 }
111
Roger Maitlandac643812018-03-28 09:52:34 -0400112Within the `values.yaml` file at the `onap` level, one will find a set of
113boolean values that control which of the ONAP components get deployed as shown
114below:
Roger Maitland953b5f12018-03-22 15:24:04 -0400115
116.. code-block:: yaml
117
Roger Maitlandac643812018-03-28 09:52:34 -0400118 aaf: # Application Authorization Framework
119 enabled: false
120 <...>
121 so: # Service Orchestrator
122 enabled: true
Roger Maitland953b5f12018-03-22 15:24:04 -0400123
Roger Maitlandac643812018-03-28 09:52:34 -0400124By setting these flags a custom deployment can be created and used during
125deployment by using the `-f` Helm option as follows::
Roger Maitland953b5f12018-03-22 15:24:04 -0400126
Roger Maitlandac643812018-03-28 09:52:34 -0400127 > helm install local/onap -name development -f dev.yaml
Roger Maitland953b5f12018-03-22 15:24:04 -0400128
Roger Maitlandac643812018-03-28 09:52:34 -0400129Note that there are one or more example deployment files in the
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100130`onap/resources/environments/` directory. It is best practice to create a
131unique deployment file for each environment used to ensure consistent
132behaviour.
Roger Maitland953b5f12018-03-22 15:24:04 -0400133
Roger Maitlandac643812018-03-28 09:52:34 -0400134To aid in the long term supportability of ONAP, a set of common charts have
135been created (and will be expanded in subsequent releases of ONAP) that can be
136used by any of the ONAP components by including the common component in its
137`requirements.yaml` file. The common components are arranged as follows:
Roger Maitland953b5f12018-03-22 15:24:04 -0400138
Roger Maitlandac643812018-03-28 09:52:34 -0400139.. graphviz::
Roger Maitland953b5f12018-03-22 15:24:04 -0400140
Roger Maitlandac643812018-03-28 09:52:34 -0400141 digraph onap_common_chart {
142 rankdir="LR";
143 {
144 node [shape=folder]
145 mValues [label="values.yaml"]
146 ccValues [label="values.yaml"]
147 comValues [label="values.yaml"]
148 comChart [label="Chart.yaml"]
149 ccChart [label="Chart.yaml"]
150 mChart [label="Chart.yaml"]
Roger Maitland953b5f12018-03-22 15:24:04 -0400151
Roger Maitlandac643812018-03-28 09:52:34 -0400152 mReq [label="requirements.yaml"]
153 mService [label="service.yaml"]
154 mMap [label="configmap.yaml"]
155 ccName [label="_name.tpl"]
156 ccNS [label="_namespace.tpl"]
157 }
158 {
159 cCom [label="common"]
160 mTemp [label="templates"]
161 ccTemp [label="templates"]
162 }
163 {
164 more [label="...",style=dashed]
165 }
Roger Maitland953b5f12018-03-22 15:24:04 -0400166
Roger Maitlandac643812018-03-28 09:52:34 -0400167 common -> comValues
168 common -> comChart
169 common -> cCom
170 common -> mysql
171 common -> more
Roger Maitland953b5f12018-03-22 15:24:04 -0400172
Roger Maitlandac643812018-03-28 09:52:34 -0400173 cCom -> ccChart
174 cCom -> ccValues
175 cCom -> ccTemp
176 ccTemp -> ccName
177 ccTemp -> ccNS
Roger Maitland953b5f12018-03-22 15:24:04 -0400178
Roger Maitlandac643812018-03-28 09:52:34 -0400179 mysql -> mValues
180 mysql -> mChart
181 mysql -> mReq
182 mysql -> mTemp
183 mTemp -> mService
184 mTemp -> mMap
185 }
Roger Maitland953b5f12018-03-22 15:24:04 -0400186
Roger Maitlandac643812018-03-28 09:52:34 -0400187The common section of charts consists of a set of templates that assist with
188parameter substitution (`_name.tpl` and `_namespace.tpl`) and a set of charts
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100189for components used throughout ONAP. Initially `mysql` is in the common area
190but this will expand to include other databases like `mariadb-galera`,
191`postgres`, and `cassandra`. Other candidates for common components include
192`redis` and`kafka`. When the common components are used by other charts they
193are instantiated each time. In subsequent ONAP releases some of the common
Roger Maitlandac643812018-03-28 09:52:34 -0400194components could be a setup as services that are used by multiple ONAP
195components thus minimizing the deployment and operational costs.
Roger Maitland953b5f12018-03-22 15:24:04 -0400196
Roger Maitlandac643812018-03-28 09:52:34 -0400197All of the ONAP components have charts that follow the pattern shown below:
Roger Maitland953b5f12018-03-22 15:24:04 -0400198
Roger Maitlandac643812018-03-28 09:52:34 -0400199.. graphviz::
Roger Maitland953b5f12018-03-22 15:24:04 -0400200
Roger Maitlandac643812018-03-28 09:52:34 -0400201 digraph onap_component_chart {
202 rankdir="LR";
203 {
204 node [shape=folder]
205 cValues [label="values.yaml"]
206 cChart [label="Chart.yaml"]
207 cService [label="service.yaml"]
208 cMap [label="configmap.yaml"]
209 cFiles [label="config file(s)"]
210 }
211 {
212 cCharts [label="charts"]
213 cTemp [label="templates"]
214 cRes [label="resources"]
Roger Maitland953b5f12018-03-22 15:24:04 -0400215
Roger Maitlandac643812018-03-28 09:52:34 -0400216 }
217 {
218 sCom [label="component",style=dashed]
219 }
Roger Maitland953b5f12018-03-22 15:24:04 -0400220
Roger Maitlandac643812018-03-28 09:52:34 -0400221 component -> cValues
222 component -> cChart
223 component -> cCharts
224 component -> cTemp
225 component -> cRes
226 cTemp -> cService
227 cTemp -> cMap
228 cRes -> config
229 config -> cFiles
230 cCharts -> sCom
231 }
Roger Maitland953b5f12018-03-22 15:24:04 -0400232
Roger Maitlandac643812018-03-28 09:52:34 -0400233Note that the component charts may include a hierarchy of components and in
234themselves can be quite complex.
Roger Maitland953b5f12018-03-22 15:24:04 -0400235
Roger Maitlandac643812018-03-28 09:52:34 -0400236Configuration of the components varies somewhat from component to component but
237generally follows the pattern of one or more `configmap.yaml` files which can
238directly provide configuration to the containers in addition to processing
239configuration files stored in the `config` directory. It is the responsibility
240of each ONAP component team to update these configuration files when changes
241are made to the project containers that impact configuration.
Roger Maitland953b5f12018-03-22 15:24:04 -0400242
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100243The following section describes how the hierarchical ONAP configuration system
244is key to management of such a large system.
Roger Maitland953b5f12018-03-22 15:24:04 -0400245
246Configuration Management
247========================
248
249ONAP is a large system composed of many components - each of which are complex
250systems in themselves - that needs to be deployed in a number of different
251ways. For example, within a single operator's network there may be R&D
252deployments under active development, pre-production versions undergoing system
253testing and production systems that are operating live networks. Each of these
254deployments will differ in significant ways, such as the version of the
255software images deployed. In addition, there may be a number of application
256specific configuration differences, such as operating system environment
257variables. The following describes how the Helm configuration management
258system is used within the OOM project to manage both ONAP infrastructure
259configuration as well as ONAP components configuration.
260
261One of the artifacts that OOM/Kubernetes uses to deploy ONAP components is the
262deployment specification, yet another yaml file. Within these deployment specs
263are a number of parameters as shown in the following mariadb example:
264
265.. code-block:: yaml
266
267 apiVersion: extensions/v1beta1
268 kind: Deployment
269 metadata:
270 name: mariadb
271 spec:
272 <...>
273 template:
274 <...>
275 spec:
276 hostname: mariadb
277 containers:
278 - args:
279 image: nexus3.onap.org:10001/mariadb:10.1.11
280 name: "mariadb"
281 env:
282 - name: MYSQL_ROOT_PASSWORD
283 value: password
284 - name: MARIADB_MAJOR
285 value: "10.1"
286 <...>
287 imagePullSecrets:
288 - name: onap-docker-registry-key
289
290Note that within the deployment specification, one of the container arguments
291is the key/value pair image: nexus3.onap.org:10001/mariadb:10.1.11 which
292specifies the version of the mariadb software to deploy. Although the
293deployment specifications greatly simplify deployment, maintenance of the
294deployment specifications themselves become problematic as software versions
295change over time or as different versions are required for different
296deployments. For example, if the R&D team needs to deploy a newer version of
297mariadb than what is currently used in the production environment, they would
298need to clone the deployment specification and change this value. Fortunately,
299this problem has been solved with the templating capabilities of Helm.
300
301The following example shows how the deployment specifications are modified to
302incorporate Helm templates such that key/value pairs can be defined outside of
303the deployment specifications and passed during instantiation of the component.
304
305.. code-block:: yaml
306
307 apiVersion: extensions/v1beta1
308 kind: Deployment
309 metadata:
310 name: mariadb
311 namespace: "{{ .Values.nsPrefix }}-mso"
312 spec:
313 <...>
314 template:
315 <...>
316 spec:
317 hostname: mariadb
318 containers:
319 - args:
320 image: {{ .Values.image.mariadb }}
321 imagePullPolicy: {{ .Values.pullPolicy }}
322 name: "mariadb"
323 env:
324 - name: MYSQL_ROOT_PASSWORD
325 value: password
326 - name: MARIADB_MAJOR
327 value: "10.1"
328 <...>
329 imagePullSecrets:
330 - name: "{{ .Values.nsPrefix }}-docker-registry-key"apiVersion: extensions/v1beta1
331 kind: Deployment
332 metadata:
333 name: mariadb
334 namespace: "{{ .Values.nsPrefix }}-mso"
335 spec:
336 <...>
337 template:
338 <...>
339 spec:
340 hostname: mariadb
341 containers:
342 - args:
343 image: {{ .Values.image.mariadb }}
344 imagePullPolicy: {{ .Values.pullPolicy }}
345 name: "mariadb"
346 env:
347 - name: MYSQL_ROOT_PASSWORD
348 value: password
349 - name: MARIADB_MAJOR
350 value: "10.1"
351 <...>
352 imagePullSecrets:
353 - name: "{{ .Values.nsPrefix }}-docker-registry-key"
354
355This version of the deployment specification has gone through the process of
356templating values that are likely to change between deployments. Note that the
357image is now specified as: image: {{ .Values.image.mariadb }} instead of a
358string used previously. During the deployment phase, Helm (actually the Helm
359sub-component Tiller) substitutes the {{ .. }} entries with a variable defined
360in a values.yaml file. The content of this file is as follows:
361
362.. code-block:: yaml
363
364 nsPrefix: onap
365 pullPolicy: IfNotPresent
366 image:
BorislavG3d6f9372018-04-15 11:55:39 +0000367 readiness: oomk8s/readiness-check:2.0.0
Roger Maitland953b5f12018-03-22 15:24:04 -0400368 mso: nexus3.onap.org:10001/openecomp/mso:1.0-STAGING-latest
369 mariadb: nexus3.onap.org:10001/mariadb:10.1.11
370
371Within the values.yaml file there is an image section with the key/value pair
372mariadb: nexus3.onap.org:10001/mariadb:10.1.11 which is the same value used in
373the non-templated version. Once all of the substitutions are complete, the
374resulting deployment specification ready to be used by Kubernetes.
375
376Also note that in this example, the namespace key/value pair is specified in
377the values.yaml file. This key/value pair will be global across the entire
378ONAP deployment and is therefore a prime example of where configuration
379hierarchy can be very useful.
380
381When creating a deployment template consider the use of default values if
382appropriate. Helm templating has built in support for DEFAULT values, here is
383an example:
384
385.. code-block:: yaml
386
387 imagePullSecrets:
388 - name: "{{ .Values.nsPrefix | default "onap" }}-docker-registry-key"
389
390The pipeline operator ("|") used here hints at that power of Helm templates in
391that much like an operating system command line the pipeline operator allow
392over 60 Helm functions to be embedded directly into the template (note that the
393Helm template language is a superset of the Go template language). These
394functions include simple string operations like upper and more complex flow
395control operations like if/else.
396
397
398ONAP Application Configuration
399------------------------------
400
Roger Maitlandac643812018-03-28 09:52:34 -0400401Dependency Management
402---------------------
403These Helm charts describe the desired state
404of an ONAP deployment and instruct the Kubernetes container manager as to how
405to maintain the deployment in this state. These dependencies dictate the order
406in-which the containers are started for the first time such that such
407dependencies are always met without arbitrary sleep times between container
408startups. For example, the SDC back-end container requires the Elastic-Search,
409Cassandra and Kibana containers within SDC to be ready and is also dependent on
410DMaaP (or the message-router) to be ready - where ready implies the built-in
411"readiness" probes succeeded - before becoming fully operational. When an
412initial deployment of ONAP is requested the current state of the system is NULL
413so ONAP is deployed by the Kubernetes manager as a set of Docker containers on
414one or more predetermined hosts. The hosts could be physical machines or
415virtual machines. When deploying on virtual machines the resulting system will
416be very similar to "Heat" based deployments, i.e. Docker containers running
417within a set of VMs, the primary difference being that the allocation of
418containers to VMs is done dynamically with OOM and statically with "Heat".
419Example SO deployment descriptor file shows SO's dependency on its mariadb
420data-base component:
421
422SO deployment specification excerpt:
423
424.. code-block:: yaml
425
426 apiVersion: extensions/v1beta1
427 kind: Deployment
428 metadata:
429 name: {{ include "common.name" . }}
430 namespace: {{ include "common.namespace" . }}
431 labels:
432 app: {{ include "common.name" . }}
433 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
434 release: {{ .Release.Name }}
435 heritage: {{ .Release.Service }}
436 spec:
437 replicas: {{ .Values.replicaCount }}
438 template:
439 metadata:
440 labels:
441 app: {{ include "common.name" . }}
442 release: {{ .Release.Name }}
443 spec:
444 initContainers:
445 - command:
446 - /root/ready.py
447 args:
448 - --container-name
449 - so-mariadb
450 env:
451 ...
452
453Kubernetes Container Orchestration
454==================================
455The ONAP components are managed by the Kubernetes_ container management system
456which maintains the desired state of the container system as described by one
457or more deployment descriptors - similar in concept to OpenStack HEAT
458Orchestration Templates. The following sections describe the fundamental
459objects managed by Kubernetes, the network these components use to communicate
460with each other and other entities outside of ONAP and the templates that
461describe the configuration and desired state of the ONAP components.
462
463Name Spaces
464-----------
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100465Within the namespaces are Kubernetes services that provide external
466connectivity to pods that host Docker containers.
Roger Maitlandac643812018-03-28 09:52:34 -0400467
468ONAP Components to Kubernetes Object Relationships
469--------------------------------------------------
470Kubernetes deployments consist of multiple objects:
471
472- **nodes** - a worker machine - either physical or virtual - that hosts
473 multiple containers managed by Kubernetes.
474- **services** - an abstraction of a logical set of pods that provide a
475 micro-service.
476- **pods** - one or more (but typically one) container(s) that provide specific
477 application functionality.
478- **persistent volumes** - One or more permanent volumes need to be established
479 to hold non-ephemeral configuration and state data.
480
481The relationship between these objects is shown in the following figure:
482
483.. .. uml::
484..
485.. @startuml
486.. node PH {
487.. component Service {
488.. component Pod0
489.. component Pod1
490.. }
491.. }
492..
493.. database PV
494.. @enduml
495
496.. figure:: kubernetes_objects.png
497
498OOM uses these Kubernetes objects as described in the following sections.
499
500Nodes
501~~~~~
502OOM works with both physical and virtual worker machines.
503
504* Virtual Machine Deployments - If ONAP is to be deployed onto a set of virtual
505 machines, the creation of the VMs is outside of the scope of OOM and could be
506 done in many ways, such as
507
508 * manually, for example by a user using the OpenStack Horizon dashboard or
509 AWS EC2, or
510 * automatically, for example with the use of a OpenStack Heat Orchestration
511 Template which builds an ONAP stack, Azure ARM template, AWS CloudFormation
512 Template, or
513 * orchestrated, for example with Cloudify creating the VMs from a TOSCA
514 template and controlling their life cycle for the life of the ONAP
515 deployment.
516
517* Physical Machine Deployments - If ONAP is to be deployed onto physical
518 machines there are several options but the recommendation is to use Rancher
519 along with Helm to associate hosts with a Kubernetes cluster.
520
521Pods
522~~~~
523A group of containers with shared storage and networking can be grouped
524together into a Kubernetes pod. All of the containers within a pod are
525co-located and co-scheduled so they operate as a single unit. Within ONAP
526Amsterdam release, pods are mapped one-to-one to docker containers although
527this may change in the future. As explained in the Services section below the
528use of Pods within each ONAP component is abstracted from other ONAP
529components.
530
531Services
532~~~~~~~~
533OOM uses the Kubernetes service abstraction to provide a consistent access
534point for each of the ONAP components independent of the pod or container
535architecture of that component. For example, the SDNC component may introduce
536OpenDaylight clustering as some point and change the number of pods in this
537component to three or more but this change will be isolated from the other ONAP
538components by the service abstraction. A service can include a load balancer
539on its ingress to distribute traffic between the pods and even react to dynamic
540changes in the number of pods if they are part of a replica set.
541
542Persistent Volumes
543~~~~~~~~~~~~~~~~~~
544To enable ONAP to be deployed into a wide variety of cloud infrastructures a
545flexible persistent storage architecture, built on Kubernetes persistent
546volumes, provides the ability to define the physical storage in a central
547location and have all ONAP components securely store their data.
548
549When deploying ONAP into a public cloud, available storage services such as
550`AWS Elastic Block Store`_, `Azure File`_, or `GCE Persistent Disk`_ are
551options. Alternatively, when deploying into a private cloud the storage
552architecture might consist of Fiber Channel, `Gluster FS`_, or iSCSI. Many
553other storage options existing, refer to the `Kubernetes Storage Class`_
554documentation for a full list of the options. The storage architecture may vary
555from deployment to deployment but in all cases a reliable, redundant storage
556system must be provided to ONAP with which the state information of all ONAP
557components will be securely stored. The Storage Class for a given deployment is
558a single parameter listed in the ONAP values.yaml file and therefore is easily
559customized. Operation of this storage system is outside the scope of the OOM.
560
561.. code-block:: yaml
562
563 Insert values.yaml code block with storage block here
564
565Once the storage class is selected and the physical storage is provided, the
566ONAP deployment step creates a pool of persistent volumes within the given
567physical storage that is used by all of the ONAP components. ONAP components
568simply make a claim on these persistent volumes (PV), with a persistent volume
569claim (PVC), to gain access to their storage.
570
571The following figure illustrates the relationships between the persistent
572volume claims, the persistent volumes, the storage class, and the physical
573storage.
574
575.. graphviz::
576
577 digraph PV {
578 label = "Persistance Volume Claim to Physical Storage Mapping"
579 {
580 node [shape=cylinder]
581 D0 [label="Drive0"]
582 D1 [label="Drive1"]
583 Dx [label="Drivex"]
584 }
585 {
586 node [shape=Mrecord label="StorageClass:ceph"]
587 sc
588 }
589 {
590 node [shape=point]
591 p0 p1 p2
592 p3 p4 p5
593 }
594 subgraph clusterSDC {
595 label="SDC"
596 PVC0
597 PVC1
598 }
599 subgraph clusterSDNC {
600 label="SDNC"
601 PVC2
602 }
603 subgraph clusterSO {
604 label="SO"
605 PVCn
606 }
607 PV0 -> sc
608 PV1 -> sc
609 PV2 -> sc
610 PVn -> sc
611
612 sc -> {D0 D1 Dx}
613 PVC0 -> PV0
614 PVC1 -> PV1
615 PVC2 -> PV2
616 PVCn -> PVn
617
618 # force all of these nodes to the same line in the given order
619 subgraph {
620 rank = same; PV0;PV1;PV2;PVn;p0;p1;p2
621 PV0->PV1->PV2->p0->p1->p2->PVn [style=invis]
622 }
623
624 subgraph {
625 rank = same; D0;D1;Dx;p3;p4;p5
626 D0->D1->p3->p4->p5->Dx [style=invis]
627 }
628
629 }
630
631In-order for an ONAP component to use a persistent volume it must make a claim
632against a specific persistent volume defined in the ONAP common charts. Note
633that there is a one-to-one relationship between a PVC and PV. The following is
634an excerpt from a component chart that defines a PVC:
635
636.. code-block:: yaml
637
638 Insert PVC example here
639
640OOM Networking with Kubernetes
641------------------------------
642
643- DNS
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100644- Ports - Flattening the containers also expose port conflicts between the
645 containers which need to be resolved.
Roger Maitlandac643812018-03-28 09:52:34 -0400646
647Node Ports
648~~~~~~~~~~
649
650Pod Placement Rules
651-------------------
652OOM will use the rich set of Kubernetes node and pod affinity /
653anti-affinity rules to minimize the chance of a single failure resulting in a
654loss of ONAP service. Node affinity / anti-affinity is used to guide the
655Kubernetes orchestrator in the placement of pods on nodes (physical or virtual
656machines). For example:
657
658- if a container used Intel DPDK technology the pod may state that it as
659 affinity to an Intel processor based node, or
660- geographical based node labels (such as the Kubernetes standard zone or
661 region labels) may be used to ensure placement of a DCAE complex close to the
662 VNFs generating high volumes of traffic thus minimizing networking cost.
663 Specifically, if nodes were pre-assigned labels East and West, the pod
664 deployment spec to distribute pods to these nodes would be:
665
666.. code-block:: yaml
667
668 nodeSelector:
669 failure-domain.beta.Kubernetes.io/region: {{ .Values.location }}
670
671- "location: West" is specified in the `values.yaml` file used to deploy
672 one DCAE cluster and "location: East" is specified in a second `values.yaml`
673 file (see OOM Configuration Management for more information about
674 configuration files like the `values.yaml` file).
675
676Node affinity can also be used to achieve geographic redundancy if pods are
677assigned to multiple failure domains. For more information refer to `Assigning
678Pods to Nodes`_.
679
680.. note::
681 One could use Pod to Node assignment to totally constrain Kubernetes when
682 doing initial container assignment to replicate the Amsterdam release
683 OpenStack Heat based deployment. Should one wish to do this, each VM would
684 need a unique node name which would be used to specify a node constaint
685 for every component. These assignment could be specified in an environment
686 specific values.yaml file. Constraining Kubernetes in this way is not
687 recommended.
688
689Kubernetes has a comprehensive system called Taints and Tolerations that can be
690used to force the container orchestrator to repel pods from nodes based on
691static events (an administrator assigning a taint to a node) or dynamic events
692(such as a node becoming unreachable or running out of disk space). There are
693no plans to use taints or tolerations in the ONAP Beijing release. Pod
694affinity / anti-affinity is the concept of creating a spacial relationship
695between pods when the Kubernetes orchestrator does assignment (both initially
696an in operation) to nodes as explained in Inter-pod affinity and anti-affinity.
697For example, one might choose to co-located all of the ONAP SDC containers on a
698single node as they are not critical runtime components and co-location
699minimizes overhead. On the other hand, one might choose to ensure that all of
700the containers in an ODL cluster (SDNC and APPC) are placed on separate nodes
701such that a node failure has minimal impact to the operation of the cluster.
702An example of how pod affinity / anti-affinity is shown below:
703
704Pod Affinity / Anti-Affinity
705
706.. code-block:: yaml
707
708 apiVersion: v1
709 kind: Pod
710 metadata:
711 name: with-pod-affinity
712 spec:
713 affinity:
714 podAffinity:
715 requiredDuringSchedulingIgnoredDuringExecution:
716 - labelSelector:
717 matchExpressions:
718 - key: security
719 operator: In
720 values:
721 - S1
722 topologyKey: failure-domain.beta.Kubernetes.io/zone
723 podAntiAffinity:
724 preferredDuringSchedulingIgnoredDuringExecution:
725 - weight: 100
726 podAffinityTerm:
727 labelSelector:
728 matchExpressions:
729 - key: security
730 operator: In
731 values:
732 - S2
733 topologyKey: Kubernetes.io/hostname
734 containers:
735 - name: with-pod-affinity
736 image: gcr.io/google_containers/pause:2.0
737
738This example contains both podAffinity and podAntiAffinity rules, the first
739rule is is a must (requiredDuringSchedulingIgnoredDuringExecution) while the
740second will be met pending other considerations
741(preferredDuringSchedulingIgnoredDuringExecution). Preemption Another feature
742that may assist in achieving a repeatable deployment in the presence of faults
743that may have reduced the capacity of the cloud is assigning priority to the
744containers such that mission critical components have the ability to evict less
745critical components. Kubernetes provides this capability with Pod Priority and
746Preemption. Prior to having more advanced production grade features available,
747the ability to at least be able to re-deploy ONAP (or a subset of) reliably
748provides a level of confidence that should an outage occur the system can be
749brought back on-line predictably.
750
751Health Checks
752-------------
753
754Monitoring of ONAP components is configured in the agents within JSON files and
755stored in gerrit under the consul-agent-config, here is an example from the AAI
756model loader (aai-model-loader-health.json):
757
758.. code-block:: json
759
760 {
761 "service": {
762 "name": "A&AI Model Loader",
763 "checks": [
764 {
765 "id": "model-loader-process",
766 "name": "Model Loader Presence",
767 "script": "/consul/config/scripts/model-loader-script.sh",
768 "interval": "15s",
769 "timeout": "1s"
770 }
771 ]
772 }
773 }
774
775Liveness Probes
776---------------
777
778These liveness probes can simply check that a port is available, that a
779built-in health check is reporting good health, or that the Consul health check
780is positive. For example, to monitor the SDNC component has following liveness
781probe can be found in the SDNC DB deployment specification:
782
783.. code-block:: yaml
784
785 sdnc db liveness probe
786
787 livenessProbe:
788 exec:
789 command: ["mysqladmin", "ping"]
790 initialDelaySeconds: 30 periodSeconds: 10
791 timeoutSeconds: 5
792
793The 'initialDelaySeconds' control the period of time between the readiness
794probe succeeding and the liveness probe starting. 'periodSeconds' and
795'timeoutSeconds' control the actual operation of the probe. Note that
796containers are inherently ephemeral so the healing action destroys failed
797containers and any state information within it. To avoid a loss of state, a
798persistent volume should be used to store all data that needs to be persisted
799over the re-creation of a container. Persistent volumes have been created for
800the database components of each of the projects and the same technique can be
801used for all persistent state information.
802
803
804
Roger Maitland953b5f12018-03-22 15:24:04 -0400805Environment Files
806~~~~~~~~~~~~~~~~~
807
808MSB Integration
809===============
Roger Maitlandac643812018-03-28 09:52:34 -0400810
811The \ `Microservices Bus
812Project <https://wiki.onap.org/pages/viewpage.action?pageId=3246982>`__ provides
813facilities to integrate micro-services into ONAP and therefore needs to
814integrate into OOM - primarily through Consul which is the backend of
815MSB service discovery. The following is a brief description of how this
816integration will be done:
817
818A registrator to push the service endpoint info to MSB service
819discovery. 
820
821- The needed service endpoint info is put into the kubernetes yaml file
822 as annotation, including service name, Protocol,version, visual
823 range,LB method, IP, Port,etc.
824
825- OOM deploy/start/restart/scale in/scale out/upgrade ONAP components
826
827- Registrator watch the kubernetes event
828
829- When an ONAP component instance has been started/destroyed by OOM,
830 Registrator get the notification from kubernetes
831
832- Registrator parse the service endpoint info from annotation and
833 register/update/unregister it to MSB service discovery
834
835- MSB API Gateway uses the service endpoint info for service routing
836 and load balancing.
837
838Details of the registration service API can be found at \ `Microservice
839Bus API
840Documentation <https://wiki.onap.org/display/DW/Microservice+Bus+API+Documentation>`__.
841
842ONAP Component Registration to MSB
843----------------------------------
844The charts of all ONAP components intending to register against MSB must have
845an annotation in their service(s) template. A `sdc` example follows:
846
847.. code-block:: yaml
848
849 apiVersion: v1
850 kind: Service
851 metadata:
852 labels:
853 app: sdc-be
854 name: sdc-be
855 namespace: "{{ .Values.nsPrefix }}"
856 annotations:
857 msb.onap.org/service-info: '[
858 {
859 "serviceName": "sdc",
860 "version": "v1",
861 "url": "/sdc/v1",
862 "protocol": "REST",
863 "port": "8080",
864 "visualRange":"1"
865 },
866 {
867 "serviceName": "sdc-deprecated",
868 "version": "v1",
869 "url": "/sdc/v1",
870 "protocol": "REST",
871 "port": "8080",
872 "visualRange":"1",
873 "path":"/sdc/v1"
874 }
875 ]'
876 ...
877
878
879MSB Integration with OOM
880------------------------
881A preliminary view of the OOM-MSB integration is as follows:
882
883.. figure:: MSB-OOM-Diagram.png
884
885A message sequence chart of the registration process:
886
887.. uml::
888
889 participant "OOM" as oom
890 participant "ONAP Component" as onap
891 participant "Service Discovery" as sd
892 participant "External API Gateway" as eagw
893 participant "Router (Internal API Gateway)" as iagw
894
895 box "MSB" #LightBlue
896 participant sd
897 participant eagw
898 participant iagw
899 end box
900
901 == Deploy Servcie ==
902
903 oom -> onap: Deploy
904 oom -> sd: Register service endpoints
905 sd -> eagw: Services exposed to external system
906 sd -> iagw: Services for internal use
907
908 == Component Life-cycle Management ==
909
910 oom -> onap: Start/Stop/Scale/Migrate/Upgrade
911 oom -> sd: Update service info
912 sd -> eagw: Update service info
913 sd -> iagw: Update service info
914
915 == Service Health Check ==
916
917 sd -> onap: Check the health of service
918 sd -> eagw: Update service status
919 sd -> iagw: Update service status
920
921
922MSB Deployment Instructions
923---------------------------
924MSB is helm installable ONAP component which is often automatically deployed.
925To install it individually enter::
926
927 > helm install <repo-name>/msb
928
929.. note::
930 TBD: Vaidate if the following procedure is still required.
931
932Please note that Kubernetes authentication token must be set at
933*kubernetes/kube2msb/values.yaml* so the kube2msb registrator can get the
934access to watch the kubernetes events and get service annotation by
935Kubernetes APIs. The token can be found in the kubectl configuration file
936*~/.kube/config*
937
938More details can be found here `MSB installation <http://onap.readthedocs.io/en/latest/submodules/msb/apigateway.git/docs/platform/installation.html>`__.
939
Roger Maitland953b5f12018-03-22 15:24:04 -0400940.. MISC
941.. ====
942.. Note that although OOM uses Kubernetes facilities to minimize the effort
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100943.. required of the ONAP component owners to implement a successful rolling
944.. upgrade strategy there are other considerations that must be taken into
945.. consideration.
Roger Maitland953b5f12018-03-22 15:24:04 -0400946.. For example, external APIs - both internal and external to ONAP - should be
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100947.. designed to gracefully accept transactions from a peer at a different
948.. software version to avoid deadlock situations. Embedded version codes in
949.. messages may facilitate such capabilities.
Roger Maitland953b5f12018-03-22 15:24:04 -0400950..
Sylvain Desbureaux5b7440b2019-01-28 16:49:14 +0100951.. Within each of the projects a new configuration repository contains all of
952.. the project specific configuration artifacts. As changes are made within
953.. the project, it's the responsibility of the project team to make appropriate
Roger Maitland953b5f12018-03-22 15:24:04 -0400954.. changes to the configuration data.