Fix: Webhook will take over Deployment even Rollout CR doesn't exist (#278)

(cherry picked from commit deaa5f38b5)
Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com>
This commit is contained in:
AiRanthem 2025-06-20 16:43:36 +08:00
parent 8b187f9c71
commit db8ecb0879
1 changed files with 7 additions and 5 deletions

View File

@ -373,12 +373,14 @@ func TestHandlerDeployment(t *testing.T) {
rs := rsDemo.DeepCopy()
return []*apps.ReplicaSet{rs}
},
getRollout: func() *appsv1beta1.Rollout {
getRollout: func() *appsv1alpha1.Rollout {
obj := rolloutDemo.DeepCopy()
obj.Spec.WorkloadRef = appsv1beta1.ObjectRef{
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "other",
obj.Spec.ObjectRef = appsv1alpha1.ObjectRef{
WorkloadRef: &appsv1alpha1.WorkloadRef{
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "other",
},
}
return obj
},