Fix configuration file permission in a1pms
[it/dep.git] / nonrtric / helm / policymanagementservice / templates / statefulset.yaml
1 ################################################################################
2 #   Copyright (c) 2020-2023 Nordix Foundation.                                 #
3 #   Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.  #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17
18 kind: StatefulSet
19 apiVersion: apps/v1
20 metadata:
21   name: {{ include "common.name.policymanagementservice" . }}
22   namespace: {{ include "common.namespace.nonrtric" . }}
23   generation: 1
24   labels:
25     app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.policymanagementservice" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ .Release.Name }}
28     heritage: {{ .Release.Service }}
29   annotations:
30     deployment.kubernetes.io/revision: '1'
31 spec:
32   serviceName: {{ include "common.name.policymanagementservice" . }}
33   replicas: 1
34   selector:
35     matchLabels:
36       app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.policymanagementservice" . }}
37       release: {{ .Release.Name }}
38   template:
39     metadata:
40       labels:
41         app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.policymanagementservice" . }}
42         release: {{ .Release.Name }}
43     spec:
44       hostname: {{ include "common.name.policymanagementservice" . }}
45       initContainers:
46       - name: copy
47         image: busybox:1.28
48         command:
49         - /bin/sh
50         - -c
51         - FILE=/var/policy-management-service/application_configuration.json;
52           if [ ! -f $FILE ]; then
53             cp  /etc/app/policy-management-service/application_configuration_json_initial/application_configuration.json $FILE;
54           fi;
55           chmod 666 $FILE;
56         volumeMounts:
57         - name: {{ include "common.name.policymanagementservice" . }}-vardata
58           mountPath: "/var/policy-management-service"
59         - name: {{ include "common.name.policymanagementservice" . }}-application-configuration-json-initial
60           mountPath: /etc/app/policy-management-service/application_configuration_json_initial
61       containers:
62       - name: {{ include "common.container.policymanagementservice" . }}
63         image: {{ .Values.policymanagementservice.image.registry }}/{{ .Values.policymanagementservice.image.name }}:{{ .Values.policymanagementservice.image.tag }}
64         imagePullPolicy: {{ .Values.policymanagementservice.imagePullPolicy }}
65         ports:
66         - containerPort: {{ .Values.policymanagementservice.service.targetPort1 }}
67           protocol: TCP
68         - containerPort: {{ .Values.policymanagementservice.service.targetPort2 }}
69           protocol: TCP
70         readinessProbe:
71           tcpSocket:
72             port: {{ .Values.policymanagementservice.service.targetPort1 }}
73           initialDelaySeconds: {{ .Values.policymanagementservice.liveness.initialDelaySeconds }}
74           periodSeconds: {{ .Values.policymanagementservice.liveness.periodSeconds }}
75         livenessProbe:
76           httpGet:
77             path: /status
78             port: {{ .Values.policymanagementservice.service.targetPort1 }}
79           initialDelaySeconds: {{ .Values.policymanagementservice.liveness.initialDelaySeconds }}
80           periodSeconds: {{ .Values.policymanagementservice.liveness.periodSeconds }}
81         volumeMounts:
82         - name: {{ include "common.name.policymanagementservice" . }}-vardata
83           mountPath: "/var/policy-management-service"
84         - name: {{ include "common.name.policymanagementservice" . }}-application-yaml
85           mountPath: /opt/app/policy-agent/config
86         - name: {{ include "common.name.policymanagementservice" . }}-application-configuration-json-initial
87           mountPath: /etc/app/policy-management-service/application_configuration_json_initial
88       volumes:
89         - name: {{ include "common.name.policymanagementservice" . }}-application-yaml
90           configMap:
91             name: {{ include "common.name.policymanagementservice" . }}-configmap-application-yaml
92         - name: {{ include "common.name.policymanagementservice" . }}-application-configuration-json-initial
93           configMap:
94             name: {{ include "common.name.policymanagementservice" . }}-configmap-application-json-configuration
95   volumeClaimTemplates:
96     - metadata:
97         name: {{ include "common.name.policymanagementservice" . }}-vardata
98       spec:
99         accessModes:
100           - ReadWriteOnce
101         storageClassName: "{{ .Values.policymanagementservice.persistence.storageClassName }}"
102         resources:
103           requests:
104             storage: "{{ .Values.policymanagementservice.persistence.size }}"