Skip to content

Deployment config change trigger cause found where image change cause expected #7464

Closed

Description

@ironcladlou

#5881 (comment) seems to demonstrate a case where a deployment config change trigger cause is recorded when an image trigger cause is expected. A quick code audit didn't reveal any obvious races between the image and change trigger controllers, but I wouldn't rule it out yet.

Activity

  1. 0xmichalis commented on Feb 19, 2016

    @0xmichalis
    Contributor

    Probably the offending DC

    {\\\"kind\\\":\\\"DeploymentConfig\\\",\\\"apiVersion\\\":\\\"v1\\\",\\\"metadata\\\":{\\\"name\\\":\\\"frontend
    \\\",\\\"namespace\\\":\\\"test\\\",\\\"selfLink\\\":\\\"/oapi/v1/namespaces/test/deploymentconfigs/frontend
    \\\",\\\"uid\\\":\\\"bbc57880-d6ce-11e5-8ebb-0e8e644e3c9d\\\",\\\"resourceVersion\\\":\\\"901
    \\\",\\\"creationTimestamp\\\":\\\"2016-02-19T06:05:10Z\\\",\\\"labels\\\":{\\\"template\\\":\\\"application-template-
    stibuild\\\"}},\\\"spec\\\":{\\\"strategy\\\":{\\\"type\\\":\\\"Rolling\\\",\\\"rollingParams\\\":{\\\"updatePeriodSeconds
    \\\":1,\\\"intervalSeconds\\\":1,\\\"timeoutSeconds\\\":120,\\\"maxUnavailable\\\":\\\"25%\\\",\\\"maxSurge
    \\\":\\\"25%\\\",\\\"pre\\\":{\\\"failurePolicy\\\":\\\"Abort\\\",\\\"execNewPod\\\":{\\\"command\\\":[\\\"/bin/true\\\"],
    \\\"env\\\":[{\\\"name\\\":\\\"CUSTOM_VAR1\\\",\\\"value\\\":\\\"custom_value1\\\"}],\\\"containerName
    \\\":\\\"ruby-helloworld\\\"}},\\\"post\\\":{\\\"failurePolicy\\\":\\\"Ignore\\\",\\\"execNewPod\\\":{\\\"command\\\":[\\\"
    /bin/false\\\"],\\\"env\\\":[{\\\"name\\\":\\\"CUSTOM_VAR2\\\",\\\"value\\\":\\\"custom_value2\\\"}],
    \\\"containerName\\\":\\\"ruby-helloworld\\\"}}},\\\"resources\\\":{}},\\\"triggers\\\":[{\\\"type\\\":\\\"ImageChange
    \\\",\\\"imageChangeParams\\\":{\\\"automatic\\\":true,\\\"containerNames\\\":[\\\"ruby-helloworld\\\"],\\\"from
    \\\":{\\\"kind\\\":\\\"ImageStreamTag\\\",\\\"name\\\":\\\"origin-ruby-sample:latest\\\"},\\\"lastTriggeredImage
    \\\":\\\"172.30.246.133:5000/test/origin-ruby-sample@sha256:87106bee69dc4318ac1969973eced6dd2402faac866e73af180d2e86408fbddf\\\"}},
    {\\\"type\\\":\\\"ConfigChange\\\"}],\\\"replicas\\\":2,\\\"test\\\":false,\\\"selector\\\":{\\\"name\\\":\\\"frontend\\\"},
    \\\"template\\\":{\\\"metadata\\\":{\\\"creationTimestamp\\\":null,\\\"labels\\\":{\\\"name\\\":\\\"frontend\\\"}},
    \\\"spec\\\":{\\\"containers\\\":[{\\\"name\\\":\\\"ruby-helloworld\\\",\\\"image\\\":\\\"172.30.246.133:5000/test
    /origin-ruby-sample@sha256:87106bee69dc4318ac1969973eced6dd2402faac866e73af180d2e86408fbddf
    \\\",\\\"ports\\\":[{\\\"containerPort\\\":8080,\\\"protocol\\\":\\\"TCP\\\"}],\\\"env\\\":[{\\\"name
    \\\":\\\"ADMIN_USERNAME\\\",\\\"value\\\":\\\"admin4SN\\\"},{\\\"name\\\":\\\"ADMIN_PASSWORD
    \\\",\\\"value\\\":\\\"r2rtTdLX\\\"},{\\\"name\\\":\\\"MYSQL_USER\\\",\\\"value\\\":\\\"userE55\\\"},{\\\"name
    \\\":\\\"MYSQL_PASSWORD\\\",\\\"value\\\":\\\"OujxtGKP\\\"},{\\\"name\\\":\\\"MYSQL_DATABASE
    \\\",\\\"value\\\":\\\"root\\\"}],\\\"resources\\\":{},\\\"terminationMessagePath\\\":\\\"/dev/termination-log\\\",
    \\\"imagePullPolicy\\\":\\\"IfNotPresent\\\",\\\"securityContext\\\":{\\\"capabilities\\\":{},\\\"privileged\\\":false}}],
    \\\"restartPolicy\\\":\\\"Always\\\",\\\"terminationGracePeriodSeconds\\\":30,\\\"dnsPolicy\\\":\\\"ClusterFirst
    \\\",\\\"securityContext\\\":{}}}},\\\"status\\\":{\\\"latestVersion\\\":1,\\\"details\\\":{\\\"causes\\\":[{\\\"type
    \\\":\\\"ConfigChange\\\"}]}}}
    
  2. 0xmichalis commented on Feb 19, 2016

    @0xmichalis
    Contributor

    The image is resolved (meaning the ICT fired), latestVersion is 1, and the end status cause is a config change - most probably a race.

  3. ironcladlou commented on Feb 19, 2016

    @ironcladlou
    ContributorAuthor

    I went down the same path, but the problem I found is that the config change controller aborts early if the deployment for the current version doesn't yet exist. And if the current RC already exists, the config encoded in the RC should have the same spec as the current DC (from the image controller update) and so no bump/cause re-assignment should occur. If there somehow WAS a spec change between image processing and the config trigger handling, there should be a new version bump to 2 in addition to the reassignment of the cause to config change. The version here is still 1.

    There's probably some hole I overlooked, it does smell like a race.

  4. 0xmichalis commented on Feb 19, 2016

    @0xmichalis
    Contributor

    the config change controller aborts early if the deployment for the current version doesn't yet exist

    It tries to generate a deployment for zero latestVersion.

  5. ironcladlou commented on Feb 19, 2016

    @ironcladlou
    ContributorAuthor

    the config change controller aborts early if the deployment for the current version doesn't yet exist

    It tries to generate a deployment for zero latestVersion.

    If the image controller persisted its cause first, the DC would be at version 1 and the change controller wouldn't enter that block. If the change controller is racing and gets version 0 and image controller still persists version=1 first, change controller gets an update conflict, and the image cause is preserved. If the change controller wins, version becomes 1 with a configChange cause, the shared generator code replaces the image references, but then replaces the cause, and image controller gets a conflict. On the single retry, the image controller feeds the updated DC back through the generator, and since the config change handling already processed the image triggers, version isn't increased, so nothing new happens.

    Sounds like that must be it. The config change trigger code shouldn't overwrite the cause: if the generator returns an image change cause, the config change trigger should probably just prefer what it got from the generator. Thoughts? (Other than the generator needs to be taken out to the dumpster)

  6. 0xmichalis commented on Feb 19, 2016

    @0xmichalis
    Contributor
    1. if the generator returns an image change cause, the config change trigger should probably just prefer what it got from the generator. Thoughts? (2. Other than the generator needs to be taken out to the dumpster)

    Both SGTM

  7. assigned and unassigned on Feb 22, 2016
  8. 0xmichalis commented on Feb 22, 2016

    @0xmichalis
    Contributor

    @ironcladlou suppose there is dc/frontend which uses both types of triggers.

    1. Image is pushed for the first time, frontend-1 is kicked by the ICT.
    2. I make a change in the template unrelated to the image. frontend-2 is kicked due to a config change. Won't the solution you proposed mask the config change cause with the imagechange cause falsely in this scenario?
  9. ironcladlou commented on Feb 22, 2016

    @ironcladlou
    ContributorAuthor

    @ironcladlou suppose there is dc/frontend which uses both types of triggers.

    1. Image is pushed for the first time, frontend-1 is kicked by the ICT.
    2. I make a change in the template unrelated to the image. frontend-2 is kicked due to a config change. Won't the solution you proposed mask the config change cause with the imagechange cause falsely in this scenario?

    To make sure I understand, frontend-1 is totally finished, and frontend-2 is then kicked off? Or is frontend-2 kicked off to replace the in-progress frontend-1?

  10. 0xmichalis commented on Feb 22, 2016

    @0xmichalis
    Contributor

    I was talking about the first case. Status details are persisted between deployments. So after the first deployment finishes, dc.status.details contains the imagechange cause. During the next deployment (via a config change), the configchange controller will see that there is an imagechange cause and let it pass, right?

  11. ironcladlou commented on Feb 22, 2016

    @ironcladlou
    ContributorAuthor

    I was talking about the first case. Status details are persisted between deployments. So after the first deployment finishes, dc.status.details contains the imagechange cause. During the next deployment (via a config change), the configchange controller will see that there is an imagechange cause and let it pass, right?

    The generator shouldn't return any cause unless it detects a change of some kind. The caller of the generator shouldn't update the DC unless there's a new version.

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