Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb-replicaset stable helm chart fails to rewrite all images #631

Closed
emosbaugh opened this issue Jun 3, 2020 · 0 comments · Fixed by #888
Closed

mongodb-replicaset stable helm chart fails to rewrite all images #631

emosbaugh opened this issue Jun 3, 2020 · 0 comments · Fixed by #888
Labels
type::bug Something isn't working

Comments

@emosbaugh
Copy link
Member

emosbaugh commented Jun 3, 2020

mongodb-replicaset stable helm chart fails to rewrite all images

the chart contains a pod resource

https://github.com/helm/charts/blob/88a5176022e8dda60a498d2b8953a9feb3d13b0b/stable/mongodb-replicaset/templates/tests/mongodb-up-test-pod.yaml#L1-L2

Image rewriting does not work with pods

kots/pkg/image/builder.go

Lines 247 to 278 in 82a9f98

func listImagesInFile(contents []byte, handler processImagesFunc) error {
yamlDocs := bytes.Split(contents, []byte("\n---\n"))
for _, yamlDoc := range yamlDocs {
parsed := &k8sdoc.Doc{}
if err := yaml.Unmarshal(yamlDoc, parsed); err != nil {
continue
}
images := make([]string, 0)
for _, container := range parsed.Spec.Template.Spec.Containers {
images = append(images, container.Image)
}
for _, container := range parsed.Spec.Template.Spec.InitContainers {
images = append(images, container.Image)
}
for _, container := range parsed.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
images = append(images, container.Image)
}
for _, container := range parsed.Spec.JobTemplate.Spec.Template.Spec.Containers {
images = append(images, container.Image)
}
if err := handler(images, parsed); err != nil {
return err
}
}
return nil
}

kots/pkg/midstream/write.go

Lines 226 to 236 in 82a9f98

default:
newObj.Spec = k8sdoc.Spec{
Template: k8sdoc.Template{
Spec: k8sdoc.PodSpec{
ImagePullSecrets: []k8sdoc.ImagePullSecret{
{"name": "kotsadm-replicated-registry"},
},
},
},
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant