@@ -16,6 +16,7 @@ import (
1616 "k8s.io/apimachinery/pkg/labels"
1717
1818 "github.com/crunchydata/postgres-operator/internal/initialize"
19+ "github.com/crunchydata/postgres-operator/internal/naming"
1920 "github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2021)
2122
@@ -129,7 +130,6 @@ func (r *PGUpgradeReconciler) generateUpgradeJob(
129130 job .Namespace = upgrade .Namespace
130131 job .Name = pgUpgradeJob (upgrade ).Name
131132
132- job .Annotations = upgrade .Spec .Metadata .GetAnnotationsOrNil ()
133133 job .Labels = Merge (upgrade .Spec .Metadata .GetLabelsOrNil (),
134134 commonLabels (pgUpgrade , upgrade ), //FIXME role pgupgrade
135135 map [string ]string {
@@ -145,6 +145,11 @@ func (r *PGUpgradeReconciler) generateUpgradeJob(
145145 }
146146 }
147147
148+ job .Annotations = Merge (upgrade .Spec .Metadata .GetAnnotationsOrNil (),
149+ map [string ]string {
150+ naming .DefaultContainerLabel : database .Name ,
151+ })
152+
148153 // Copy the pod template from the startup instance StatefulSet. This includes
149154 // the service account, volumes, DNS policies, and scheduling constraints.
150155 startup .Spec .Template .DeepCopyInto (& job .Spec .Template )
@@ -241,7 +246,6 @@ func (r *PGUpgradeReconciler) generateRemoveDataJob(
241246 job .Namespace = upgrade .Namespace
242247 job .Name = upgrade .Name + "-" + sts .Name
243248
244- job .Annotations = upgrade .Spec .Metadata .GetAnnotationsOrNil ()
245249 job .Labels = labels .Merge (upgrade .Spec .Metadata .GetLabelsOrNil (),
246250 commonLabels (removeData , upgrade )) //FIXME role removedata
247251
@@ -254,6 +258,11 @@ func (r *PGUpgradeReconciler) generateRemoveDataJob(
254258 }
255259 }
256260
261+ job .Annotations = Merge (upgrade .Spec .Metadata .GetAnnotationsOrNil (),
262+ map [string ]string {
263+ naming .DefaultContainerLabel : database .Name ,
264+ })
265+
257266 // Copy the pod template from the sts instance StatefulSet. This includes
258267 // the service account, volumes, DNS policies, and scheduling constraints.
259268 sts .Spec .Template .DeepCopyInto (& job .Spec .Template )
0 commit comments