<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Functionality on Porch Documentation</title><link>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/</link><description>Recent content in Functionality on Porch Documentation</description><generator>Hugo</generator><language>en-us</language><atom:link href="/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/index.xml" rel="self" type="application/rss+xml"/><item><title>Source Execution</title><link>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/source-execution/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/source-execution/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Source execution handles one-time package creation. When a user creates a PackageRevision with &lt;code&gt;spec.source&lt;/code&gt; set, the controller executes the specified operation to produce initial content in the shared cache. This phase is idempotent: the guard is &lt;code&gt;status.creationSource&lt;/code&gt;; if it is already set, source execution is skipped entirely.&lt;/p&gt;
&lt;p&gt;After any source execution, the controller creates a draft in the cache, writes the resources, closes the draft (committing to Git), and requeues to trigger rendering.&lt;/p&gt;</description></item><item><title>Rendering</title><link>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/rendering/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/rendering/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Rendering runs the KRM function pipeline defined in the package&amp;rsquo;s Kptfile. The controller reads resources from the shared cache, invokes kpt render through the Engine runtime chain (builtin, optional Function Runner exec, porch-server pod evaluator over gRPC), and writes the rendered output back to the cache.&lt;/p&gt;
&lt;h2 id="triggers"&gt;Triggers&lt;a class="td-heading-self-link" href="#triggers" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Two events can trigger rendering:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Content push via PRR&lt;/strong&gt;: When a user edits &lt;code&gt;PackageRevisionResources&lt;/code&gt; (complete replace or &lt;code&gt;?partial=true&lt;/code&gt; merge), the API Server writes the resulting package and patches the &lt;code&gt;porch.kpt.dev/render-request&lt;/code&gt; annotation on the PackageRevision CRD. The controller&amp;rsquo;s predicate filter detects this and triggers a reconcile.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Source execution completion&lt;/strong&gt;: After init, clone, copy, or upgrade produces initial content (including a generated or copied Kptfile), the controller immediately proceeds to render. For init with an empty Kptfile, rendering may produce no additional output.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The controller tracks the annotation value in &lt;code&gt;status.observedPrrResourceVersion&lt;/code&gt; to avoid re-rendering the same content.&lt;/p&gt;</description></item><item><title>Subpackage Operations</title><link>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/subpackage-operations/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/subpackage-operations/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Subpackage operations allow an independent subpackage to be cloned into, or upgraded within, an existing Draft package revision. Unlike source execution (which runs once at package creation time and is guarded by &lt;code&gt;status.creationSource&lt;/code&gt;), subpackage operations can be applied repeatedly to the same package revision — one operation at a time — and are guarded by &lt;code&gt;status.lastSubpackageOperationHash&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The operation is specified via &lt;code&gt;spec.subpackageOperation&lt;/code&gt; on the PackageRevision CRD.&lt;/p&gt;
&lt;h2 id="idempotency"&gt;Idempotency&lt;a class="td-heading-self-link" href="#idempotency" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Each time the controller reconciles a PackageRevision that has &lt;code&gt;spec.subpackageOperation&lt;/code&gt; set, it computes a SHA-256 hash of the operation spec and compares it to &lt;code&gt;status.lastSubpackageOperationHash&lt;/code&gt;. If they match, the operation has already been executed and is skipped. The hash is only written to status after the operation completes successfully, so a failure leaves the hash unset and the operation will be retried on the next reconcile.&lt;/p&gt;</description></item><item><title>Lifecycle Management</title><link>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/lifecycle-management/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/controllers/packagerevision-controller/functionality/lifecycle-management/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The lifecycle phase compares the desired lifecycle in &lt;code&gt;spec.lifecycle&lt;/code&gt; with the actual state in the cache. If they differ, the controller transitions the package accordingly. The &lt;code&gt;spec.lifecycle&lt;/code&gt; field is client-owned: the controller reads it but never writes it.&lt;/p&gt;
&lt;h2 id="lifecycle-states"&gt;Lifecycle States&lt;a class="td-heading-self-link" href="#lifecycle-states" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;State&lt;/th&gt;
 &lt;th&gt;Meaning&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Draft&lt;/td&gt;
 &lt;td&gt;Package is being edited. Stored as a Git branch.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Proposed&lt;/td&gt;
 &lt;td&gt;Package is proposed for review (optional intermediate state).&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Published&lt;/td&gt;
 &lt;td&gt;Package is immutable. Stored as a Git tag.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;DeletionProposed&lt;/td&gt;
 &lt;td&gt;Package is marked for deletion. Required before deleting a published package.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="state-transitions"&gt;State Transitions&lt;a class="td-heading-self-link" href="#state-transitions" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; ┌─────────┐
 │ Draft │◄──────────┐
 └────┬────┘ │
 │ propose │ reject
 ▼ │
 ┌─────────────┐ │
 │ Proposed ├───────┘
 └────┬────────┘
 │ approve
 ▼
 ┌──────────────┐
 │ Published │
 └────┬─────────┘
 │ propose-delete
 ▼
 ┌──────────────────┐
 │ DeletionProposed │
 └────┬─────┬───────┘
 │ │
 approve reject
 deletion │
 │ ▼
 │ Published
 ▼
 [Deleted]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Valid transitions:&lt;/strong&gt;&lt;/p&gt;</description></item></channel></rss>