Initial Version of Helm Chart for OpenDaylight
[integration/packaging.git] / helm / opendaylight / templates / statefulset.yaml
1 {{/*
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2021 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 */}}
12
13 apiVersion: apps/v1
14 kind: StatefulSet
15 metadata:
16   name: {{ include "opendaylight.fullname" . }}
17 spec:
18   {{- if not .Values.autoscaling.enabled }}
19   replicas: {{ .Values.replicaCount }}
20   {{- end }}
21   serviceName: {{ include "opendaylight.fullname" . }}
22   selector:
23     matchLabels:
24       {{- include "opendaylight.selectorLabels" . | nindent 6 }}
25   template:
26     metadata:
27       {{- with .Values.podAnnotations }}
28       annotations:
29         {{- toYaml . | nindent 8 }}
30       {{- end }}
31       labels:
32         {{- include "opendaylight.selectorLabels" . | nindent 8 }}
33     spec:
34       {{- with .Values.imagePullSecrets }}
35       imagePullSecrets:
36         {{- toYaml . | nindent 8 }}
37       {{- end }}
38       serviceAccountName: {{ include "opendaylight.serviceAccountName" . }}
39       securityContext:
40         {{- toYaml .Values.podSecurityContext | nindent 8 }}
41       initContainers:
42         - name: updatevolperm
43           image: busybox
44           command: ['chown','8181','/data']
45           volumeMounts:
46           - name: {{ .Values.persistence.volName }}
47             mountPath: {{ .Values.persistence.mountPath }}
48       containers:
49         - name: {{ .Chart.Name }}
50           securityContext:
51             {{- toYaml .Values.securityContext | nindent 12 }}
52           image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
53           imagePullPolicy: {{ .Values.image.pullPolicy }}
54           command: ['bash','-c','bash -x /scripts/startodl.sh']
55           env:
56           - name: FEATURES
57             value: "{{ .Values.config.features }}"
58           - name: JAVA_HOME
59             value: "{{ .Values.config.javaHome}}"
60           - name: JAVA_OPTS
61             value: "-Xms{{.Values.config.javaOptions.minMemory}} -Xmx{{.Values.config.javaOptions.maxMemory}}"
62           - name: EXTRA_JAVA_OPTS
63             value: "-XX:+UseG1GC -XX:MaxGCPauseMillis={{.Values.config.javaOptions.maxGCPauseMillis}} -XX:ParallelGCThreads={{.Values.config.javaOptions.parallelGCThreads}} -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication {{.Values.config.javaOptions.gcLogOptions}}"
64           ports:
65             - name: http
66               containerPort: {{ .Values.service.port }}
67               protocol: TCP
68           readinessProbe:
69             tcpSocket:
70               port: {{ .Values.service.port }}
71             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.readiness.periodSeconds }}
73           resources:
74             {{- toYaml .Values.resources | nindent 12 }}
75           volumeMounts:
76           - name: {{ .Values.persistence.volName }}
77             mountPath: {{ .Values.persistence.mountPath }}
78           - name: scripts
79             mountPath: /scripts
80       {{- with .Values.nodeSelector }}
81       nodeSelector:
82         {{- toYaml . | nindent 8 }}
83       {{- end }}
84       {{- with .Values.affinity }}
85       affinity:
86         {{- toYaml . | nindent 8 }}
87       {{- end }}
88       {{- with .Values.tolerations }}
89       tolerations:
90         {{- toYaml . | nindent 8 }}
91       {{- end }}
92       volumes:
93         - name: scripts
94           configMap:
95             name: {{ include "opendaylight.fullname" . }}
96   {{ if not .Values.persistence.enabled }}
97         - name: {{ .Values.persistence.volName }} 
98           emptyDir: {}
99   {{ else }}
100   volumeClaimTemplates:
101   - metadata:
102       name: {{ .Values.persistence.volName }} 
103     spec:
104       accessModes:
105       - {{ .Values.persistence.accessMode }}
106       storageClassName: {{ .Values.persistence.storageClass }}
107       resources:
108         requests:
109           storage: {{ .Values.persistence.size }}
110   {{- end }}