@@ -306,4 +306,62 @@ var _ = Describe("Migrations component", func() {
306
306
helper .TestClient .GetName ("testing-migrations" , job )
307
307
Expect (job .Spec .Template .Spec .Containers [0 ].Image ).To (Equal ("myapp:v1" ))
308
308
})
309
+
310
+ It ("follows owner references for an argoproj.io rollout with workloadref to deployment" , func () {
311
+ truep := true
312
+ rollout := & argoproj.Rollout {
313
+ ObjectMeta : metav1.ObjectMeta {Name : "testing" },
314
+ Spec : argoproj.RolloutSpec {
315
+ WorkloadRef : & argoproj.ObjectRef {
316
+ Name : "testing" ,
317
+ APIVersion : "apps/v1" ,
318
+ Kind : "Deployment" ,
319
+ },
320
+ },
321
+ }
322
+ helper .TestClient .Create (rollout )
323
+ deployment := & appsv1.Deployment {
324
+ ObjectMeta : metav1.ObjectMeta {Name : "testing" },
325
+ Spec : appsv1.DeploymentSpec {
326
+ Template : corev1.PodTemplateSpec {
327
+ Spec : corev1.PodSpec {
328
+ Containers : []corev1.Container {
329
+ {
330
+ Name : "main" ,
331
+ Image : "myapp:v1" ,
332
+ },
333
+ },
334
+ },
335
+ },
336
+ },
337
+ }
338
+ helper .TestClient .Create (deployment )
339
+ rs := & appsv1.ReplicaSet {
340
+ ObjectMeta : metav1.ObjectMeta {
341
+ Name : "testing-1234" ,
342
+ OwnerReferences : []metav1.OwnerReference {
343
+ {
344
+ APIVersion : "argoproj.io/v1alpha1" ,
345
+ Kind : "Rollout" ,
346
+ Name : "testing" ,
347
+ Controller : & truep ,
348
+ },
349
+ },
350
+ },
351
+ }
352
+ helper .TestClient .Create (rs )
353
+ pod .OwnerReferences = []metav1.OwnerReference {
354
+ {
355
+ APIVersion : "apps/v1" ,
356
+ Kind : "ReplicaSet" ,
357
+ Name : "testing-1234" ,
358
+ Controller : & truep ,
359
+ },
360
+ }
361
+ helper .TestClient .Create (pod )
362
+
363
+ helper .MustReconcile ()
364
+ helper .TestClient .GetName ("testing-migrations" , job )
365
+ Expect (job .Spec .Template .Spec .Containers [0 ].Image ).To (Equal ("myapp:v1" ))
366
+ })
309
367
})
0 commit comments