Improve oran_oom helm charts
[it/dep.git] / smo-install / oran_oom / informationservice / templates / statefulset.yaml
index a597324..f9d8348 100644 (file)
 
 kind: StatefulSet
 apiVersion: apps/v1
-metadata:
-  name: {{ include "common.name.informationservice" . }}
-  namespace: {{ include "common.namespace.nonrtric" . }}
-  generation: 1
-  labels:
-    app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.informationservice" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-  annotations:
-    deployment.kubernetes.io/revision: '1'
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
-  serviceName: {{ include "common.name.informationservice" . }}
+  serviceName: {{ include "common.name" . }}
   replicas: 1
-  selector:
-    matchLabels:
-      app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.informationservice" . }}
-      release: {{ .Release.Name }}
+  selector: {{- include "common.selectors" . | nindent 4 }}
   template:
-    metadata:
-      labels:
-        app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.informationservice" . }}
-        release: {{ .Release.Name }}
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
-      hostname: {{ include "common.name.informationservice" . }}
+      hostname: {{ include "common.name" . }}
+      initContainers:
+        - name: fix-permission
+          command:
+          - sh
+          - -c
+          - mkdir /var/information-coordinator-service/database;
+            chown -R 1000:1000 /var/information-coordinator-service;
+          image: busybox:1.28
+          imagePullPolicy: {{ .Values.imagePullPolicy }}
+          volumeMounts:
+          - name: {{ include "common.vardataMountName" . }}
+            mountPath: /var/information-coordinator-service
       containers:
-      - name: {{ include "common.container.informationservice" . }}
-        image: {{ .Values.informationservice.image.registry }}/{{ .Values.informationservice.image.name }}:{{ .Values.informationservice.image.tag }}
-        imagePullPolicy: {{ .Values.informationservice.imagePullPolicy }}
-        ports:
-        - containerPort: {{ .Values.informationservice.service.targetPort1 }}
-          protocol: TCP
-        - containerPort: {{ .Values.informationservice.service.targetPort2 }}
-          protocol: TCP
-        readinessProbe:
-          tcpSocket:
-            port: {{ .Values.informationservice.service.targetPort1 }}
-          initialDelaySeconds: {{ .Values.informationservice.liveness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.informationservice.liveness.periodSeconds }}
-        livenessProbe:
-          httpGet:
-            path: /status
-            port: {{ .Values.informationservice.service.targetPort1 }}
-          initialDelaySeconds: {{ .Values.informationservice.liveness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.informationservice.liveness.periodSeconds }}
+      - name: {{ include "common.containername" . }}
+        image: {{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
+        imagePullPolicy: {{ .Values.imagePullPolicy }}
+        ports: {{- include "common.containerPorts" . | nindent 8 }}
+        {{- include "common.tcpsocketReadinessProbe" . | nindent 8 }}
+        {{- include "common.httpLiveProbe" . | nindent 8 }}
         volumeMounts:
-        - name: {{ include "common.name.informationservice" . }}-information-config
+        - name: {{ include "common.applicationConfigMountName" . }}
           mountPath: /opt/app/information-coordinator-service/config
-        - name: {{ include "common.name.informationservice" . }}-vardata
+        - name: {{ include "common.vardataMountName" . }}
           mountPath: /var/information-coordinator-service
-      volumes:
-        - name: {{ include "common.name.informationservice" . }}-information-config
-          configMap:
-            name: {{ include "common.name.informationservice" . }}-configmap
+      volumes: {{- include "common.applicationConfigVolume" . | nindent 8 }}
 
-  volumeClaimTemplates:
-    - metadata:
-        name: {{ include "common.name.informationservice" . }}-vardata
-      spec:
-        accessModes: [ ReadWriteOnce ]
-        storageClassName: "{{ .Values.informationservice.persistence.storageClassName }}"
-        resources:
-          requests:
-            storage: "{{ .Values.informationservice.persistence.size }}"
+  volumeClaimTemplates: {{- include "common.vardataVolumeClaimTemplate" . | nindent 4 }}