Skip to content

Failed to resolve ImageStreamTag in deployment #6934

Closed

Description

@mfojtik

Reproduce on latest master:

$ oc new-project stage
$ oc create -f https://raw.githubusercontent.com/arilivigni/openshift-ci-pipeline/master/sample-app/sample-app-template.json
$ oc start-build sample-app --wait --follow
$ oc deploy sample-app --latest

What I see, is this error in the Pod event log:

Failed to pull image "sample-app:latest": Error: image library/sample-app:latest not found

Additionally:

$ oc describe istag/sample-app:latest
Name:       sha256:79bd15f334544d39d726c1b5e178085bb48425a9a7d4dfbf2dc4d376cb192e24
Created:    12 minutes ago
Docker Image:   172.30.167.193:5000/stage/sample-app@sha256:79bd15f334544d39d726c1b5e178085bb48425a9a7d4dfbf2dc4d376cb192e24
...

$ oc describe dc/sample-app
Name:       sample-app
Created:    15 minutes ago
Labels:     app=sample-app
Annotations:    openshift.io/generated-by=OpenShiftNewApp
Latest Version: 2
Triggers:   Config, Image(sample-app@latest, auto=false)
Strategy:   Rolling
Template:
  Selector: app=sample-app,deploymentconfig=sample-app
  Replicas: 1
  Containers:
  NAME      IMAGE           ENV
  sample-app    sample-app:latest

Activity

  1. added
    kind/bug
    on Feb 1, 2016
  2. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor

    OK, this is strange but when I deleted that project and created it from scratch, it actually deployed automatically after build even that auto=false...

    EDIT: After I removed the project again and re-created it from the original steps, I get the IST not resolved again...

  3. changed the title [-]Deployment is trying to get library/sample-app:latest[/-] [+]Failed to resolve ImageStreamTag in deployment[/+] on Feb 1, 2016
  4. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor

    So when I set automatic:false it will not resolve the imagestreamtag... That seems to be the problem here.

  5. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor

    So further investigation reveals that we never update the DeploymentConfig when the "automatic:false", which means the Image in ContainerSpec is never resolved into DockerPullSpec based on the ImageStreamTag.

    The code is here: https://github.com/openshift/origin/blob/master/pkg/deploy/controller/imagechange/controller.go#L44

  6. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor
  7. 0xmichalis commented on Feb 1, 2016

    @0xmichalis
    Contributor

    First bug in here is in oc status. Before I manually trigger the deployment:

    $ oc status
    In project stage on server https://localhost:8443
    
    svc/sample-app - 172.30.154.201:8080
      dc/sample-app deploys istag/sample-app:latest <-
        bc/sample-app builds https://github.com/mfojtik/sample-app.git with openshift/ruby:latest 
          #1 build succeeded 45 seconds ago - 85d983b: Cleanup (Michal Fojtik <[email protected]>)
        #1 deployment waiting on image or update
    
    View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.
    

    It should warn me that the image is available and I just need to manually trigger since dc.spec.triggers[1].automatic == false.

  8. 0xmichalis commented on Feb 1, 2016

    @0xmichalis
    Contributor

    So when I set automatic:false it will not resolve the imagestreamtag... That seems to be the problem here.

    I see the istag resolved from sample-app:latest to the full spec in the registry

    $ oc describe istag sample-app:latest
    Name:       sha256:21cce35a1e1974b0d3fe78d347b1b8e0f6e295f62b8fc9a28f047df31c21d123
    Created:    29 minutes ago
    Labels:     <none>
    Annotations:    openshift.io/image.managed=true
    Docker Image:   172.30.59.130:5000/stage/sample-app@sha256:21cce35a1e1974b0d3fe78d347b1b8e0f6e295f62b8fc9a28f047df31c21d123
    
    $ oc describe dc/sample-app
    Name:       sample-app
    Created:    30 minutes ago
    Labels:     app=sample-app
    Annotations:    openshift.io/generated-by=OpenShiftNewApp
    Latest Version: 2
    Triggers:   Config, Image(sample-app@latest, auto=false)
    Strategy:   Rolling
    Template:
      Selector: app=sample-app,deploymentconfig=sample-app
      Replicas: 1
      Containers:
      NAME      IMAGE                                                       ENV
      sample-app    172.30.59.130:5000/stage/sample-app@sha256:21cce35a1e1974b0d3fe78d347b1b8e0f6e295f62b8fc9a28f047df31c21d123 
    
  9. 0xmichalis commented on Feb 1, 2016

    @0xmichalis
    Contributor

    @mfojtik you also have the following streams, right?

    $ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/image-streams/image-streams-centos7.json -n openshift
    
  10. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor
  11. soltysh commented on Feb 1, 2016

    @soltysh
    Contributor

    So when I set automatic:false it will not resolve the imagestreamtag... That seems to be the problem here.

    That's exactly the root cause of your problem. Only ImageChange trigger is capable of resolving IST correctly, since in your example it's turned off the Deployment will be created from the exact PodTemplate you specified, in your case: image: sample-app:latest which won't work, obviously. This is not a bug.

  12. mfojtik commented on Feb 1, 2016

    @mfojtik
    ContributorAuthor

    @soltysh it depends on how you define "bug" here. If automatic=false disable IST resolving then we should at least tweak its API description:

    Automatic means that the detection of a new tag value should result in a new deployment.
    

    What I expected here is that the IST gets resolved, because I have ICT defined and I want it to become the Container->Image. What I don't want is the new tag result into a new deployment, which is what that description is saying. So I can do manual deploy when I decide to do it.

    cc @bparees @smarterclayton

  13. 21 remaining items

  14. smarterclayton commented on Feb 17, 2016

    @smarterclayton
    Contributor

    I don't see what the mappings get us over having a flag on the trigger that
    says whether clients should refresh it when triggering a manual
    deployment. Manual deployments are manual.

    On Wed, Feb 17, 2016 at 3:19 PM, Ben Parees [email protected]
    wrote:

    so in my head i'm thinking a few flows:

    a) ICT fires, matching mapping gets updated/resolved. If DC is automatic,
    deployment happens.
    b) Deployment is manually requested. Mappings marked "automatic" get
    updated. deployment happens.
    c) Deployment is automatically caused (by what?). Mappings marked
    "automatic" get resolved/udpated. deployment happens.

    In all cases the actual deployment uses the value defined in the mapping
    at that point.

    I guess my only concern is with (a). In the case of Builds we ultimately
    separated the ICT from the Build. That is, any imagechange could
    trigger a build, it's just an event. ("image foo changed. build bar!"). I
    think maybe DC should be similar. the ICT trigger starts the deployment.
    The content of that deployment would then depend on the Mapping and whether
    the mapping was set to Automatic(re-resolve) or Manual(do not re-resolve).

    The other question i'd have is what you do with an ImageStreamTag
    reference in a Mapping when Automatic is false? You have to resolve it at
    least once to get a pull spec....

    —
    Reply to this email directly or view it on GitHub
    #6934 (comment).

  15. bparees commented on Feb 17, 2016

    @bparees
    Contributor

    I could live with either, but abusing imagechangetriggers to say "this triggers deploys...oh and also we'll use the information in here to resolve which image to use when you do a manual deployment, if you set this other flag" feels like a hack.

    imagechangetriggers should trigger things, overloading them to configure other behavior seems wrong.

  16. bparees commented on Feb 17, 2016

    @bparees
    Contributor

    and what if i always want to resolve an ImageStreamTag but i don't want to have an ICT at all? I define an ICT, then set deployment to manual, then set this other new flag to say "ResolveViaICT on deploy"?

    do i still get configchangetriggers if i set deployment mode to manual?

  17. smarterclayton commented on Feb 17, 2016

    @smarterclayton
    Contributor

    Triggers are just probably poorly named. Triggers are "Dependencies" that
    are leveraged by the controller to assist users in making decisions. There
    is "automatic" (always trigger), "refresh" (if something else changes and
    doesn't specify, refresh this value via a client), and "manual" (i don't
    need your help).

    On Wed, Feb 17, 2016 at 3:38 PM, Ben Parees [email protected]
    wrote:

    and what if i always want to resolve an ImageStreamTag but i don't want to
    have an ICT at all? I define an ICT, then set deployment to manual, then
    set this other new flag to say "ResolveViaICT on deploy"?

    do i still get configchangetriggers if i set deployment mode to manual?

    —
    Reply to this email directly or view it on GitHub
    #6934 (comment).

  18. bparees commented on Feb 17, 2016

    @bparees
    Contributor

    @smarterclayton ok, i'll buy that.

  19. 0xmichalis commented on Feb 18, 2016

    @0xmichalis
    Contributor

    @ironcladlou do we really need new API for this? How about having the imagechange controller update the reference but not bump the version for triggering the new deployment? False for automatic is a variation of Paused. If a deployment is paused it won't trigger by updating its container.

  20. ironcladlou commented on Feb 18, 2016

    @ironcladlou
    Contributor

    @ironcladlou do we really need new API for this? How about having the imagechange controller update the reference but not bump the version for triggering the new deployment? False for automatic is a variation of Paused. If a deployment is paused it won't trigger by updating its container.

    How are references in the deploymentConfig pod spec updated during a manual deployment?

  21. smarterclayton commented on Feb 18, 2016

    @smarterclayton
    Contributor

    So these three cases need to work:

    1. A user can tag an image stream tag and the deployment is updated with
      the latest values of any automatic tags (handled by deployment controller)
    2. A user on the command line can manually update to a particular latest
      manual image and leave the others alone (handled by client code today, but
      this is arguably an /instantiate endpoint)
    3. A user on the command line can easily update to the latest images for
      each container and then post that to the deployment config (no one does
      this, but this is arguably an /instantiate endpoint)

    I would expect oc rollout --image to handle both 2 and 3 cleanly.

    On Thu, Feb 18, 2016 at 1:08 PM, Dan Mace [email protected] wrote:

    @ironcladlou https://github.com/ironcladlou do we really need new API
    for this? How about having the imagechange controller update the reference
    but not bump the version for triggering the new deployment? False for
    automatic is a variation of Paused. If a deployment is paused it won't
    trigger by updating its container.

    How are references in the deploymentConfig pod spec updated during a
    manual deployment?

    —
    Reply to this email directly or view it on GitHub
    #6934 (comment).

  22. 0xmichalis commented on Feb 18, 2016

    @0xmichalis
    Contributor

    How are references in the deploymentConfig pod spec updated during a manual deployment?

    Same as automatic DCs are updated now, the only difference will be that lateVersion stays the same (so no new deployment runs).

  23. 0xmichalis commented on Feb 18, 2016

    @0xmichalis
    Contributor

    @ironcladlou got this working locally, will submit a poc PR shortly.

  24. assigned and unassigned on Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions