expose nexus and swagger api ports externally

Change-Id: I2da21b691751e731e66a21502999a8ad2d4ef8bf
Issue-ID: POLICY-778
Signed-off-by: mayankg2703 <mayank.gupta@amdocs.com>
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
index c59ed08..6c7ac5f 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
@@ -43,18 +43,18 @@
           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           ports:
-          - containerPort: {{ .Values.service.internalPort }}
+          - containerPort: {{ .Values.service.externalPort }}
           {{- if eq .Values.liveness.enabled true }}
           livenessProbe:
             tcpSocket:
-              port: {{ .Values.service.internalPort }}
+              port: {{ .Values.service.externalPort }}
             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
             periodSeconds: {{ .Values.liveness.periodSeconds }}
           {{ end -}}
           readinessProbe:
             httpGet:
               path: {{ .Values.readiness.path }}
-              port: {{ .Values.service.internalPort }}
+              port: {{ .Values.service.externalPort }}
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
           volumeMounts:
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
index ded4657..594950e 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
@@ -23,10 +23,17 @@
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
+  type: {{ .Values.service.type }}
   ports:
-    - port: {{ .Values.service.internalPort }}
+    {{if eq .Values.service.type "NodePort" -}}
+    - port: {{ .Values.service.externalPort }}
+      nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
       name: {{ .Values.service.portName }}
+    {{- else -}}
+    - port: {{ .Values.service.externalPort }}
+      targetPort: {{ .Values.service.internalPort }}
+      name: {{ .Values.service.portName }}
+    {{- end}}
   selector:
     app: {{ include "common.name" . }}
     release: {{ .Release.Name }}
-  clusterIP: None
diff --git a/kubernetes/policy/charts/drools/charts/nexus/values.yaml b/kubernetes/policy/charts/drools/charts/nexus/values.yaml
index 6679876..55b231a 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/values.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/values.yaml
@@ -62,7 +62,8 @@
   type: NodePort
   name: nexus
   portName: nexus
-  internalPort: 8081
+  externalPort: 8081
+  nodePort: 36
 
 ingress:
   enabled: false
diff --git a/kubernetes/policy/charts/pdp/templates/service.yaml b/kubernetes/policy/charts/pdp/templates/service.yaml
index d44fbb9..fc608d5 100644
--- a/kubernetes/policy/charts/pdp/templates/service.yaml
+++ b/kubernetes/policy/charts/pdp/templates/service.yaml
@@ -49,4 +49,3 @@
     app: {{ include "common.name" . }}
     release: {{ .Release.Name }}
   sessionAffinity: None
-  clusterIP: None
diff --git a/kubernetes/policy/charts/pdp/values.yaml b/kubernetes/policy/charts/pdp/values.yaml
index 3287c9f..959bb8e 100644
--- a/kubernetes/policy/charts/pdp/values.yaml
+++ b/kubernetes/policy/charts/pdp/values.yaml
@@ -58,11 +58,11 @@
   periodSeconds: 10
 
 service:
-  type: ClusterIP
+  type: NodePort
   name: pdp
   portName: pdp
-  internalPort: 8081
   externalPort: 8081
+  nodePort: 37
 
 ingress:
   enabled: false