Skip to content

Commit 3ac9b17

Browse files
committed
deploy: add owner reference to rc from the deployer
1 parent f0670df commit 3ac9b17

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/deploy/controller/deployment/controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,17 @@ func (c *DeploymentController) makeDeployerPod(deployment *kapi.ReplicationContr
324324
Labels: map[string]string{
325325
deployapi.DeployerPodForDeploymentLabel: deployment.Name,
326326
},
327+
// Set the owner reference to current deployment, so in case the deployment fails
328+
// and the deployer pod is preserved when a revisionHistory limit is reached and the
329+
// deployment is removed, we also remove the deployer pod with it.
330+
OwnerReferences: []kapi.OwnerReference{{
331+
// FIXME: This will have to point to apps.openshift.io/v1 after we switch to
332+
// clientsets.
333+
APIVersion: "v1",
334+
Kind: deployapi.Kind("DeploymentConfig").Kind,
335+
Name: deployment.Name,
336+
UID: deployment.UID,
337+
}},
327338
},
328339
Spec: kapi.PodSpec{
329340
Containers: []kapi.Container{

0 commit comments

Comments
 (0)