Enable https port

Issue-ID: NONRTRIC-224
Change-Id: I65b80da2f45007c57d4246d6f7f40085756c7126
Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
diff --git a/nonrtric/helm/controlpanel/resources/application.properties b/nonrtric/helm/controlpanel/resources/application.properties
index acf2092..2ffa5b7 100644
--- a/nonrtric/helm/controlpanel/resources/application.properties
+++ b/nonrtric/helm/controlpanel/resources/application.properties
@@ -14,8 +14,15 @@
 #   limitations under the License.                                             #
 ################################################################################
 server.port = 8082
+server.ssl.key-store-type = PKCS12
+server.ssl.key-store-password = ericsson_kwdjfhw
+server.ssl.key-store =  classpath:keystore.jks
+server.ssl.key-password = ericsson_kwdjfhw
 server.http.port = 8080
-policycontroller.url.prefix = http://policymanagementservice:8081
+# https api
+policycontroller.url.prefix = https://policymanagementservice:9081
+# http api
+#policycontroller.url.prefix = http://policymanagementservice:9080
 userfile = users.json
 portalapi.decryptor = org.oransc.portal.nonrtric.controlpanel.portalapi.PortalSdkDecryptorAes
 portalapi.usercookie = UserId
diff --git a/nonrtric/helm/controlpanel/templates/deployment.yaml b/nonrtric/helm/controlpanel/templates/deployment.yaml
index d2fbd57..0d08ea4 100644
--- a/nonrtric/helm/controlpanel/templates/deployment.yaml
+++ b/nonrtric/helm/controlpanel/templates/deployment.yaml
@@ -45,9 +45,10 @@
           image: {{ .Values.controlpanel.image.registry }}/{{ .Values.controlpanel.image.name }}:{{ .Values.controlpanel.image.tag }}
           imagePullPolicy: {{ .Values.controlpanel.imagePullPolicy }}
           ports:
-            - name: http
-              containerPort: {{ .Values.controlpanel.service.internalPort }}
-              protocol: TCP
+          - containerPort: {{ .Values.controlpanel.service.targetPort1 }}
+            protocol: TCP
+          - containerPort: {{ .Values.controlpanel.service.targetPort2 }}
+            protocol: TCP
           volumeMounts:
             - name: configmap
               mountPath: /maven/application.properties
@@ -55,9 +56,14 @@
               readOnly: true
           readinessProbe:
             tcpSocket:
-              port: {{ .Values.controlpanel.service.internalPort }}
-            initialDelaySeconds: 15
-            periodSeconds: 15
+              port: {{ .Values.controlpanel.service.targetPort1 }}
+            initialDelaySeconds: {{ .Values.controlpanel.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.controlpanel.liveness.periodSeconds }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.controlpanel.service.targetPort1 }}
+            initialDelaySeconds: {{ .Values.controlpanel.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.controlpanel.liveness.periodSeconds }}
       volumes:
         - name: configmap
           configMap:
diff --git a/nonrtric/helm/controlpanel/templates/service.yaml b/nonrtric/helm/controlpanel/templates/service.yaml
index cf0d36f..1a61ed7 100644
--- a/nonrtric/helm/controlpanel/templates/service.yaml
+++ b/nonrtric/helm/controlpanel/templates/service.yaml
@@ -27,10 +27,18 @@
 spec:
   type: NodePort
   ports:
-    - port: {{ .Values.controlpanel.service.internalPort }}
-      nodePort: {{ .Values.controlpanel.service.externalPort }}
+    {{if eq .Values.controlpanel.service.allowHttp true -}}
+    - name: {{ index .Values.controlpanel.service.httpName }}
+      port: {{ .Values.controlpanel.service.internalPort1 }}
+      targetPort: {{ .Values.controlpanel.service.targetPort1 }}
+      nodePort: {{ .Values.controlpanel.service.externalPort1 }}
       protocol: TCP
-      targetPort: {{ .Values.controlpanel.service.internalPort }}
+    {{- end }}
+    - name: {{ index .Values.controlpanel.service.httpsName }}
+      port: {{ .Values.controlpanel.service.internalPort2 }}
+      targetPort: {{ .Values.controlpanel.service.targetPort2 }}
+      nodePort: {{ .Values.controlpanel.service.externalPort2 }}
+      protocol: TCP
   selector:
     app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }}
     release: {{ .Release.Name }}
\ No newline at end of file
diff --git a/nonrtric/helm/controlpanel/values.yaml b/nonrtric/helm/controlpanel/values.yaml
index 23fe2fd..d7a6285 100644
--- a/nonrtric/helm/controlpanel/values.yaml
+++ b/nonrtric/helm/controlpanel/values.yaml
@@ -26,5 +26,18 @@
     tag: 1.0.0
   replicaCount: 1
   service:
-    internalPort: 8080
-    externalPort: 30090
+    allowHttp: true
+    httpName: http
+    internalPort1: 8080
+    targetPort1: 8080
+    externalPort1: 30091
+    httpsName: https
+    internalPort2: 8081
+    targetPort2: 8082
+    externalPort2: 30092
+  liveness:
+    initialDelaySeconds: 20
+    periodSeconds: 10
+  readiness:
+    initialDelaySeconds: 20
+    periodSeconds: 10