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