@@ -210,9 +210,8 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
210210
211211 // Purge any migration wait initContainers since that would be a yodawg situation.
212212 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 {}) {
216215 container := c .(map [string ]interface {})
217216 if ! strings .HasPrefix (container ["name" ].(string ), "migrate-wait-" ) {
218217 initContainers = append (initContainers , container )
@@ -250,7 +249,7 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
250249 migrationJob .SetLabels (obj .Labels )
251250 migrationJob .UnstructuredContent ()["spec" ] = map [string ]interface {}{
252251 "template" : map [string ]interface {}{
253- "meta " : map [string ]interface {}{
252+ "metadata " : map [string ]interface {}{
254253 "labels" : jobTemplateLabels ,
255254 "annotations" : jobTemplateAnnotations ,
256255 },
@@ -346,7 +345,7 @@ func (_ *migrationsComponent) findOwners(ctx *cu.Context, obj *unstructured.Unst
346345 break
347346 }
348347 gvk := schema .FromAPIVersionAndKind (ref .APIVersion , ref .Kind )
349- obj : = & unstructured.Unstructured {}
348+ obj = & unstructured.Unstructured {}
350349 obj .SetGroupVersionKind (gvk )
351350 obj .SetName (ref .Name ) // Is this needed?
352351 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
376375 return template ["spec" ].(map [string ]interface {})
377376 case "argoproj.io/Rollout" :
378377 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 {})
381380 workloadKind := workloadRef ["kind" ].(string )
382381 if workloadKind == "Deployment" {
383382 deployment := & unstructured.Unstructured {}
384383 deployment .SetAPIVersion (workloadRef ["apiVersion" ].(string ))
385384 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 )
387386 if err != nil {
388387 return nil
389388 }
0 commit comments