aboutsummaryrefslogtreecommitdiffstats
path: root/docs/installation/oom.rst
blob: d975e752fa97c1f1b16dbe1556d1935c4ad77608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
.. This work is licensed under a
.. Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0


Policy/ACM OOM Installation
---------------------------

.. contents::
    :depth: 2

Notes
*****
* This guide assumes that you have access to a Kubernetes cluster.
* The examples for this guide were carried out on a 3 node Ubuntu-based cluster. However, cluster software such as microk8s should work just as well.

Cluster Used in this Guide
**************************
* Ubuntu-based VM using Ubuntu 22.04.1 LTS
* VM has 16GB RAM and 150 GB HDD and 4CPU
* microk8s-based cluster is used

Prerequisites
*************
* Microk8s Cluster capable of running kubectl commands
* Both kubectl client and the server use v1.30.4
* Helm version v3.15.4 is installed
* There should be a running chart repo called "local"
* Chartmuseum used to create the chart repo

Deploy Policy/ACM OOM & Required Charts
***************************************
The policy K8S charts are located in the `OOM repository <https://gerrit.onap.org/r/gitweb?p=oom.git;a=tree;f=kubernetes/policy;h=78576c7a0d30cb87054e9776326cdde20986e6e3;hb=refs/heads/master>`_.

Install Helm Plugins
^^^^^^^^^^^^^^^^^^^^
Chart museum's **helm-push** plugin should be installed

.. code-block:: bash

    helm plugin install https://github.com/chartmuseum/helm-push --version 0.10.3

And then we should install the **deploy** and **undeploy** plugins from oom. so, navigate to the oom/kubernetes directory in the above cloned oom gerrit repo.

.. code-block:: bash

    helm plugin install helm/plugins/deploy
    helm plugin install helm/plugins/undeploy

Package and Upload Charts to Repo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Navigate to the same oom/kubernetes directory. The **make** command can be used here to package and upload (among other things) the charts to the local chart repo. This command is slow as it has to package and upload all of the helm charts in oom. However, we are skipping linting of the charts and using the **-j** flag to allow us to use multiple threads - this will maximize the speed.

.. code-block:: bash

    make all SKIP_LINT=TRUE -j$(nproc)

Once this is completed, we should be able to see all of the charts in the local helm repo.

.. code-block:: bash

    helm search repo local

    local/policy                     	14.0.5       	           	ONAP Policy
    local/policy-apex-pdp            	14.0.1       	           	ONAP Policy APEX PDP
    local/policy-api                 	14.0.2       	           	ONAP Policy Design API
    local/policy-clamp-ac-a1pms-ppnt 	14.0.1       	           	ONAP Policy Clamp A1PMS Participant
    local/policy-clamp-ac-http-ppnt  	14.0.1       	           	ONAP Policy Clamp Controlloop Http Participant
    local/policy-clamp-ac-k8s-ppnt   	14.0.1       	           	ONAP Policy Clamp Controlloop K8s Participant
    local/policy-clamp-ac-kserve-ppnt	14.0.1       	           	ONAP Policy Clamp Kserve Participant
    local/policy-clamp-ac-pf-ppnt    	14.0.1       	           	ONAP Policy Clamp Controlloop Policy Participant
    local/policy-clamp-runtime-acm   	14.0.2       	           	ONAP Policy Clamp Controlloop Runtime
    local/policy-distribution        	14.0.1       	           	ONAP Policy Distribution
    local/policy-drools-pdp          	14.0.2       	           	ONAP Drools Policy Engine (PDP-D)
    local/policy-pap                 	14.0.2       	           	ONAP Policy Administration (PAP)
    local/policy-xacml-pdp           	14.0.3       	           	ONAP Policy XACML PDP (PDP-X)

.. note::
    Only the policy/acm charts are shown above - there will be many others.

Strimzi Kafka and Cert Manager Install
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Install Cert Manager

.. code-block:: bash

    kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.yaml

Currently, the following policy/acm components use Strimzi Kafka by default:

* policy-ppnt
* k8s-ppnt
* http-ppnt
* a1Policy-mgmt-ppnt
* kserve-ppnt
* acm runtime

There is a future plan to move all components to Strimzi Kafka. However, in the meantime, our deployments require both DMAAP message-router and Strimzi Kafka
|
Install Strimzi Kafka Operator

.. code-block:: bash

    helm repo add strimzi https://strimzi.io/charts/
    helm install strimzi-kafka-operator strimzi/strimzi-kafka-operator --namespace strimzi-system --version 0.43.0 --set watchAnyNamespace=true --create-namespace

Once these are installed and running, we can move on to the installation of the policy and related helm charts

Policy and Related Helm Chart Install
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
At this stage, we have all the required charts that we need for either Policy Framework or ACM installation. The command to deploy the charts is below

.. code-block:: bash

    helm deploy dev local/onap --namespace onap -f ~/override.yaml --create-namespace

In the above **helm deploy** command we provide an override file called **override.yaml**. In this file, we can turn on/off different parts of the onap installation. we have provided an file below in the collapsable code. This is provided just as examples - you can adjust any way you see fit. The choice between postgres and mariadb is controlled by **global.mariadbGalera.localCluster & global.mariadbGalera.useInPolicy** for mariadb and **global.postgres.localCluster & global.postgres.useInPolicy** for postgres

.. collapse:: Policy/ACM Chart Override

    .. code-block:: yaml

        global:
          repository: nexus3.onap.org:10001
          pullPolicy: IfNotPresent
          masterPassword: password
          serviceMesh:
            enabled: false
          cmpv2Enabled: false
          addTestingComponents: false
          useStrimziKafka: true
          useStrimziKafkaPf: false
          mariadbGalera:
            # flag to enable the DB creation via mariadb-operator
            useOperator: false
            # if useOperator set to "true", set "enableServiceAccount to "false"
            # as the SA is created by the Operator
            enableServiceAccount: true
            localCluster: true
            # '&mariadbConfig' means we "store" the values for  later use in the file
            # with '*mariadbConfig' pointer.
            config: &mariadbConfig
              mysqlDatabase: policyadmin
            service: &mariadbService policy-mariadb
            internalPort: 3306
            nameOverride: *mariadbService
            # (optional) if localCluster=false and an external secret is used set this variable
            #userRootSecret: <secretName>
            useInPolicy: true
          prometheusEnabled: false
          postgres:
            localCluster: false
            service:
              name: pgset
              name2: policy-pg-primary
              name3: policy-pg-replica
            container:
              name: postgres
            useInPolicy: false
        robot:
          enabled: false
        so:
          enabled: false
        cassandra:
          enabled: false
        mariadb-galera:
          enabled: false
          replicaCount: 1
        appc:
          enabled: false
        sdnc:
          enabled: false
          replicaCount: 1
          config:
            enableClustering: false
        aaf:
          enabled: false
        aai:
          enabled: false
        clamp:
          enabled: false
        cli:
          enabled: false
        cds:
          enabled: false
        consul:
          enabled: false
        contrib:
          enabled: false
        awx:
          enabled: false
        netbox:
          enabled: false
        dcaegen2:
          enabled: false
        pnda:
          enabled: false
        dmaap:
          enabled: false
          message-router:
            enabled: false
          dmaap-bc:
            enabled: false
          dmaap-dr-prov:
            enabled: false
          dmaap-dr-node:
            enabled: false
          dmaap-strimzi:
            enabled: false
        esr:
          enabled: false
        log:
          enabled: false
        sniro-emulator:
          enabled: false
        oof:
          enabled: false
        msb:
          enabled: false
        multicloud:
          enabled: false
        nbi:
          enabled: false
        pomba:
          enabled: false
        portal:
          enabled: false
        platform:
          enabled: false
        sdc:
          enabled: false
        uui:
          enabled: false
        vfc:
          enabled: false
        vid:
          enabled: false
        modeling:
          enabled: false
        cps:
          enabled: false
        vnfsdk:
          enabled: false
        vvp:
          enabled: false
        strimzi:
          enabled: true
          replicaCount: 1
          persistence:
            kafka:
              size: 1Gi
            zookeeper:
              size: 256Mi
          strimzi-kafka-bridge:
            enabled: false
        policy:
          enabled: true
          policy-clamp-ac-a1pms-ppnt:
            enabled: true
          policy-clamp-ac-kserve-ppnt:
            enabled: true
          policy-clamp-ac-k8s-ppnt:
            enabled: true
          policy-clamp-ac-http-ppnt:
            enabled: true
          policy-clamp-ac-pf-ppnt:
            enabled: true
          policy-clamp-runtime-acm:
            enabled: true
          policy-gui:
            enabled: false
          policy-apex-pdp:
            enabled: true
          policy-nexus:
            enabled: false
          policy-api:
            enabled: true
          policy-pap:
            enabled: true
          policy-xacml-pdp:
            enabled: true
          policy-drools-pdp:
            enabled: true
          policy-distribution:
            enabled: false

|

Policy/ACM Pods
***************
To get a listing of the Policy or ACM Pods, run the following command:

.. code-block:: bash

  kubectl get pods -n onap | grep dev-policy

  dev-policy-59684c7b9c-5gd6r                        2/2     Running            0          8m41s
  dev-policy-apex-pdp-0                              1/1     Running            0          8m41s
  dev-policy-api-56f55f59c5-nl5cg                    1/1     Running            0          8m41s
  dev-policy-distribution-54cc59b8bd-jkg5d           1/1     Running            0          8m41s
  dev-policy-mariadb-0                               1/1     Running            0          8m41s
  dev-policy-xacml-pdp-765c7d58b5-l6pr7              1/1     Running            0          8m41s

.. note::
   To get a listing of the Policy services, run this command:
   kubectl get svc -n onap | grep policy

Accessing Policy/ACM Containers
*******************************
Accessing the policy docker containers is the same as for any kubernetes container. Here is an example:

.. code-block:: bash

  kubectl -n onap exec -it dev-policy-policy-xacml-pdp-584844b8cf-9zptx bash

.. _install-upgrade-policy-label:

Installing or Upgrading Policy/ACM
**********************************
The assumption is you have cloned the charts from the OOM repository into a local directory.

**Step 1** Go into local copy of OOM charts

From your local copy, edit any of the values.yaml files in the policy tree to make desired changes.

The policy/acm schemas will be installed automatically as part of the database configuration using ``db-migrator``.
By default the policy/acm schemas is upgraded to the latest version.
For more information on how to change the ``db-migrator`` setup please see
:ref:`Using Policy DB Migrator <policy-db-migrator-label>`.

**Step 2** Build the charts

.. code-block:: bash

  make policy -j$(nproc)
  make SKIP_LINT=TRUE onap -j$(nproc)

.. note::
   SKIP_LINT is only to reduce the "make" time. **-j** allows the use of multiple threads.

**Step 3** Undeploy Policy/ACM
After undeploying policy, loop on monitoring the policy pods until they go away.

.. code-block:: bash

  helm undeploy dev
  kubectl get pods -n onap | grep dev


**Step 4** Re-Deploy Policy pods

After deploying policy, loop on monitoring the policy pods until they come up.

.. code-block:: bash

  helm deploy dev local/onap --namespace onap -f override.yaml
  kubectl get pods -n onap | grep dev

.. note::
   If you want to purge the existing data and start with a clean install,
   please follow these steps after undeploying:

   **Step 1** Delete NFS persisted data for Policy

   .. code-block:: bash

     rm -fr /dockerdata-nfs/dev/policy

   **Step 2** Make sure there is no orphan policy database persistent volume or claim.

   First, find if there is an orphan database PV or PVC with the following commands:

   .. code-block:: bash

     kubectl get pvc -n onap | grep policy
     kubectl get pv -n onap | grep policy

   If there are any orphan resources, delete them with

   .. code-block:: bash

       kubectl delete pvc <orphan-policy-mariadb-resource>
       kubectl delete pv <orphan-policy-mariadb-resource>


Restarting a faulty component
*****************************
Each policy component can be restarted independently by issuing the following command:

.. code-block:: bash

    kubectl delete pod <policy-pod> -n onap

Exposing ports
**************
For security reasons, the ports for the policy containers are configured as ClusterIP and thus not exposed. If you find you need those ports in a development environment, then the following will expose them.

.. code-block:: bash

  kubectl -n onap expose service policy-api --port=7171 --target-port=6969 --name=api-public --type=NodePort

Additional PDP-D Customizations
*******************************

Credentials and other configuration parameters can be set as values
when deploying the policy (drools) subchart.  Please refer to
`PDP-D Default Values <https://git.onap.org/oom/tree/kubernetes/policy/components/policy-drools-pdp/values.yaml>`_
for the current default values.  It is strongly recommended that sensitive
information is secured appropriately before using in production.

Additional customization can be applied to the PDP-D.  Custom configuration goes under the
"resources" directory of the drools subchart (oom/kubernetes/policy/charts/drools/resources).
This requires rebuilding the policy subchart
(see section :ref:`install-upgrade-policy-label`).

Configuration is done by adding or modifying configmaps and/or secrets.
Configmaps are placed under "drools/resources/configmaps", and
secrets under "drools/resources/secrets".

Custom configuration supportes these types of files:

* **\*.conf** files to support additional environment configuration.
* **features\*.zip** to add additional custom features.
* **\*.pre.sh** scripts to be executed before starting the PDP-D process.
* **\*.post.sh** scripts to be executed after starting the PDP-D process.
* **policy-keystore** to override the PDP-D policy-keystore.
* **policy-truststore** to override the PDP-D policy-truststore.
* **aaf-cadi.keyfile** to override the PDP-D AAF key.
* **\*.properties** to override or add properties files.
* **\*.xml** to override or add xml configuration files.
* **\*.json** to override json configuration files.
* **\*settings.xml** to override maven repositories configuration .

Examples
^^^^^^^^
To *override the PDP-D keystore or trustore*, add a suitable replacement(s) under
"drools/resources/secrets".  Modify the drools chart values.yaml with
new credentials, and follow the procedures described at
:ref:`install-upgrade-policy-label` to redeploy the chart.

To *disable https* for the DMaaP configuration topic, add a copy of
`engine.properties <https://git.onap.org/policy/drools-pdp/tree/policy-management/src/main/server/config/engine.properties>`_
with "dmaap.source.topics.PDPD-CONFIGURATION.https" set to "false", or alternatively
create a ".pre.sh" script (see above) that edits this file before the PDP-D is
started.

To use *noop topics* for standalone testing, add a "noop.pre.sh" script under
oom/kubernetes/policy/charts/drools/resources/configmaps/:

.. code-block:: bash

    #!/bin/bash
    sed -i "s/^dmaap/noop/g" $POLICY_HOME/config/*.properties