@@ -210,9 +210,8 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
210
210
211
211
// Purge any migration wait initContainers since that would be a yodawg situation.
212
212
initContainers := []map [string ]interface {}{}
213
- migrationInitContainers := migrationPodSpec ["initContainers" ].([]interface {})
214
- if migrationInitContainers != nil {
215
- for _ , c := range migrationInitContainers {
213
+ if migrationPodSpec ["initContainers" ] != nil {
214
+ for _ , c := range migrationPodSpec ["initContainers" ].([]interface {}) {
216
215
container := c .(map [string ]interface {})
217
216
if ! strings .HasPrefix (container ["name" ].(string ), "migrate-wait-" ) {
218
217
initContainers = append (initContainers , container )
@@ -250,7 +249,7 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
250
249
migrationJob .SetLabels (obj .Labels )
251
250
migrationJob .UnstructuredContent ()["spec" ] = map [string ]interface {}{
252
251
"template" : map [string ]interface {}{
253
- "meta " : map [string ]interface {}{
252
+ "metadata " : map [string ]interface {}{
254
253
"labels" : jobTemplateLabels ,
255
254
"annotations" : jobTemplateAnnotations ,
256
255
},
@@ -346,7 +345,7 @@ func (_ *migrationsComponent) findOwners(ctx *cu.Context, obj *unstructured.Unst
346
345
break
347
346
}
348
347
gvk := schema .FromAPIVersionAndKind (ref .APIVersion , ref .Kind )
349
- obj : = & unstructured.Unstructured {}
348
+ obj = & unstructured.Unstructured {}
350
349
obj .SetGroupVersionKind (gvk )
351
350
obj .SetName (ref .Name ) // Is this needed?
352
351
err := ctx .Client .Get (ctx , types.NamespacedName {Name : ref .Name , Namespace : namespace }, obj )
@@ -376,14 +375,14 @@ func (_ *migrationsComponent) findSpecFor(ctx *cu.Context, obj *unstructured.Uns
376
375
return template ["spec" ].(map [string ]interface {})
377
376
case "argoproj.io/Rollout" :
378
377
spec := obj .UnstructuredContent ()["spec" ].(map [string ]interface {})
379
- workloadRef := spec ["workloadRef" ].( map [ string ] interface {})
380
- if workloadRef != nil {
378
+ if spec ["workloadRef" ] != nil {
379
+ workloadRef := spec [ "workloadRef" ].( map [ string ] interface {})
381
380
workloadKind := workloadRef ["kind" ].(string )
382
381
if workloadKind == "Deployment" {
383
382
deployment := & unstructured.Unstructured {}
384
383
deployment .SetAPIVersion (workloadRef ["apiVersion" ].(string ))
385
384
deployment .SetKind (workloadKind )
386
- err := ctx .Client .Get (ctx , types.NamespacedName {Name : workloadRef ["name" ].(string ), Namespace : obj .GetNamespace ()}, obj )
385
+ err := ctx .Client .Get (ctx , types.NamespacedName {Name : workloadRef ["name" ].(string ), Namespace : obj .GetNamespace ()}, deployment )
387
386
if err != nil {
388
387
return nil
389
388
}
0 commit comments