[DCAE] Svc template support for policy release override 65/122865/14
authorVijay Venkatesh Kumar <vv770d@att.com>
Mon, 26 Jul 2021 20:53:11 +0000 (16:53 -0400)
committerVijay Venkatesh Kumar <vv770d@att.com>
Wed, 25 Aug 2021 14:16:02 +0000 (14:16 +0000)
As ONAP (and policy framework) can be deployed with any release name,
the policy sidecar must support releasename as configuration.
The releasename is important to identify the K8S secret
created by Policy Framework (for retreiving the username/password
config required by Policy-Sidecar container).

Change-Id: I9145da841c68b585f2ad5f54c7df155470763f4f
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Issue-ID: DCAEGEN2-2870
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
kubernetes/dcaegen2-services/common/dcaegen2-services-common/templates/_deployment.tpl
kubernetes/dcaegen2-services/components/dcae-tcagen2/values.yaml

index 2d68b38..8738b10 100644 (file)
@@ -207,14 +207,27 @@ The sidecar is included if .Values.policies is set.  The
 Policy-sync sidecar polls PolicyEngine (PDP) periodically based
 on .Values.policies.duration and configuration retrieved is shared with
 DCAE Microservice container by common volume. Policy can be retrieved based on
-list of policyID or filter
+list of policyID or filter. An optional policyRelease parameter can be specified 
+to override the default policy helm release (used for retreiving the secret containing
+pdp username and password)
+
+Following is example policy config override
+
+dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1
+policies:
+  duration: 300
+  policyRelease: "onap"
+  policyID: |
+    '["onap.vfirewall.tca","onap.vdns.tca"]'
 */}}
 
 {{- define "dcaegen2-services-common.microserviceDeployment" -}}
 {{- $logDir :=  default "" .Values.logDirectory -}}
 {{- $certDir := default "" .Values.certDirectory . -}}
 {{- $tlsServer := default "" .Values.tlsServer -}}
-{{- $policy := default "" .Values.policies -}}
+{{- $commonRelease :=  print (include "common.release" .) -}}
+{{- $policy := default dict .Values.policies -}}
+{{- $policyRls := default $commonRelease $policy.policyRelease -}}
 {{- $drFeedConfig := default "" .Values.drFeedConfig -}}
 
 apiVersion: apps/v1
@@ -384,12 +397,12 @@ spec:
         - name: POLICY_SYNC_PDP_USER
           valueFrom:
             secretKeyRef:
-              name: onap-policy-xacml-pdp-api-creds
+              name: {{ $policyRls }}-policy-xacml-pdp-api-creds
               key: login
         - name: POLICY_SYNC_PDP_PASS
           valueFrom:
             secretKeyRef:
-              name: onap-policy-xacml-pdp-api-creds
+              name: {{ $policyRls }}-policy-xacml-pdp-api-creds
               key: password
         - name: POLICY_SYNC_PDP_URL
           value : http{{ if (include "common.needTLS" .) }}s{{ end }}://policy-xacml-pdp:6969
index a26c663..09529c8 100644 (file)
@@ -91,8 +91,9 @@ service:
 #dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1
 #policies:
 #  duration: 300
+#  policyRelease: "onap"
 #  policyID: |
-#    '["onap.vfirewall.tca","abc"]'
+#    '["onap.vfirewall.tca","onap.vdns.tca"]'
 #  filter: |
 #    '["DCAE.Config_vfirewall_.*"]'