MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / createPostgresContainers

Function createPostgresContainers

pkg/specs/pods.go:211–325  ·  view source on GitHub ↗

createPostgresContainers create the PostgreSQL containers that are used for every instance

(cluster apiv1.Cluster, envConfig EnvConfig, enableHTTPS bool)

Source from the content-addressed store, hash-verified

209// createPostgresContainers create the PostgreSQL containers that are
210// used for every instance
211func createPostgresContainers(cluster apiv1.Cluster, envConfig EnvConfig, enableHTTPS bool) []corev1.Container {
212 containers := []corev1.Container{
213 {
214 Name: PostgresContainerName,
215 Image: cluster.Status.Image,
216 ImagePullPolicy: cluster.Spec.ImagePullPolicy,
217 Env: envConfig.EnvVars,
218 EnvFrom: envConfig.EnvFrom,
219 VolumeMounts: CreatePostgresVolumeMounts(cluster, getExtensions(&cluster)),
220 // This is the default startup probe, and can be overridden
221 // the user configuration in cluster.spec.probes.startup
222 StartupProbe: &corev1.Probe{
223 PeriodSeconds: StartupProbePeriod,
224 TimeoutSeconds: 5,
225 ProbeHandler: corev1.ProbeHandler{
226 HTTPGet: &corev1.HTTPGetAction{
227 Path: url.PathStartup,
228 Port: intstr.FromInt32(url.StatusPort),
229 },
230 },
231 },
232 // This is the default readiness probe, and can be overridden
233 // by the user configuration in cluster.spec.probes.readiness
234 ReadinessProbe: &corev1.Probe{
235 TimeoutSeconds: 5,
236 PeriodSeconds: ReadinessProbePeriod,
237 ProbeHandler: corev1.ProbeHandler{
238 HTTPGet: &corev1.HTTPGetAction{
239 Path: url.PathReady,
240 Port: intstr.FromInt32(url.StatusPort),
241 },
242 },
243 },
244 // This is the default liveness probe, and can be overridden
245 // by the user configuration in cluster.spec.probes.liveness
246 LivenessProbe: &corev1.Probe{
247 PeriodSeconds: LivenessProbePeriod,
248 TimeoutSeconds: 5,
249 ProbeHandler: corev1.ProbeHandler{
250 HTTPGet: &corev1.HTTPGetAction{
251 Path: url.PathHealth,
252 Port: intstr.FromInt32(url.StatusPort),
253 },
254 },
255 },
256 Command: []string{
257 "/controller/manager",
258 "instance",
259 "run",
260 },
261 Resources: cluster.Spec.Resources,
262 Ports: []corev1.ContainerPort{
263 {
264 Name: "postgresql",
265 ContainerPort: postgres.ServerPort,
266 Protocol: "TCP",
267 },
268 {

Callers 1

createClusterPodSpecFunction · 0.85

Calls 8

getExtensionsFunction · 0.85
GetSecurityContextFunction · 0.85
addManagerLoggingOptionsFunction · 0.85
getFailureThresholdFunction · 0.85
GetMaxStartDelayMethod · 0.80
IsMetricsTLSEnabledMethod · 0.45

Tested by

no test coverage detected