Migrate to NewControllerRef from meta/v1 package

This commit is contained in:
Mikhail Mazurskiy
2017-08-02 20:05:37 +10:00
parent b28a83a4cf
commit 042b5642b9
11 changed files with 14 additions and 97 deletions

View File

@@ -306,7 +306,7 @@ func (dc *DeploymentController) getNewReplicaSet(d *extensions.Deployment, rsLis
// Make the name deterministic, to ensure idempotence
Name: d.Name + "-" + podTemplateSpecHash,
Namespace: d.Namespace,
OwnerReferences: []metav1.OwnerReference{*newControllerRef(d)},
OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(d, controllerKind)},
},
Spec: extensions.ReplicaSetSpec{
Replicas: new(int32),
@@ -651,17 +651,3 @@ func (dc *DeploymentController) isScalingEvent(d *extensions.Deployment, rsList
}
return false, nil
}
// newControllerRef returns a ControllerRef pointing to the deployment.
func newControllerRef(d *extensions.Deployment) *metav1.OwnerReference {
blockOwnerDeletion := true
isController := true
return &metav1.OwnerReference{
APIVersion: controllerKind.GroupVersion().String(),
Kind: controllerKind.Kind,
Name: d.Name,
UID: d.UID,
BlockOwnerDeletion: &blockOwnerDeletion,
Controller: &isController,
}
}