NONRTRIC - PMS Persistent storage of policies and type definitions 94/5994/1
authorPatrikBuhr <patrik.buhr@est.tech>
Tue, 4 May 2021 06:51:22 +0000 (08:51 +0200)
committerPatrikBuhr <patrik.buhr@est.tech>
Tue, 4 May 2021 06:56:44 +0000 (08:56 +0200)
Changed deployment to statefulset in both PMC and ECS.

"Even Deployments with one replica using ReadWriteOnce volume are not recommended. This is because the default Deployment strategy creates a second Pod before bringing down the first Pod
 on a recreate. The Deployment may fail in deadlock as the second Pod can't start because the ReadWriteOnce volume is already in use, and the first Pod won't be removed because the seco
nd Pod has not yet started. Instead, use a StatefulSet with ReadWriteOnce volumes."

Change-Id: If3afb358e9a111bf2be0d5ceb9c5a70c314a9222
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-478

nonrtric/helm/enrichmentservice/templates/statefulset.yaml [moved from nonrtric/helm/enrichmentservice/templates/deployment.yaml with 96% similarity]
nonrtric/helm/policymanagementservice/templates/statefulset.yaml [moved from nonrtric/helm/policymanagementservice/templates/deployment.yaml with 95% similarity]

@@ -14,7 +14,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 
-kind: Deployment
+kind: StatefulSet
 apiVersion: apps/v1
 metadata:
   name: {{ include "common.name.enrichmentservice" . }}
@@ -28,6 +28,7 @@ metadata:
   annotations:
     deployment.kubernetes.io/revision: '1'
 spec:
+  serviceName: {{ include "common.name.enrichmentservice" . }}
   replicas: 1
   selector:
     matchLabels:
@@ -64,11 +65,11 @@ spec:
         - name: {{ include "common.name.enrichmentservice" . }}-enrichment-config
           mountPath: /opt/app/enrichment-coordinator-service/config
         - name: {{ include "common.name.enrichmentservice" . }}-ei-jobs-vol
-          mountPath: /var/enrichment-coordinator-service/database
+          mountPath: /var/enrichment-coordinator-service
       volumes:
         - name: {{ include "common.name.enrichmentservice" . }}-enrichment-config
           configMap:
             name: {{ include "common.name.enrichmentservice" . }}-configmap
         - name: {{ include "common.name.enrichmentservice" . }}-ei-jobs-vol
           persistentVolumeClaim:
-            claimName: {{ include "common.name.enrichmentservice" . }}-pvc
\ No newline at end of file
+            claimName: {{ include "common.name.enrichmentservice" . }}-pvc
@@ -14,7 +14,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 
-kind: Deployment
+kind: StatefulSet
 apiVersion: apps/v1
 metadata:
   name: {{ include "common.name.policymanagementservice" . }}
@@ -28,6 +28,7 @@ metadata:
   annotations:
     deployment.kubernetes.io/revision: '1'
 spec:
+  serviceName: {{ include "common.name.policymanagementservice" . }}
   replicas: 1
   selector:
     matchLabels:
@@ -62,11 +63,11 @@ spec:
           periodSeconds: {{ .Values.policymanagementservice.liveness.periodSeconds }}
         volumeMounts:
         - name: {{ include "common.name.policymanagementservice" . }}-vardata
-          mountPath: "/var/policy-management-service/database"
+          mountPath: "/var/policy-management-service"
         - name: {{ include "common.name.policymanagementservice" . }}-policy-config
           mountPath: /opt/app/policy-agent/config
         - name: {{ include "common.name.policymanagementservice" . }}-policy-data
-          mountPath: /opt/app/policy-agent/data       
+          mountPath: /opt/app/policy-agent/data
       volumes:
         - name: {{ include "common.name.policymanagementservice" . }}-policy-config
           configMap: