<p dir="auto">Forked from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="40954231" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1007" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/1007/hovercard" href="https://github.com/kubernetes/kubernetes/pull/1007">#1007</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="42834370" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1325" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/1325/hovercard" href="https://github.com/kubernetes/kubernetes/pull/1325">#1325</a> .</p>
<p dir="auto">We want to support management of services via declarative configuration.</p>
<p dir="auto">The configuration files written by the user may need to undergo multiple transformations before submitting them to the API, as discussed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="45421110" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1694" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1694/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1694">#1694</a>, but the result of these steps should be concrete objects. These objects may need to be created, updated, and/or deleted.</p>
<p dir="auto">On an object-by-object basis, it should be possible via kubectl (via a client library) to do the following:</p>
<ol dir="auto">
<li>Determine whether or not the specified object already exists</li>
<li>Get the specified object</li>
<li>Create the specified object</li>
<li>Diff the specified object with an existing object in apiserver</li>
<li>Update an existing object in apiserver with the data from the specified object</li>
<li>Delete the specified object</li>
<li>Delete all objects with deployment-specific labels (see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="45426103" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1698" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1698/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1698">#1698</a>)</li>
</ol>
<p dir="auto">The configured fields should be recorded in the object via annotations, as discussed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="41961267" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1178" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1178/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1178">#1178</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="42103746" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1201" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1201/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1201">#1201</a>. Only the previously and newly configured fields, labels, and annotations should be diff'ed and/or updated. Other fields from the existing object should be ignored/merged, and the set of configured fields should be updated with each update.</p>
<p dir="auto">We ultimately do want to automate most of the orchestration/workflow involved in deployment. However, this is fairly complex, and we can't necessarily automate all of it in a domain-independent, use-case-independent manner. In general, a full deployment would likely be comprised of multiple files, each containing multiple objects. These objects may have inter-dependencies (e.g., right now services must be created before their clients are created), rolling updates require special treatment (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="43089437" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1353" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1353/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1353">#1353</a>), and application-specific rollout logic may be required. Therefore, I recommend we keep the more general deployment workflow separate from the basic primitive mechanism that reconciles a single object, and ensure that the two are composable. I'll file another issue for the workflow part.</p>
<p dir="auto">Among other things, composition means that the invoker of the tool and/or library needs to be able to distinguish noop (e.g., object already exists and matches config), success, retryable failure, and permanent failure, so the overall workflow can decide what to do after each step.</p>
<p dir="auto">/cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ghodss/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ghodss">@ghodss</a></p>
<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.): no</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.): testing.md README.md</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): BUG REPORT</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>): NA</p>
<p dir="auto"><strong>Environment</strong>: NA</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>:</li>
<li><strong>OS</strong> (e.g. from /etc/os-release):</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>):</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>: I visited <a href="https://github.com/kubernetes/kubernetes/blob/master/docs/devel/README.md">https://github.com/kubernetes/kubernetes/blob/master/docs/devel/README.md</a> and did not find much about testing.</p>
<p dir="auto"><strong>What you expected to happen</strong>: I expected more information.  A link to <a href="https://github.com/kubernetes/kubernetes/blob/master/docs/devel/testing.md">https://github.com/kubernetes/kubernetes/blob/master/docs/devel/testing.md</a> would have been great.</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible): Visit <a href="https://github.com/kubernetes/kubernetes/blob/master/docs/devel/README.md">https://github.com/kubernetes/kubernetes/blob/master/docs/devel/README.md</a> and try to learn all about testing Kubernetes.</p>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>