Added changes for performance and stability for opa-pdp 80/139780/3
authorsrinivasyanamadala <srinivas.yanamadala@techmahindra.com>
Fri, 20 Dec 2024 14:18:03 +0000 (15:18 +0100)
committersrinivasyanamadala <srinivas.yanamadala@techmahindra.com>
Mon, 23 Dec 2024 05:16:16 +0000 (06:16 +0100)
Issue-ID: POLICY-5215
Change-Id: Iea19dfd4a46509a60d7b4a41f714fd8221ce2d0d
Signed-off-by: srinivasyanamadala <srinivas.yanamadala@techmahindra.com>
16 files changed:
csit/resources/scripts/get-cluster-info.sh
csit/run-k8s-csit.sh
helm/policy/Chart.yaml
helm/policy/components/policy-apex-pdp/resources/config/OnapPfConfigSampleGroup.json
helm/policy/components/policy-opa-pdp/Chart.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/resources/config/config.json [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/resources/policies/policy-data.tar.gz [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/configmap.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/deployment.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/pvc.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/role-binding.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/secret.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/service-account.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/templates/service.yaml [new file with mode: 0755]
helm/policy/components/policy-opa-pdp/values.yaml [new file with mode: 0755]
helm/policy/components/policy-pap/resources/config/groups.json

index d8e4217..92e92ee 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/bash
 # ============LICENSE_START=======================================================
 #  Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
+#  Modifications Copyright © 2024 Deutsche Telekom
 # ================================================================================
+#
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -32,6 +35,7 @@ export PF_PARTICIPANT_PORT=30008
 export HTTP_PARTICIPANT_PORT=30009
 export K8S_PARTICIPANT_PORT=30010
 export SIM_PARTICIPANT_PORT=30011
+export OPA_PORT=30012
 export SIMULATOR_PORT=30904
 
 # Retrieve pod names
@@ -41,6 +45,7 @@ function get_pod_names() {
   export API_POD=$(get_pod_name api)
   export DMAAP_POD=$(get_pod_name message-router)
   export XACML_POD=$(get_pod_name xacml)
+  export OPA_POD=$(get_pod_name opa-pdp)
   export DROOLS_POD=$(get_pod_name drools-pdp)
   export DIST_POD=$(get_pod_name distribution)
   export ACM_POD=$(get_pod_name acm-runtime)
@@ -58,6 +63,7 @@ function get_svc_names() {
   export DMAAP_SVC=$(get_svc_name message-router)
   export DROOLS_SVC=$(get_svc_name drools-pdp)
   export XACML_SVC=$(get_svc_name policy-xacml-pdp)
+  export OPA_SVC=$(get_svc_name policy-opa-pdp)
   export DIST_SVC=$(get_svc_name policy-distribution)
   export ACM_SVC=$(get_svc_name policy-clamp-runtime-acm)
   export POLICY_PPNT_SVC=$(get_svc_name policy-clamp-ac-pf-ppnt)
@@ -72,6 +78,7 @@ function expose_services() {
     expose_service $PAP_SVC
     expose_service $API_SVC
     expose_service $XACML_SVC
+    expose_service_opa_pdp $OPA_SVC
     expose_service $DROOLS_SVC
     expose_service $DIST_SVC
     expose_service $ACM_SVC
@@ -93,6 +100,10 @@ function get_svc_name() {
   microk8s kubectl get svc --no-headers -o custom-columns=':metadata.name' | grep $1
 }
 
+function expose_service_opa_pdp() {
+  microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 8282 --target-port 8282
+}
+
 function expose_service() {
   microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 6969 --target-port 6969
 }
@@ -114,6 +125,7 @@ function patch_ports() {
   patch_port "$DIST_SVC" $DIST_PORT
   patch_port "$DROOLS_SVC" $DROOLS_PORT
   patch_port "$XACML_SVC" $XACML_PORT
+  patch_port "$OPA_SVC" $OPA_PORT
 }
 
 function setup_message_router_svc() {
index a243062..3f6e5a4 100755 (executable)
@@ -2,7 +2,10 @@
 #
 # ============LICENSE_START====================================================
 #  Copyright (C) 2022-2024 Nordix Foundation.
+#  Modifications Copyright © 2024 Deutsche Telekom
 # =============================================================================
+# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -33,6 +36,7 @@ POLICY_API_ROBOT="api-test.robot api-slas.robot"
 POLICY_PAP_ROBOT="pap-test.robot pap-slas.robot"
 POLICY_APEX_PDP_ROBOT="apex-pdp-test.robot apex-slas.robot"
 POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot xacml-pdp-slas.robot"
+POLICY_OPA_PDP_ROBOT="opa-pdp-test.robot"
 POLICY_DROOLS_PDP_ROBOT="drools-pdp-test.robot"
 POLICY_DISTRIBUTION_ROBOT="distribution-test.robot"
 
@@ -42,6 +46,7 @@ POLICY_CLAMP_CONTAINER="policy-clamp-runtime-acm"
 POLICY_APEX_CONTAINER="policy-apex-pdp"
 POLICY_DROOLS_CONTAINER="policy-drools-pdp"
 POLICY_XACML_CONTAINER="policy-xacml-pdp"
+POLICY_OPA_CONTAINER="policy-opa-pdp"
 POLICY_DISTRIBUTION_CONTAINER="policy-distribution"
 POLICY_K8S_PPNT_CONTAINER="policy-clamp-ac-k8s-ppnt"
 POLICY_HTTP_PPNT_CONTAINER="policy-clamp-ac-http-ppnt"
@@ -289,6 +294,12 @@ function set_project_config() {
         export SET_VALUES="--set $POLICY_XACML_CONTAINER.enabled=true"
         ;;
 
+    opa-pdp | policy-opa-pdp)
+        export ROBOT_FILE=($POLICY_OPA_PDP_ROBOT)
+        export READINESS_CONTAINERS=($POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_OPA_CONTAINER)
+        export SET_VALUES="--set $POLICY_OPA_CONTAINER.enabled=true"
+        ;;
+
     drools-pdp | policy-drools-pdp)
         export ROBOT_FILE=($POLICY_DROOLS_PDP_ROBOT)
         export READINESS_CONTAINERS=($POLICY_DROOLS_CONTAINER)
@@ -304,11 +315,11 @@ function set_project_config() {
     *)
         echo "Unknown project supplied. Enabling all policy charts for the deployment"
         export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,
-                    $POLICY_DISTRIBUTION_CONTAINER,$POLICY_DROOLS_CONTAINER,$POLICY_XACML_CONTAINER,
+                    $POLICY_DISTRIBUTION_CONTAINER,$POLICY_DROOLS_CONTAINER,$POLICY_XACML_CONTAINER,$POLICY_OPA_CONTAINER,
                     $POLICY_CLAMP_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER,
                     $POLICY_HTTP_PPNT_CONTAINER,$POLICY_SIM_PPNT_CONTAINER)
         export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true
-            --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true --set $POLICY_DROOLS_CONTAINER.enabled=true
+            --set $POLICY_OPA_CONTAINER.enabled=true --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true --set $POLICY_DROOLS_CONTAINER.enabled=true
             --set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_PF_PPNT_CONTAINER.enabled=true
             --set $POLICY_K8S_PPNT_CONTAINER.enabled=true --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true
             --set $POLICY_SIM_PPNT_CONTAINER.enabled=true"
index 9eb3912..8caccf5 100755 (executable)
@@ -1,5 +1,7 @@
 # Copyright © 2022-2024 Nordix Foundation
 #
+# Modifications Copyright © 2024 Deutsche Telekom
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -15,7 +17,7 @@
 apiVersion: v2
 description: ONAP Policy
 name: policy
-version: 11.0.0
+version: 11.0.1
 
 dependencies:
   - name: mariadb-galera
@@ -54,6 +56,10 @@ dependencies:
     version: ~11.x-0
     repository: 'file://components/policy-drools-pdp'
     condition: policy-drools-pdp.enabled
+  - name: policy-opa-pdp
+    version: ~11.x-0
+    repository: 'file://components/policy-opa-pdp'
+    condition: policy-opa-pdp.enabled
   - name: policy-xacml-pdp
     version: ~11.x-0
     repository: 'file://components/policy-xacml-pdp'
index 8d197f6..70943d6 100644 (file)
@@ -9,7 +9,7 @@
     "prometheus": true
   },
   "pdpStatusParameters": {
-    "pdpGroup": "sampleGroup",
+    "pdpGroup": "defaultGroup",
     "timeIntervalMs": 20000,
     "pdpType": "apex",
     "description": "Pdp Heartbeat",
@@ -47,4 +47,4 @@
       }
     ]
   }
-}
\ No newline at end of file
+}
diff --git a/helm/policy/components/policy-opa-pdp/Chart.yaml b/helm/policy/components/policy-opa-pdp/Chart.yaml
new file mode 100755 (executable)
index 0000000..b3c34fc
--- /dev/null
@@ -0,0 +1,23 @@
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+\r
+apiVersion: v2\r
+description: ONAP Policy OPA PDP\r
+name: policy-opa-pdp\r
+version: 11.0.0\r
+\r
diff --git a/helm/policy/components/policy-opa-pdp/resources/config/config.json b/helm/policy/components/policy-opa-pdp/resources/config/config.json
new file mode 100755 (executable)
index 0000000..f0adf0d
--- /dev/null
@@ -0,0 +1,43 @@
+{{/*
+#  ============LICENSE_START=======================================================
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.
+#  ================================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  SPDX-License-Identifier: Apache-2.0
+#  ============LICENSE_END=========================================================
+*/}}
+{
+  "logging": {
+    "level": "debug"
+  },
+  "services": [
+    {
+      "name": "opa-bundle-server",
+      "url": "http://policy-opa-pdp:8282/opa/bundles"
+    }
+  ],
+  "bundles": {
+    "opabundle": {
+      "service": "opa-bundle-server",
+      "resource": "bundle.tar.gz",
+      "polling": {
+        "min_delay_seconds": 60,
+        "max_delay_seconds": 120
+      }
+    }
+  },
+  "decision_logs": {
+    "console": true
+  }
+}
diff --git a/helm/policy/components/policy-opa-pdp/resources/policies/policy-data.tar.gz b/helm/policy/components/policy-opa-pdp/resources/policies/policy-data.tar.gz
new file mode 100755 (executable)
index 0000000..572e963
Binary files /dev/null and b/helm/policy/components/policy-opa-pdp/resources/policies/policy-data.tar.gz differ
diff --git a/helm/policy/components/policy-opa-pdp/templates/configmap.yaml b/helm/policy/components/policy-opa-pdp/templates/configmap.yaml
new file mode 100755 (executable)
index 0000000..36ad7cf
--- /dev/null
@@ -0,0 +1,49 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+\r
+apiVersion: v1\r
+kind: ConfigMap\r
+metadata:\r
+  name: {{ .Chart.Name }}-configmap-policies-data\r
+  namespace: default\r
+  labels:\r
+    app: {{ .Chart.Name }}\r
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}\r
+    release: release\r
+    heritage: Helm\r
+    {{- with .Files.Glob "resources/policies/*" }}\r
+binaryData:\r
+    {{- range $path, $bytes := . }}\r
+       {{ base $path }}: {{ $.Files.Get $path | b64enc | quote }}\r
+    {{- end }}\r
+    {{- end }}\r
+---\r
+apiVersion: v1\r
+kind: ConfigMap\r
+metadata:\r
+  name: {{ .Chart.Name }}-configmap-config\r
+  namespace: default\r
+  labels:\r
+    app: {{ .Chart.Name }}\r
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}\r
+    release: release\r
+    heritage: Helm\r
+data:\r
+{{ tpl (.Files.Glob "resources/config/*.{sql,json,properties,xml}").AsConfig . | indent 2 }}\r
diff --git a/helm/policy/components/policy-opa-pdp/templates/deployment.yaml b/helm/policy/components/policy-opa-pdp/templates/deployment.yaml
new file mode 100755 (executable)
index 0000000..100c00b
--- /dev/null
@@ -0,0 +1,153 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+\r
+apiVersion: apps/v1\r
+kind: Deployment\r
+metadata:\r
+  name: {{ .Chart.Name }}\r
+  namespace: default\r
+  labels:\r
+    app: {{ .Chart.Name }}\r
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}\r
+    release: release\r
+    heritage: Helm\r
+spec:\r
+  selector:\r
+    matchLabels:\r
+      app: {{ .Chart.Name }}\r
+  replicas: {{ .Values.replicaCount }}\r
+  template:\r
+    metadata:\r
+      labels:\r
+        app: {{ .Chart.Name }}\r
+        release: release\r
+    spec:\r
+      initContainers:\r
+      - command:\r
+        - /bin/sh\r
+        args:\r
+          - -c\r
+          - |\r
+            echo "*** set right permissions to the different folders"\r
+            chown -R {{ .Values.permissions.uid }}:{{ .Values.permissions.gid }} /var/log;\r
+            chmod -R 755 /var/log\r
+            chown -R {{ .Values.permissions.uid }}:{{ .Values.permissions.gid }} /opt/;\r
+            chmod -R 755 /opt/*\r
+            tar -xvf /tmp/policies/policy-data.tar.gz -C /opt/\r
+        image: busybox:latest\r
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}\r
+        securityContext:\r
+          runAsUser: 1000\r
+          runAsGroup: 1000\r
+          allowPrivilegeEscalation: false\r
+          readOnlyRootFilesystem: true\r
+        name: {{ .Chart.Name }}-readiness\r
+        volumeMounts:\r
+        - name: logs\r
+          mountPath: /var/log\r
+        - name: tmp-policies-data\r
+          mountPath: /tmp/policies\r
+        - name : opa-policies-data\r
+          mountPath: /opt/\r
+\r
+      containers:\r
+        - name: {{ .Chart.Name }}\r
+          image: {{ .Values.global.image.opapdp }}\r
+          imagePullPolicy: {{ .Values.global.pullPolicy }}         \r
+          ports:\r
+          - containerPort: {{ .Values.service.internalPort }}\r
+          # disable liveness probe when breakpoints set in debugger\r
+          # so K8s doesn't restart unresponsive container\r
+          {{- if eq .Values.liveness.enabled true }}\r
+          livenessProbe:\r
+            tcpSocket:\r
+              port: {{ .Values.service.internalPort }}\r
+            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}\r
+            periodSeconds: {{ .Values.liveness.periodSeconds }}\r
+          {{ end -}}\r
+          readinessProbe:\r
+            httpGet:\r
+              path: {{ .Values.readiness.api }}\r
+              port: {{ .Values.service.internalPort }}\r
+              httpHeaders:\r
+                - name: Authorization\r
+                  value: Basic {{ printf "%s:%s" .Values.restServer.user .Values.restServer.password | b64enc }}\r
+              scheme: HTTP\r
+            successThreshold: {{ .Values.readiness.successThreshold }}\r
+            failureThreshold: {{ .Values.readiness.failureThreshold }}\r
+            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}\r
+            periodSeconds: {{ .Values.readiness.periodSeconds }}\r
+            timeoutSeconds: {{ .Values.readiness.timeout }}\r
+          env:\r
+            - name: UseSASLForKAFKA\r
+              value: "{{ .Values.kafka.useSASL }}" \r
+            - name: BOOSTSTRAP_SERVER\r
+              value: "{{ .Values.kafka.brokers }}"\r
+            - name: KAFKA_USERNAME\r
+              value: "{{ .Values.kafka.username }}"\r
+            - name: KAFKA_PASSWORD\r
+              value: "{{ .Values.kafka.password }}"              \r
+            - name: LOG_LEVEL\r
+              value: "{{ .Values.log.loglevel }}"\r
+            - name: GROUPID\r
+              value: "{{ .Values.kafka.groupid }}"\r
+            - name: TOPIC\r
+              value: "{{ .Values.kafka.topic }}"\r
+          volumeMounts:\r
+          - name: opa-policies-data\r
+            mountPath: /opt\r
+          - name: opa-config\r
+            mountPath: /app/config\r
+          - name: opa-bundles\r
+            mountPath: /app/bundles\r
+          - name: logs\r
+            mountPath: /var/log\r
+          resources:\r
+{{ toYaml .Values.resources.small | indent 12 }}\r
+        {{- if .Values.nodeSelector }}\r
+        nodeSelector:\r
+{{ toYaml .Values.nodeSelector | indent 10 }}\r
+        {{- end -}}\r
+        {{- if .Values.affinity }}\r
+        affinity:\r
+{{ toYaml .Values.affinity | indent 10 }}\r
+        {{- end }}\r
+      serviceAccountName: {{ .Chart.Name }}-read\r
+      volumes:\r
+        - name: tmp-policies-data\r
+          configMap:\r
+            name: {{ .Chart.Name }}-configmap-policies-data\r
+            defaultMode: 0755\r
+        - name: opa-policies-data\r
+          persistentVolumeClaim:\r
+             claimName: {{ .Chart.Name }}-policies-data\r
+        - name: opa-config\r
+          configMap:\r
+            name: {{ .Chart.Name }}-configmap-config\r
+            defaultMode: 0755\r
+        - name: opa-bundles\r
+          emptyDir:\r
+            sizeLimit: {{ .Values.dirSizes.bundleDir.sizeLimit }}\r
+        - name: logs\r
+          emptyDir:\r
+            sizeLimit: {{ .Values.dirSizes.bundleDir.sizeLimit }}\r
+\r
+      imagePullSecrets:\r
+      - name: "default-docker-registry-key"\r
diff --git a/helm/policy/components/policy-opa-pdp/templates/pvc.yaml b/helm/policy/components/policy-opa-pdp/templates/pvc.yaml
new file mode 100755 (executable)
index 0000000..6f0f7e1
--- /dev/null
@@ -0,0 +1,41 @@
+{{/*
+#  ============LICENSE_START=======================================================
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.
+#  ================================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  SPDX-License-Identifier: Apache-2.0
+#  ============LICENSE_END=========================================================
+*/}}
+
+
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ .Chart.Name }}-policies-data
+  namespace: default
+  labels:
+    app: {{ .Chart.Name }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: 13.0.1
+    heritage: {{ .Release.Service }}
+spec:
+  accessModes:
+  - ReadWriteMany
+  resources:
+    requests:
+      storage: 5G
+  storageClassName: microk8s-hostpath
+  volumeMode: Filesystem
+
+
diff --git a/helm/policy/components/policy-opa-pdp/templates/role-binding.yaml b/helm/policy/components/policy-opa-pdp/templates/role-binding.yaml
new file mode 100755 (executable)
index 0000000..cc409ca
--- /dev/null
@@ -0,0 +1,34 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+\r
+apiVersion: rbac.authorization.k8s.io/v1\r
+# This cluster role binding allows anyone in the "manager" group to read secrets in any namespace.\r
+kind: RoleBinding\r
+metadata:\r
+  name: {{ .Chart.Name }}-read\r
+  namespace: default\r
+subjects:\r
+  - kind: ServiceAccount\r
+    name: {{ .Chart.Name }}-read\r
+roleRef:\r
+  kind: Role\r
+  name: read\r
+  apiGroup: rbac.authorization.k8s.io\r
+\r
diff --git a/helm/policy/components/policy-opa-pdp/templates/secret.yaml b/helm/policy/components/policy-opa-pdp/templates/secret.yaml
new file mode 100755 (executable)
index 0000000..013e474
--- /dev/null
@@ -0,0 +1,33 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+apiVersion: v1\r
+kind: Secret\r
+metadata:\r
+  name: {{ .Chart.Name }}-restserver-creds\r
+  namespace: default\r
+  labels:\r
+    app: {{ .Chart.Name }}\r
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}\r
+    release: release\r
+    heritage: Helm\r
+type: Opaque\r
+stringData:\r
+  login: {{ .Values.restServer.user }}\r
+  password: {{ .Values.restServer.password }}\r
diff --git a/helm/policy/components/policy-opa-pdp/templates/service-account.yaml b/helm/policy/components/policy-opa-pdp/templates/service-account.yaml
new file mode 100755 (executable)
index 0000000..709e905
--- /dev/null
@@ -0,0 +1,25 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+\r
+apiVersion: v1\r
+kind: ServiceAccount\r
+metadata:\r
+  name: {{ .Chart.Name }}-read\r
+  namespace: default\r
diff --git a/helm/policy/components/policy-opa-pdp/templates/service.yaml b/helm/policy/components/policy-opa-pdp/templates/service.yaml
new file mode 100755 (executable)
index 0000000..7eef3af
--- /dev/null
@@ -0,0 +1,40 @@
+{{/*\r
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+*/}}\r
+\r
+apiVersion: v1\r
+kind: Service\r
+metadata:\r
+  name: {{ .Chart.Name }}\r
+  namespace: default\r
+  labels:\r
+    app: {{ .Chart.Name }}\r
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}\r
+    release: release\r
+    heritage: Helm\r
+spec:\r
+  type: {{ .Values.service.type }}\r
+  ports:\r
+    - port: {{ .Values.service.externalPort }}\r
+      targetPort: {{ .Values.service.internalPort }}\r
+      name: {{ .Values.service.portName }}\r
+  selector:\r
+    app: {{ .Chart.Name }}\r
+    release: release\r
+\r
diff --git a/helm/policy/components/policy-opa-pdp/values.yaml b/helm/policy/components/policy-opa-pdp/values.yaml
new file mode 100755 (executable)
index 0000000..0667987
--- /dev/null
@@ -0,0 +1,117 @@
+#  ============LICENSE_START=======================================================\r
+#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.\r
+#  ================================================================================\r
+#  Licensed under the Apache License, Version 2.0 (the "License");\r
+#  you may not use this file except in compliance with the License.\r
+#  You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#  Unless required by applicable law or agreed to in writing, software\r
+#  distributed under the License is distributed on an "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#  See the License for the specific language governing permissions and\r
+#  limitations under the License.\r
+#\r
+#  SPDX-License-Identifier: Apache-2.0\r
+#  ============LICENSE_END=========================================================\r
+\r
+#################################################################\r
+# Global configuration defaults.\r
+#################################################################\r
+global:\r
+  persistence: {}\r
+  image:\r
+    opapdp: nexus3.onap.org:10001/onap/policy-opa-pdp:1.0.5-SNAPSHOT\r
+log:\r
+  loglevel: "debug"\r
+\r
+permissions:\r
+  uid: 100\r
+  gid: 102\r
+\r
+#################################################################\r
+# Secrets metaconfig\r
+#################################################################\r
+secrets:\r
+  - uid: restserver-creds\r
+    type: basicAuth\r
+    externalSecret: '{{ tpl (default "" .Values.restServer.credsExternalSecret) . }}'\r
+    login: '{{ .Values.restServer.user }}'\r
+    password: '{{ .Values.restServer.password }}'\r
+#################################################################\r
+# Application configuration defaults.\r
+#################################################################\r
+# application image\r
+pullPolicy: Always\r
+\r
+# flag to enable debugging - application support required\r
+debugEnabled: false\r
+\r
+# application configuration\r
+\r
+restServer:\r
+  user: policyadmin\r
+  password: zb!XztG34\r
+\r
+# default number of instances\r
+replicaCount: 1\r
+\r
+nodeSelector: {}\r
+\r
+affinity: {}\r
+\r
+# probe configuration parameters\r
+liveness:\r
+  initialDelaySeconds: 20\r
+  periodSeconds: 10\r
+  # necessary to disable liveness probe when setting breakpoints\r
+  # in debugger so K8s doesn't restart unresponsive container\r
+  enabled: true\r
+\r
+readiness:\r
+  initialDelaySeconds: 10\r
+  periodSeconds: 120\r
+  api: /ready\r
+  successThreshold: 1\r
+  failureThreshold: 3\r
+  timeout: 60\r
+\r
+service:\r
+  type: ClusterIP\r
+  name: policy-opa-pdp\r
+  portName: http\r
+  externalPort: 8282\r
+  internalPort: 8282\r
+\r
+ingress:\r
+  enabled: false\r
+\r
+flavor: small\r
+resources:\r
+  small:\r
+    limits:\r
+      cpu: 1\r
+      memory: 4Gi\r
+    requests:\r
+      cpu: 100m\r
+      memory: 1Gi\r
+  unlimited: {}\r
+\r
+dirSizes:\r
+  bundleDir:\r
+    sizeLimit: 1000Mi\r
+\r
+#Pods Service Account\r
+serviceAccount:\r
+  nameOverride: policy-opa-pdp\r
+  roles:\r
+    - read\r
+kafka:\r
+  groupid: "policy-opa-pdp"\r
+  topic: "policy-pdp-pap"\r
+  useSASL: "false"\r
+  username: ""\r
+  password: ""\r
+  brokers: "kafka.default.svc.cluster.local:9092"\r
+\r
index 3f62ee5..2d981e7 100644 (file)
@@ -1,5 +1,25 @@
 {
   "groups": [
+    {
+      "name": "opaGroup",
+      "version": "1.0.0",
+      "description": "The group that registers policy types for opa.",
+      "pdpGroupState": "ACTIVE",
+      "pdpSubgroups": [
+        {
+          "pdpType": "opa",
+          "desiredInstanceCount": 1,
+          "properties": {},
+          "supportedPolicyTypes": [
+            {
+              "name": "onap.policies.native.opa",
+              "version": "1.0.0"
+            }
+          ],
+          "policies": []
+        }
+      ]
+    },
     {
       "name": "defaultGroup",
       "version": "1.0.0",