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