Skip to content

Commit 9c4cfb9

Browse files
committed
🎨 Try to fix casting issues.
1 parent fabb1f7 commit 9c4cfb9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎components/migrations.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,19 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
158158
}
159159

160160
// Find the template container.
161-
templatePodSpecContainers := templatePodSpec["containers"].([]map[string]interface{})
161+
templatePodSpecContainers := templatePodSpec["containers"].([]interface{})
162162
var templateContainer map[string]interface{}
163163
if obj.Spec.Container != "" {
164164
// Looking for a specific container name.
165165
for _, c := range templatePodSpecContainers {
166-
if c["name"].(string) == obj.Spec.Container {
167-
templateContainer = c
166+
container := c.(map[string]interface{})
167+
if container["name"].(string) == obj.Spec.Container {
168+
templateContainer = container
168169
break
169170
}
170171
}
171172
} else if len(templatePodSpecContainers) > 0 {
172-
templateContainer = templatePodSpecContainers[0]
173+
templateContainer = templatePodSpecContainers[0].(map[string]interface{})
173174
}
174175
if templateContainer == nil {
175176
// Welp, either nothing matched the name or somehow there are no containers.
@@ -209,9 +210,10 @@ func (comp *migrationsComponent) Reconcile(ctx *cu.Context) (cu.Result, error) {
209210

210211
// Purge any migration wait initContainers since that would be a yodawg situation.
211212
initContainers := []map[string]interface{}{}
212-
for _, c := range migrationPodSpec["initContainers"].([]map[string]interface{}) {
213-
if !strings.HasPrefix(c["name"].(string), "migrate-wait-") {
214-
initContainers = append(initContainers, c)
213+
for _, c := range migrationPodSpec["initContainers"].([]interface{}) {
214+
container := c.(map[string]interface{})
215+
if !strings.HasPrefix(container["name"].(string), "migrate-wait-") {
216+
initContainers = append(initContainers, container)
215217
}
216218
}
217219
migrationPodSpec["initContainers"] = initContainers

0 commit comments

Comments
 (0)