{"action":"opened","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22342","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22342/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22342/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/22342/events","html_url":"https://github.com/kubernetes/kubernetes/issues/22342","id":137807135,"number":22342,"title":"Deployment is not adhering fully to new PodTemplateSpec on an update, even if the proceeding Deployments PodTemplateSpec specifically removes a component","user":{"login":"metral","id":1112768,"avatar_url":"https://avatars.githubusercontent.com/u/1112768?v=3","gravatar_id":"","url":"https://api.github.com/users/metral","html_url":"https://github.com/metral","followers_url":"https://api.github.com/users/metral/followers","following_url":"https://api.github.com/users/metral/following{/other_user}","gists_url":"https://api.github.com/users/metral/gists{/gist_id}","starred_url":"https://api.github.com/users/metral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metral/subscriptions","organizations_url":"https://api.github.com/users/metral/orgs","repos_url":"https://api.github.com/users/metral/repos","events_url":"https://api.github.com/users/metral/events{/privacy}","received_events_url":"https://api.github.com/users/metral/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-02T08:31:20Z","updated_at":"2016-03-02T08:31:20Z","closed_at":null,"body":"I'm running into an oddity where, as the title says, an update to a Deployment is not fully applying the new PodTemplateSpec onto the previous version, as components of the previous version remain around after the update.\r\n\r\nI'm running v1.2.0-alpha8 on CoreOS 835.9.0 \r\n\r\nHere's an example of creating a Deployment (v1), and applying an update (v2) which simply removes certain parts of the original spec (the `args` key in this case), to showcase that the new spec isn't fully being applied, even though the Deployment's `last-applied-configuration` says it should have.\r\n\r\n`git-deployment-v1.yaml:`\r\n``` \r\napiVersion: extensions/v1beta1\r\n kind: Deployment\r\n metadata:\r\n   name: git-deployment\r\n   labels:\r\n     name: git-deployment\r\n spec:\r\n   replicas: 1\r\n   template:\r\n     metadata:\r\n       labels:\r\n         name: git-deployment\r\n     spec:\r\n       containers:\r\n         - name: git-sync\r\n           image: gcr.io/google_containers/git-sync\r\n           imagePullPolicy: Always\r\n           args:\r\n             - -rev=origin/gh-pages\r\n           volumeMounts:\r\n             - name: markdown\r\n               mountPath: /git\r\n               readOnly: false\r\n           env:\r\n             - name: GIT_SYNC_REPO\r\n               value: https://github.com/kubernetes/kubernetes\r\n             - name: GIT_SYNC_DEST\r\n               value: /git\r\n             - name: GIT_SYNC_WAIT\r\n               value: \"120\"\r\n       volumes:\r\n         - name: markdown\r\n           emptyDir: {}\r\n```\r\n\r\nWe create the Deployment:\r\n```\r\nkubectl create -f git-deployment-v1.yaml\r\n```\r\n\r\nWhen the Pod is running, it should not have any annotations regarding the Deployment as it was the initial deployment, and there are no history of updates. We can verify that it is not set by seeing that this cmd returns: `<no value>`\r\n\r\n```\r\nkubectl get deployment git-deployment -o go-template='{{index .metadata.annotations \"kubectl.kubernetes.io/last-applied-configuration\"}}'\r\n```\r\n\r\n...and we can check that the `args` key was set, in this case, to pass an arg of `-rev=origin/gh-pages` to the container's entry cmd, by checking:\r\n\r\n```\r\nkubectl get po git-deployment-<ID> -o yaml | grep -A 1 \"args\"\r\n```\r\nit returns:\r\n\r\n```\r\n - args:\r\n  - -rev=origin/gh-pages\r\n```\r\n...which is what we expect as we set it as such in the v1 Deployment\r\n\r\n------------------------------\r\n\r\nAfter making a change in the PodTemplateSpec, specifically, removing the `args` key all-together (this is the only change made in the spec), we have a v2 Deployment to apply as an update to v1:\r\n\r\n`git-deployment-v2.yaml:`\r\n```\r\n apiVersion: extensions/v1beta1\r\n kind: Deployment\r\n metadata:\r\n   name: git-deployment\r\n   labels:\r\n     name: git-deployment\r\n spec:\r\n   replicas: 1\r\n   template:\r\n     metadata:\r\n       labels:\r\n         name: git-deployment\r\n     spec:\r\n       containers:\r\n         - name: git-sync\r\n           image: gcr.io/google_containers/git-sync\r\n           imagePullPolicy: Always\r\n           volumeMounts:\r\n             - name: markdown\r\n               mountPath: /git\r\n               readOnly: false\r\n           env:\r\n             - name: GIT_SYNC_REPO\r\n               value: https://github.com/kubernetes/kubernetes\r\n             - name: GIT_SYNC_DEST\r\n               value: /git\r\n             - name: GIT_SYNC_WAIT\r\n               value: \"60\"\r\n       volumes:\r\n         - name: markdown\r\n           emptyDir: {}\r\n```\r\n\r\nWe apply the update:\r\n\r\n```\r\nkubectl apply -f git-deployment-v2.yaml\r\n```\r\n\r\n...and we can verify that the new PodSpecTemplate for the v2 Deployment is what we wanted it to be by examining the output of the `last-applied-configuration` key for the newly updated Pod:\r\n\r\n```\r\nkubectl get deployment git-deployment -o go-template='{{index .metadata.annotations \"kubectl.kubernetes.io/last-applied-configuration\"}}' | python -m json.tool\r\n```\r\n\r\n(this output and the `git-deployment-v2.yaml` manifest should match)\r\n\r\n-----------------------\r\n\r\nHowever, if you examine the new Pod's `args` again using\r\n\r\n```\r\nkubectl get po git-deployment-w87dp-6a98q -o yaml | grep -A 1 \"args\"\r\n```\r\n\r\n...it still returns:\r\n\r\n```\r\n - args:\r\n  - -rev=origin/gh-pages\r\n```\r\n\r\n...which should not be the case :-1: \r\n\r\nSo in my case, its still passing a flag via the `args` key, which in v2 I determined I did not want by removing it, and the existing flag is messing with the updated Pod's execution.\r\n\r\nAny ideas what could be taking place? Thanks!"}}