The image name in initContainers should automatically resolve to a image stream name.
@mfojtik is already working on this.
Since Nov 30, 2017.
- Dominant language
- Go
- Stars
- 8.7k
- Forks
- 4.8k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 53
Description
When using dc.spec.template.spec.initContainers and you set the image field to an image stream name, it isn't automatically resolved to an image stream name in the project as occurs for dc.spec.template.spec.containers. Being in a DeploymentConfig, I would expect it to, just like with normal containers in the pod. Instead it is necessary to set the lookupPolicy on the image stream to be local, or add the resolve-names annotation to the pod template.
Version
oc v3.6.1+008f2d5
kubernetes v1.6.1+5115d708d7
features: Basic-Auth
Server https://127.0.0.1:8443
openshift v3.6.1+008f2d5
kubernetes v1.6.1+5115d708d7
Steps To Reproduce
Use a oc patch --type=json patch such as:
[
{
"op": "add",
"path": "/spec/template/spec/initContainers",
"value": [
{
"name": "blog-htdocs-init",
"image": "blog",
"volumeMounts": [
{
"mountPath": "/mnt",
"name": "htdocs"
}
],
"command": [
"rsync",
"--archive",
"--no-perms",
"--no-times",
"/opt/app-root/src/htdocs/",
"/mnt/"
]
}
]
}
]
and the deployment will get stuck when trying to start the init container as it can't work out what image is.
Instead use:
[
{
"op": "add",
"path": "/spec/template/metadata/annotations/alpha.image.policy.openshift.io~1resolve-names",
"value": "*"
},
{
"op": "add",
"path": "/spec/template/spec/initContainers",
"value": [
{
"name": "blog-htdocs-init",
"image": "blog",
"volumeMounts": [
{
"mountPath": "/mnt",
"name": "htdocs"
}
],
"command": [
"rsync",
"--archive",
"--no-perms",
"--no-times",
"/opt/app-root/src/htdocs/",
"/mnt/"
]
}
]
}
]
or run:
oc set image-lookup dc/blog
which adds the annotation on the pod template, then works okay.
Current Result
Doesn't resolve image name to image stream in init containers.
Expected Result
Since part of DeploymentConfig, expect it to resolve to image stream name like it does for containers in same pod.
Additional Information
None.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.