{"action":"opened","issue":{"url":"https://api.github.com/repos/zalando-incubator/stackset-controller/issues/49","repository_url":"https://api.github.com/repos/zalando-incubator/stackset-controller","labels_url":"https://api.github.com/repos/zalando-incubator/stackset-controller/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/zalando-incubator/stackset-controller/issues/49/comments","events_url":"https://api.github.com/repos/zalando-incubator/stackset-controller/issues/49/events","html_url":"https://github.com/zalando-incubator/stackset-controller/issues/49","id":357366602,"node_id":"MDU6SXNzdWUzNTczNjY2MDI=","number":49,"title":"Use resource generations to determine if resources are up-to-date","user":{"login":"mikkeloscar","id":128566,"node_id":"MDQ6VXNlcjEyODU2Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/128566?v=4","gravatar_id":"","url":"https://api.github.com/users/mikkeloscar","html_url":"https://github.com/mikkeloscar","followers_url":"https://api.github.com/users/mikkeloscar/followers","following_url":"https://api.github.com/users/mikkeloscar/following{/other_user}","gists_url":"https://api.github.com/users/mikkeloscar/gists{/gist_id}","starred_url":"https://api.github.com/users/mikkeloscar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikkeloscar/subscriptions","organizations_url":"https://api.github.com/users/mikkeloscar/orgs","repos_url":"https://api.github.com/users/mikkeloscar/repos","events_url":"https://api.github.com/users/mikkeloscar/events{/privacy}","received_events_url":"https://api.github.com/users/mikkeloscar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-05T19:15:40Z","updated_at":"2018-09-05T19:15:40Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"> mikkeloscar [22 minutes ago]\r\n> Hey, can I ask you a somewhat related question? Do you know of any functions for injecting default PodTemplateSpec values? I.e. the defaults you get when you submit a pod spec where not everything is defined. Currently I do it like this: https://github.com/zalando-incubator/stackset-controller/blob/2097b1de80710873cdf558bf734dee6e5da848bc/controller/stack.go#L482-L567 but maybe there's a better way?\r\n> \r\n> liggitt [22 minutes ago]\r\n> for what purpose?\r\n> \r\n> liggitt [22 minutes ago]\r\n> the defaulting is part of the apiserver and isn't available to external clients\r\n> \r\n> mikkeloscar [21 minutes ago]\r\n> What I'm trying to achieve is a way to determine if a need to update a resource or not. I have a CRD which \"wraps\" a deployment and I want to check if the deployment is matching the pod spec defined in the CRD.\r\n> \r\n> liggitt [14 minutes ago]\r\n> Attempting to match exactly with client side defaulting isn't a reliable way to do that\r\n> \r\n> liggitt [14 minutes ago]\r\n> You will drift as new fields are added server side\r\n> \r\n> liggitt [14 minutes ago]\r\n> and not be able to account for changes made by admission plugins, etc\r\n> \r\n> liggitt [13 minutes ago]\r\n> a more reliable way is to use metadata.generation\r\n> \r\n> liggitt [12 minutes ago]\r\n> when your custom resource spec changes, it bumps metadata.generation (if you've enabled spec/status for your CRD) (edited)\r\n> \r\n> liggitt [11 minutes ago]\r\n> your controller can note the observed generation it has reacted to in your custom resource status.observedGeneration\r\n> \r\n> liggitt [10 minutes ago]\r\n> and record the generation of the resulting deployment it creates in your custom resource as status.deploymentGeneration\r\n> \r\n> liggitt [9 minutes ago]\r\n> then, whenever your custom resource's metadata.generation != status.observedGeneration or the deployment's metadata.generation != your custom resource's status.deploymentGeneration, your controller can update the deployment spec and update your custom resource's status.deploymentGeneration (edited)\r\n> \r\n> mikkeloscar [4 minutes ago]\r\n> I didn't consider the admission plugins, that a good point. I will look into the generation idea. Thanks a lot once again!!"}}
{"actor":{"display_login":"mikkeloscar"}}