File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package patroni
66
77import (
88 "context"
9+ "github.com/percona/percona-postgresql-operator/percona/k8s"
910 "strings"
1011
1112 corev1 "k8s.io/api/core/v1"
@@ -134,6 +135,19 @@ func InstancePod(ctx context.Context,
134135
135136 instanceProbes (inCluster , container )
136137
138+ // K8SPG-708
139+ if inCluster .CompareVersion ("2.7.0" ) >= 0 {
140+ outInstancePod .Spec .InitContainers = []corev1.Container {
141+ k8s .InitContainer (
142+ naming .ContainerDatabase ,
143+ inCluster .Spec .Image ,
144+ inCluster .Spec .ImagePullPolicy ,
145+ initialize .RestrictedSecurityContext (true ),
146+ container .Resources ,
147+ ),
148+ }
149+ }
150+
137151 return nil
138152}
139153
Original file line number Diff line number Diff line change @@ -182,6 +182,28 @@ containers:
182182 - mountPath: /etc/patroni
183183 name: patroni-config
184184 readOnly: true
185+ initContainers:
186+ - command:
187+ - /usr/local/bin/init-entrypoint.sh
188+ image: image
189+ imagePullPolicy: Always
190+ name: database-init
191+ resources: {}
192+ securityContext:
193+ allowPrivilegeEscalation: false
194+ capabilities:
195+ drop:
196+ - ALL
197+ privileged: false
198+ readOnlyRootFilesystem: true
199+ runAsNonRoot: true
200+ seccompProfile:
201+ type: RuntimeDefault
202+ terminationMessagePath: /dev/termination-log
203+ terminationMessagePolicy: File
204+ volumeMounts:
205+ - mountPath: /opt/crunchy
206+ name: crunchy-bin
185207volumes:
186208- name: patroni-config
187209 projected:
You can’t perform that action at this time.
0 commit comments