blob: 3f0c1eddc5d8a563244944a0121449070e033cb1 [file] [log] [blame]
shivasubedi44beaa32021-09-13 15:16:30 +01001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
leventecsanyi0f6f4162024-01-11 12:53:26 +01003.. Copyright (C) 2021-2024 Nordix Foundation
puthuparambil.aditya841e3df2021-10-05 10:56:04 +01004.. Modifications Copyright (C) 2021 Bell Canada.
shivasubedi44beaa32021-09-13 15:16:30 +01005
6.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
7.. _deployment:
8
shivasubedi44beaa32021-09-13 15:16:30 +01009CPS Deployment
Bruno Sakotoa1129b62022-03-15 08:09:07 -040010##############
shivasubedi44beaa32021-09-13 15:16:30 +010011
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010012.. contents::
13 :depth: 2
shivasubedi44beaa32021-09-13 15:16:30 +010014
danielhanrahan1ace2e62024-03-19 15:28:32 +000015Database configuration
16======================
17CPS uses PostgreSQL database. As per the `PostgreSQL documentation on resource consumption
18<https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS>`_, the *shared_buffers*
19parameter should be set between 25% and 40% of total memory. It has a default value of 128 megabytes, so this should be
20set appropriately. For example, given a database with 2GB of memory, 512MB is a recommended value.
21
halil.cakal67090ae2024-10-09 17:33:19 +010022CPS and NCMP Configuration
23==========================
24
25JVM Memory Allocation
26
27Allocating 75% of the container's memory to the JVM heap ensures efficient memory management.
28This helps the JVM make the best use of the allocated resources while leaving enough memory for other processes.
29
30.. code-block:: yaml
31
32 JAVA_TOOL_OPTIONS: "-XX:InitialRAMPercentage=75.0 -XX:MaxRAMPercentage=75.0"
33
danielhanrahan6c584dd2024-10-23 09:04:58 +010034Load balancer configuration
35===========================
36
37For optimal performance in CPS/NCMP, load balancers should be configured to use a least-requests policy, also known as
38least-connected. Use of round-robin load balancing can lead to instability.
39
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010040CPS OOM Charts
Bruno Sakotoa1129b62022-03-15 08:09:07 -040041==============
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010042The CPS kubernetes chart is located in the `OOM repository <https://github.com/onap/oom/tree/master/kubernetes/cps>`_.
43This chart includes different cps components referred as <cps-component-name> further in the document are listed below:
44
45.. container:: ulist
46
emacleeb176de22022-08-31 15:53:10 +010047 - `cps-core <https://github.com/onap/oom/tree/master/kubernetes/cps/components/cps-core>`__
emacleeb176de22022-08-31 15:53:10 +010048 - `ncmp-dmi-plugin <https://github.com/onap/oom/tree/master/kubernetes/cps/components/ncmp-dmi-plugin>`__
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010049
mpriyankb673b542022-11-09 09:36:24 +000050Please refer to the `OOM documentation <https://docs.onap.org/projects/onap-oom/en/latest/sections/guides/user_guides/oom_user_guide.html>`_ on how to install and deploy ONAP.
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010051
52Installing or Upgrading CPS Components
Bruno Sakotoa1129b62022-03-15 08:09:07 -040053======================================
54
puthuparambil.aditya841e3df2021-10-05 10:56:04 +010055The assumption is you have cloned the charts from the OOM repository into a local directory.
56
57**Step 1** Go to the cps charts and edit properties in values.yaml files to make any changes to particular cps component if required.
58
59.. code-block:: bash
60
61 cd oom/kubernetes/cps/components/<cps-component-name>
62
63**Step 2** Build the charts
64
65.. code-block:: bash
66
67 cd oom/kubernetes
68 make SKIP_LINT=TRUE cps
69
70.. note::
71 SKIP_LINT is only to reduce the "make" time
72
73**Step 3** Undeploying already deployed cps components
74
75After undeploying cps components, keep monitoring the cps pods until they go away.
76
77.. code-block:: bash
78
79 helm del --purge <my-helm-release>-<cps-component-name>
80 kubectl get pods -n <namespace> | grep <cps-component-name>
81
82**Step 4** Make sure there is no orphan database persistent volume or claim.
83
84First, find if there is an orphan database PV or PVC with the following commands:
85
86.. note::
87 This step does not apply to ncmp-dmi-plugin.
88
89.. code-block:: bash
90
91 kubectl get pvc -n <namespace> | grep <cps-component-name>
92 kubectl get pv -n <namespace> | grep <cps-component-name>
93
94If there are any orphan resources, delete them with
95
96.. code-block:: bash
97
98 kubectl delete pvc <orphan-cps-core-pvc-name>
99 kubectl delete pv <orphan-cps-core-pv-name>
100
101**Step 5** Delete NFS persisted data for CPS components
102
103Connect to the machine where the file system is persisted and then execute the below command
104
105.. code-block:: bash
106
107 rm -fr /dockerdata-nfs/<my-helm-release>/<cps-component-name>
108
109**Step 6** Re-Deploy cps pods
110
111After deploying cps, keep monitoring the cps pods until they come up.
112
113.. code-block:: bash
114
115 helm deploy <my-helm-release> local/cps --namespace <namespace>
116 kubectl get pods -n <namespace> | grep <cps-component-name>
117
118Restarting a faulty component
Bruno Sakotoa1129b62022-03-15 08:09:07 -0400119=============================
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100120Each cps component can be restarted independently by issuing the following command:
121
122.. code-block:: bash
123
124 kubectl delete pod <cps-component-pod-name> -n <namespace>
125
ToineSiebelink39207852021-10-21 12:11:25 +0100126.. Below Label is used by documentation for other CPS components to link here, do not remove even if it gives a warning
127.. _cps_common_credentials_retrieval:
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100128
129Credentials Retrieval
Bruno Sakotoa1129b62022-03-15 08:09:07 -0400130=====================
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100131
132Application and database credentials are kept in Kubernetes secrets. They are defined as external secrets in the
133values.yaml file to be used across different components as :
134
135.. container:: ulist
136
lukegleesonfb7005f2023-07-07 15:12:17 +0100137 - `cps-core <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-core/values.yaml>`_
lukegleesonfb7005f2023-07-07 15:12:17 +0100138 - `ncmp-dmi-plugin <https://github.com/onap/oom/blob/master/kubernetes/cps/components/ncmp-dmi-plugin/values.yaml>`_
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100139
140Below are the list of secrets for different cps components.
141
142+--------------------------+---------------------------------+---------------------------------------------------+
143| Component | Secret type | Secret Name |
144+==========================+=================================+===================================================+
145| cps-core | Database authentication | <my-helm-release>-cps-core-pg-user-creds |
146+--------------------------+---------------------------------+---------------------------------------------------+
147| cps-core | Rest API Authentication | <my-helm-release>-cps-core-app-user-creds |
148+--------------------------+---------------------------------+---------------------------------------------------+
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100149| ncmp-dmi-plugin | Rest API Authentication | <my-helm-release>-cps-dmi-plugin-user-creds |
150+--------------------------+---------------------------------+---------------------------------------------------+
151| ncmp-dmi-plugin | SDNC authentication | <my-helm-release>-ncmp-dmi-plugin-sdnc-creds |
152+--------------------------+---------------------------------+---------------------------------------------------+
153
154The credential values from these secrets are configured in running container as environment variables. Eg:
lukegleesonfb7005f2023-07-07 15:12:17 +0100155`cps core deployment.yaml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-core/templates/deployment.yaml>`_
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100156
157If no specific passwords are provided to the chart as override values for deployment, then passwords are automatically
158generated when deploying the Helm release. Below command can be used to retrieve application property credentials
159
160.. code::
161
162 kubectl get secret <my-helm-release>-<secret-name> -n <namespace> -o json | jq '.data | map_values(@base64d)'
163
164.. note::
165 base64d works only with jq version 1.6 or above.
166
167CPS Core Pods
168=============
169To get a listing of the cps-core Pods, run the following command:
170
171.. code-block:: bash
172
173 kubectl get pods -n <namespace> | grep cps-core
174
175 dev-cps-core-ccd4cc956-r98pv 1/1 Running 0 24h
176 dev-cps-core-postgres-primary-f7766d46c-s9d5b 1/1 Running 0 24h
177 dev-cps-core-postgres-replica-84659d68f9-6qnt4 1/1 Running 0 24h
178
DylanB95EST34fdca82022-05-06 10:43:58 +0100179.. note::
180 The CPS Service will have to be restarted each time a change is made to a configurable property.
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100181
DylanB95EST34fdca82022-05-06 10:43:58 +0100182Additional CPS-Core Customizations
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100183==================================
184
185The following table lists some properties that can be specified as Helm chart
Renu Kumarifb4caa62022-03-21 09:18:41 -0400186values to configure the application to be deployed. This list is not exhaustive.
187
188Any spring supported property can be configured by providing in ``config.additional.<spring-supported-property-name>: value`` Example: config.additional.spring.datasource.hikari.maximumPoolSize: 30
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100189
waqas.ikram60bbcb92023-12-20 10:40:29 +0000190+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
191| Property | Description | Default Value |
192+===========================================+=========================================================================================================+===============================+
193| config.appUserName | User name used by cps-core service to configure the authentication for REST API it exposes. | ``cpsuser`` |
194| | | |
195| | This is the user name to be used by cps-core REST clients to authenticate themselves. | |
196+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
197| config.appUserPassword | Password used by cps-core service to configure the authentication for REST API it exposes. | Not defined |
198| | | |
199| | If not defined, the password is generated when deploying the application. | |
200| | | |
201| | See also :ref:`cps_common_credentials_retrieval`. | |
202+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
203| postgres.config.pgUserName | Internal user name used by cps-core to connect to its own database. | ``cps`` |
204+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
205| postgres.config.pgUserPassword | Internal password used by cps-core to connect to its own database. | Not defined |
206| | | |
207| | If not defined, the password is generated when deploying the application. | |
208| | | |
209| | See also :ref:`cps_common_credentials_retrieval`. | |
210+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
211| postgres.config.pgDatabase | Database name used by cps-core | ``cpsdb`` |
212| | | |
213+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
214| logging.level | Logging level set in cps-core | info |
215| | | |
216+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
217| config.useStrimziKafka | If targeting a custom kafka cluster, i.e. useStrimziKafka: false, the | true |
218| | config.eventPublisher.spring.kafka values below must be set. | |
219+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
220| config.eventPublisher. | Kafka hostname and port | ``<kafka-bootstrap>:9092`` |
221| spring.kafka.bootstrap-servers | | |
222+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
223| config.eventPublisher. | Kafka consumer client id | ``cps-core`` |
224| spring.kafka.consumer.client-id | | |
225+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
226| config.eventPublisher. | Kafka security protocol. | ``SASL_PLAINTEXT`` |
227| spring.kafka.security.protocol | Some possible values are: | |
228| | | |
229| | * ``PLAINTEXT`` | |
230| | * ``SASL_PLAINTEXT``, for authentication | |
231| | * ``SASL_SSL``, for authentication and encryption | |
232+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
233| config.eventPublisher. | Kafka security SASL mechanism. Required for SASL_PLAINTEXT and SASL_SSL protocols. | Not defined |
234| spring.kafka.properties. | Some possible values are: | |
235| sasl.mechanism | | |
236| | * ``PLAIN``, for PLAINTEXT | |
237| | * ``SCRAM-SHA-512``, for SSL | |
238+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
239| config.eventPublisher. | Kafka security SASL JAAS configuration. Required for SASL_PLAINTEXT and SASL_SSL protocols. | Not defined |
240| spring.kafka.properties. | Some possible values are: | |
241| sasl.jaas.config | | |
242| | * ``org.apache.kafka.common.security.plain.PlainLoginModule required username="..." password="...";``, | |
243| | for PLAINTEXT | |
244| | * ``org.apache.kafka.common.security.scram.ScramLoginModule required username="..." password="...";``, | |
245| | for SSL | |
246+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
247| config.eventPublisher. | Kafka security SASL SSL store type. Required for SASL_SSL protocol. | Not defined |
248| spring.kafka.ssl.trust-store-type | Some possible values are: | |
249| | | |
250| | * ``JKS`` | |
251+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
252| config.eventPublisher. | Kafka security SASL SSL store file location. Required for SASL_SSL protocol. | Not defined |
253| spring.kafka.ssl.trust-store-location | | |
254+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
255| config.eventPublisher. | Kafka security SASL SSL store password. Required for SASL_SSL protocol. | Not defined |
256| spring.kafka.ssl.trust-store-password | | |
257+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
258| config.eventPublisher. | Kafka security SASL SSL broker hostname identification verification. Required for SASL_SSL protocol. | Not defined |
259| spring.kafka.properties. | Possible value is: | |
260| ssl.endpoint.identification.algorithm | | |
261| | * ``""``, empty string to disable | |
262+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
263| config.additional. | Core pool size in asynchronous execution of notification. | ``2`` |
264| notification.async.executor. | | |
265| core-pool-size | | |
266+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
267| config.additional. | Max pool size in asynchronous execution of notification. | ``1`` |
268| notification.async.executor. | | |
269| max-pool-size | | |
270+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
271| config.additional. | Queue Capacity in asynchronous execution of notification. | ``500`` |
272| notification.async.executor. | | |
273| queue-capacity | | |
274+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
275| config.additional. | If the executor should wait for the tasks to be completed on shutdown | ``true`` |
276| notification.async.executor. | | |
277| wait-for-tasks-to-complete-on-shutdown | | |
278+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
279| config.additional. | Prefix to be added to the thread name in asynchronous execution of notifications. | ``Async-`` |
280| notification.async.executor. | | |
281| thread-name-prefix | | |
282+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
mpriyank6b0e6b32024-03-08 12:50:53 +0000283| config.additional. | Maximum time allowed by the thread pool executor for execution of one of the threads in milliseconds. | ``60000`` |
284| notification.async.executor. | | |
285| time-out-value-in-ms | | |
286+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
waqas.ikram60bbcb92023-12-20 10:40:29 +0000287| config.additional. | Specifies number of database connections between database and application. | ``10`` |
288| spring.datasource.hikari. | This property controls the maximum size that the pool is allowed to reach, | |
289| maximumPoolSize | including both idle and in-use connections. | |
290+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100291
DylanB95ESTdc656472022-08-08 15:22:54 +0100292.. _additional-cps-ncmp-customizations:
293
DylanB95EST34fdca82022-05-06 10:43:58 +0100294Additional CPS-NCMP Customizations
295==================================
waqas.ikram60bbcb92023-12-20 10:40:29 +0000296+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
297| config.dmiPluginUserName | User name used by cps-core to authenticate themselves for using ncmp-dmi-plugin service. | ``dmiuser`` |
298+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
299| config.dmiPluginUserPassword | Internal password used by cps-core to connect to ncmp-dmi-plugin service. | Not defined |
300| | | |
301| | If not defined, the password is generated when deploying the application. | |
302| | | |
303| | See also :ref:`cps_common_credentials_retrieval`. | |
304+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
danielhanrahan55740432024-10-17 14:55:49 +0100305| config.ncmp.timers | Specifies the delay in milliseconds in which the module sync watch dog will wake again after finishing. | ``5000`` |
waqas.ikram60bbcb92023-12-20 10:40:29 +0000306| .advised-modules-sync.sleep-time-ms | | |
307| | | |
308+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
waqas.ikram60bbcb92023-12-20 10:40:29 +0000309| config.ncmp.timers | Specifies the delay in milliseconds in which the data sync watch dog will wake again after finishing. | ``30000`` |
310| .cm-handle-data-sync.sleep-time-ms | | |
311| | | |
312+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
danielhanrahan55740432024-10-17 14:55:49 +0100313| config.additional.ncmp.dmi.httpclient | Specifies the maximum time in seconds, to wait for establishing a connection for the HTTP Client. | ``30`` |
waqas.ikram60bbcb92023-12-20 10:40:29 +0000314| .connectionTimeoutInSeconds | | |
315+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
316| config.additional.ncmp.dmi.httpclient | Specifies the maximum number of connections allowed per route in the HTTP client. | ``50`` |
317| .maximumConnectionsPerRoute | | |
318+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
319| config.additional.ncmp.dmi.httpclient | Specifies the maximum total number of connections that can be held by the HTTP client. | ``100`` |
320| .maximumConnectionsTotal | | |
321+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
322| config.additional.ncmp.dmi.httpclient | Specifies the duration in seconds for the threshold, after which idle connections will be evicted | ``5`` |
323| .idleConnectionEvictionThresholdInSeconds | from the connection pool by the HTTP client. | |
324+-------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+
DylanB95EST34fdca82022-05-06 10:43:58 +0100325
puthuparambil.aditya841e3df2021-10-05 10:56:04 +0100326CPS-Core Docker Installation
327============================
328
329CPS-Core can also be installed in a docker environment. Latest `docker-compose <https://github.com/onap/cps/blob/master/docker-compose/docker-compose.yml>`_ is included in the repo to start all the relevant services.
330The latest instructions are covered in the `README <https://github.com/onap/cps/blob/master/docker-compose/README.md>`_.
mpriyankb45c8092023-09-13 11:42:05 +0100331
mpriyank1ae90802023-11-27 13:53:12 +0000332.. Below Label is used by documentation for other CPS components to link here, do not remove even if it gives a warning
333.. _cps_common_distributed_datastructures:
334
mpriyank75697fe2024-10-14 13:44:31 +0100335NCMP Distributed Data Structures
336================================
mpriyankb45c8092023-09-13 11:42:05 +0100337
mpriyank75697fe2024-10-14 13:44:31 +0100338NCMP utilizes embedded distributed data structures to replicate state across various instances, ensuring low latency and high performance. Each JVM runs a Hazelcast instance to manage these data structures. To facilitate member visibility and cluster formation, an additional port (defaulting to 5701) must be available.
mpriyankb45c8092023-09-13 11:42:05 +0100339
340Below are the list of distributed datastructures that we have.
341
leventecsanyi0f6f4162024-01-11 12:53:26 +0100342+--------------+------------------------------------+-----------------------------------------------------------+
mpriyank75697fe2024-10-14 13:44:31 +0100343| Component | Data Structure Name | Use |
leventecsanyi0f6f4162024-01-11 12:53:26 +0100344+==============+====================================+===========================================================+
leventecsanyi0f6f4162024-01-11 12:53:26 +0100345| cps-ncmp | moduleSyncStartedOnCmHandles | Watchdog process to register cm handles. |
346+--------------+------------------------------------+-----------------------------------------------------------+
347| cps-ncmp | dataSyncSemaphores | Watchdog process to sync data from the nodes. |
348+--------------+------------------------------------+-----------------------------------------------------------+
349| cps-ncmp | moduleSyncWorkQueue | Queue used internally for workers to pick the task. |
350+--------------+------------------------------------+-----------------------------------------------------------+
mpriyank75697fe2024-10-14 13:44:31 +0100351| cps-ncmp | trustLevelPerCmHandle | Stores the trust level per cm handle id |
leventecsanyi0f6f4162024-01-11 12:53:26 +0100352+--------------+------------------------------------+-----------------------------------------------------------+
353| cps-ncmp | trustLevelPerDmiPlugin | Stores the trust level for the dmi-plugins. |
354+--------------+------------------------------------+-----------------------------------------------------------+
mpriyank1302ce82024-02-07 14:55:03 +0000355| cps-ncmp | cmNotificationSubscriptionCache | Stores and tracks cm notification subscription requests. |
leventecsanyi0f6f4162024-01-11 12:53:26 +0100356+--------------+------------------------------------+-----------------------------------------------------------+
mpriyankb45c8092023-09-13 11:42:05 +0100357
danielhanrahan55740432024-10-17 14:55:49 +0100358Total number of caches : 6