Fix doc config files and dead links
[policy/parent.git] / docs / installation / oom.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5
6 Policy OOM Installation
7 -----------------------
8
9 .. contents::
10     :depth: 2
11
12 Policy OOM Charts
13 *****************
14 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>`_.
15
16 Please refer to the OOM documentation on how to install and deploy ONAP.
17
18 Policy Pods
19 ***********
20 To get a listing of the Policy Pods, run the following command:
21
22 .. code-block:: bash
23
24   kubectl get pods -n onap | grep dev-policy
25
26   dev-policy-59684c7b9c-5gd6r                        2/2     Running            0          8m41s
27   dev-policy-apex-pdp-0                              1/1     Running            0          8m41s
28   dev-policy-api-56f55f59c5-nl5cg                    1/1     Running            0          8m41s
29   dev-policy-distribution-54cc59b8bd-jkg5d           1/1     Running            0          8m41s
30   dev-policy-mariadb-0                               1/1     Running            0          8m41s
31   dev-policy-xacml-pdp-765c7d58b5-l6pr7              1/1     Running            0          8m41s
32
33 .. note::
34    To get a listing of the Policy services, run this command:
35    kubectl get svc -n onap | grep policy
36
37 Accessing Policy Containers
38 ***************************
39 Accessing the policy docker containers is the same as for any kubernetes container. Here is an example:
40
41 .. code-block:: bash
42
43   kubectl -n onap exec -it dev-policy-policy-xacml-pdp-584844b8cf-9zptx bash
44
45 .. _install-upgrade-policy-label:
46
47 Installing or Upgrading Policy
48 ******************************
49 The assumption is you have cloned the charts from the OOM repository into a local directory.
50
51 **Step 1** Go into local copy of OOM charts
52
53 From your local copy, edit any of the values.yaml files in the policy tree to make desired changes.
54
55 The policy schema will be installed automatically as part of the database configuration using ``db-migrator``.
56 By default the policy schema is upgraded to the latest version.
57 For more information on how to change the ``db-migrator`` setup please see
58 :ref:`Using Policy DB Migrator <policy-db-migrator-label>`.
59
60 **Step 2** Build the charts
61
62 .. code-block:: bash
63
64   make policy
65   make SKIP_LINT=TRUE onap
66
67 .. note::
68    SKIP_LINT is only to reduce the "make" time
69
70 **Step 3** Undeploy Policy
71 After undeploying policy, loop on monitoring the policy pods until they go away.
72
73 .. code-block:: bash
74
75   helm undeploy dev-policy
76   kubectl get pods -n onap | grep dev-policy
77
78
79 **Step 4** Re-Deploy Policy pods
80
81 After deploying policy, loop on monitoring the policy pods until they come up.
82
83 .. code-block:: bash
84
85   helm deploy dev-policy local/onap --namespace onap
86   kubectl get pods -n onap | grep dev-policy
87
88 .. note::
89    If you want to purge the existing data and start with a clean install,
90    please follow these steps after undeploying:
91
92    **Step 1** Delete NFS persisted data for Policy
93
94    .. code-block:: bash
95
96      rm -fr /dockerdata-nfs/dev/policy
97
98    **Step 2** Make sure there is no orphan policy database persistent volume or claim.
99
100    First, find if there is an orphan database PV or PVC with the following commands:
101
102    .. code-block:: bash
103
104      kubectl get pvc -n onap | grep policy
105      kubectl get pv -n onap | grep policy
106
107    If there are any orphan resources, delete them with
108
109    .. code-block:: bash
110
111        kubectl delete pvc <orphan-policy-mariadb-resource>
112        kubectl delete pv <orphan-policy-mariadb-resource>
113
114
115 Restarting a faulty component
116 *****************************
117 Each policy component can be restarted independently by issuing the following command:
118
119 .. code-block:: bash
120
121     kubectl delete pod <policy-pod> -n onap
122
123 Exposing ports
124 **************
125 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.
126
127 .. code-block:: bash
128
129   kubectl -n onap expose service policy-api --port=7171 --target-port=6969 --name=api-public --type=NodePort
130
131 Overriding certificate stores
132 *****************************
133 Policy components package default key and trust stores that support https based communication with other
134 AAF-enabled ONAP components.  Each store can be overridden at installation.
135
136 To override a default keystore, the new certificate store (policy-keystore) file should be placed at the
137 appropriate helm chart locations below:
138
139 * oom/kubernetes/policy/charts/drools/resources/secrets/policy-keystore drools pdp keystore override.
140 * oom/kubernetes/policy/charts/policy-apex-pdp/resources/config/policy-keystore apex pdp keystore override.
141 * oom/kubernetes/policy/charts/policy-api/resources/config/policy-keystore api keystore override.
142 * oom/kubernetes/policy/charts/policy-distribution/resources/config/policy-keystore distribution keystore override.
143 * oom/kubernetes/policy/charts/policy-pap/resources/config/policy-keystore pap keystore override.
144 * oom/kubernetes/policy/charts/policy-xacml-pdp/resources/config/policy-keystore xacml pdp keystore override.
145
146 In the event that the truststore (policy-truststore) needs to be overriden as well, place it at the appropriate
147 location below:
148
149 * oom/kubernetes/policy/charts/drools/resources/configmaps/policy-truststore drools pdp truststore override.
150 * oom/kubernetes/policy/charts/policy-apex-pdp/resources/config/policy-truststore apex pdp truststore override.
151 * oom/kubernetes/policy/charts/policy-api/resources/config/policy-truststore api truststore override.
152 * oom/kubernetes/policy/charts/policy-distribution/resources/config/policy-truststore distribution truststore override.
153 * oom/kubernetes/policy/charts/policy-pap/resources/config/policy-truststore pap truststore override.
154 * oom/kubernetes/policy/charts/policy-xacml-pdp/resources/config/policy-truststore xacml pdp truststore override.
155
156 When the keystore passwords are changed, the corresponding component configuration ([1]_) should also change:
157
158 * oom/kubernetes/policy/charts/drools/values.yaml
159 * oom/kubernetes/policy-apex-pdp/resources/config/config.json
160 * oom/kubernetes/policy-distribution/resources/config/config.json
161
162 This procedure is applicable to an installation that requires either AAF or non-AAF derived certificates.
163 The reader is refered to the AAF documentation when new AAF-compliant keystores are desired:
164
165 * `AAF automated configuration and Certificates <https://wiki.onap.org/display/DW/Application+Authorization+Framework+%28AAF%29+Documentation>`_.
166 * `AAF Certificate Management for Dummies <https://wiki.onap.org/display/DW/AAF+Certificate+Management+for+Dummies>`_.
167 * `Instructional Videos <https://wiki.onap.org/display/DW/Instructional+Videos>`_.
168
169 After these changes, follow the procedures in the :ref:`install-upgrade-policy-label` section to make usage of
170 the new stores effective.
171
172 Additional PDP-D Customizations
173 *******************************
174
175 Credentials and other configuration parameters can be set as values
176 when deploying the policy (drools) subchart.  Please refer to
177 `PDP-D Default Values <https://git.onap.org/oom/tree/kubernetes/policy/components/policy-drools-pdp/values.yaml>`_
178 for the current default values.  It is strongly recommended that sensitive
179 information is secured appropriately before using in production.
180
181 Additional customization can be applied to the PDP-D.  Custom configuration goes under the
182 "resources" directory of the drools subchart (oom/kubernetes/policy/charts/drools/resources).
183 This requires rebuilding the policy subchart
184 (see section :ref:`install-upgrade-policy-label`).
185
186 Configuration is done by adding or modifying configmaps and/or secrets.
187 Configmaps are placed under "drools/resources/configmaps", and
188 secrets under "drools/resources/secrets".
189
190 Custom configuration supportes these types of files:
191
192 * **\*.conf** files to support additional environment configuration.
193 * **features\*.zip** to add additional custom features.
194 * **\*.pre.sh** scripts to be executed before starting the PDP-D process.
195 * **\*.post.sh** scripts to be executed after starting the PDP-D process.
196 * **policy-keystore** to override the PDP-D policy-keystore.
197 * **policy-truststore** to override the PDP-D policy-truststore.
198 * **aaf-cadi.keyfile** to override the PDP-D AAF key.
199 * **\*.properties** to override or add properties files.
200 * **\*.xml** to override or add xml configuration files.
201 * **\*.json** to override json configuration files.
202 * **\*settings.xml** to override maven repositories configuration .
203
204 Examples
205 ^^^^^^^^
206
207 To *disable AAF*, simply override the "aaf.enabled" value when deploying the helm chart
208 (see the OOM installation instructions mentioned above).
209
210 To *override the PDP-D keystore or trustore*, add a suitable replacement(s) under
211 "drools/resources/secrets".  Modify the drools chart values.yaml with
212 new credentials, and follow the procedures described at
213 :ref:`install-upgrade-policy-label` to redeploy the chart.
214
215 To *disable https* for the DMaaP configuration topic, add a copy of
216 `engine.properties <https://git.onap.org/policy/drools-pdp/tree/policy-management/src/main/server/config/engine.properties>`_
217 with "dmaap.source.topics.PDPD-CONFIGURATION.https" set to "false", or alternatively
218 create a ".pre.sh" script (see above) that edits this file before the PDP-D is
219 started.
220
221 To use *noop topics* for standalone testing, add a "noop.pre.sh" script under
222 oom/kubernetes/policy/charts/drools/resources/configmaps/:
223
224 .. code-block:: bash
225
226     #!/bin/bash
227     sed -i "s/^dmaap/noop/g" $POLICY_HOME/config/*.properties
228
229
230 .. rubric:: Footnotes
231
232 .. [1] There is a limitation that store passwords are not configurable for policy-api, policy-pap, and policy-xacml-pdp.