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

Function createClusterPodSpec

pkg/specs/pods.go:184–207  ·  view source on GitHub ↗

createClusterPodSpec computes the PodSpec corresponding to a cluster

(
	podName string,
	cluster apiv1.Cluster,
	envConfig EnvConfig,
	gracePeriod int64,
	enableHTTPS bool,
)

Source from the content-addressed store, hash-verified

182
183// createClusterPodSpec computes the PodSpec corresponding to a cluster
184func createClusterPodSpec(
185 podName string,
186 cluster apiv1.Cluster,
187 envConfig EnvConfig,
188 gracePeriod int64,
189 enableHTTPS bool,
190) corev1.PodSpec {
191 return corev1.PodSpec{
192 Hostname: podName,
193 InitContainers: []corev1.Container{
194 createBootstrapContainer(cluster, getExtensions(&cluster)),
195 },
196 SchedulerName: cluster.Spec.SchedulerName,
197 Containers: createPostgresContainers(cluster, envConfig, enableHTTPS),
198 Volumes: createPostgresVolumes(&cluster, podName, getExtensions(&cluster)),
199 SecurityContext: GetPodSecurityContext(&cluster),
200 Affinity: CreateAffinitySection(cluster.Name, cluster.Spec.Affinity),
201 Tolerations: cluster.Spec.Affinity.Tolerations,
202 ServiceAccountName: cluster.GetServiceAccountName(),
203 NodeSelector: cluster.Spec.Affinity.NodeSelector,
204 TerminationGracePeriodSeconds: &gracePeriod,
205 TopologySpreadConstraints: cluster.Spec.TopologySpreadConstraints,
206 }
207}
208
209// createPostgresContainers create the PostgreSQL containers that are
210// used for every instance

Callers 1

buildInstanceFunction · 0.85

Calls 7

createBootstrapContainerFunction · 0.85
getExtensionsFunction · 0.85
createPostgresContainersFunction · 0.85
createPostgresVolumesFunction · 0.85
GetPodSecurityContextFunction · 0.85
CreateAffinitySectionFunction · 0.85
GetServiceAccountNameMethod · 0.45

Tested by

no test coverage detected