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

Function inheritJobMetadata

internal/controller/cluster_create.go:1304–1313  ·  view source on GitHub ↗

inheritJobMetadata propagates the cluster's inherited annotations and labels onto an instance Job and its pod template.

(cluster *apiv1.Cluster, job *batchv1.Job)

Source from the content-addressed store, hash-verified

1302// inheritJobMetadata propagates the cluster's inherited annotations and labels
1303// onto an instance Job and its pod template.
1304func inheritJobMetadata(cluster *apiv1.Cluster, job *batchv1.Job) {
1305 utils.InheritAnnotations(&job.ObjectMeta, cluster.Annotations,
1306 cluster.GetFixedInheritedAnnotations(), configuration.Current)
1307 utils.InheritAnnotations(&job.Spec.Template.ObjectMeta, cluster.Annotations,
1308 cluster.GetFixedInheritedAnnotations(), configuration.Current)
1309 utils.InheritLabels(&job.ObjectMeta, cluster.Labels,
1310 cluster.GetFixedInheritedLabels(), configuration.Current)
1311 utils.InheritLabels(&job.Spec.Template.ObjectMeta, cluster.Labels,
1312 cluster.GetFixedInheritedLabels(), configuration.Current)
1313}
1314
1315// getOriginBackup gets the backup that is used to bootstrap a new PostgreSQL cluster
1316func (r *ClusterReconciler) getOriginBackup(ctx context.Context, cluster *apiv1.Cluster) (*apiv1.Backup, error) {

Callers 3

createPrimaryInstanceMethod · 0.85
joinReplicaInstanceMethod · 0.85

Calls 4

InheritAnnotationsFunction · 0.92
InheritLabelsFunction · 0.92

Tested by

no test coverage detected