Skip to content

Commit 578f91e

Browse files
authored
PackageRevision controller architecture docs (#971)
* docs: add PackageRevision controller architecture docs (draft) Add v1alpha2 architecture documentation for the PackageRevision controller as Hugo draft pages. These render in deploy previews but are hidden from the production build. New pages: - deployment-modes.md: v1alpha1 vs v1alpha2 architecture comparison - packagerevision-controller/_index.md: controller overview - packagerevision-controller/design.md: internal design - packagerevision-controller/interactions.md: component interactions Also adds docs/config/development.toml (buildDrafts=true) and docs/config/production.toml so the existing Netlify build command picks up environment-specific settings. * Rewrite and restructuring Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Address copilot comments Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Fix netlify build Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Address review comments Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> --------- Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
1 parent e1f9b94 commit 578f91e

37 files changed

Lines changed: 1366 additions & 192 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ project as of December 2023.
1010

1111
## Documentation
1212

13-
Documentation of Porch is available in the [Porch documentation page](https://docs.porch.nephio.org/).
13+
Documentation of Porch is available in the [Porch documentation page](https://porch.kpt.dev/).
1414

1515
## License compliance
1616

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Docs
22

3-
The documentation was moved to the [kpt Porch repo](https://github.com/kptdev/porch/tree/main/docs/content/en/docs) and rendered in the [Porch documentation page](https://docs.nephio.org/docs/porch/).
3+
The documentation was moved to the [kpt Porch repo](https://github.com/kptdev/porch/tree/main/docs/content/en/docs) and rendered on the [Porch documentation page](https://porch.kpt.dev/).

docs/assets/scss/_main.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ p {
5858
.td-main main {
5959
padding-top: 5rem;
6060
}
61+
62+
// Ensure the three-column layout flexes properly when sidebar is resized.
63+
.td-main > .row {
64+
flex-wrap: nowrap;
65+
}
66+
.td-main main.col-12 {
67+
flex: 1 1 0;
68+
min-width: 0;
69+
}
70+
6171
.td-box .row {
6272
padding-left: 0vw;
6373
padding-right: 0vw;
Lines changed: 44 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1-
// Sidebar left.
1+
// Sidebar left: wider default + resizable.
22
.td-sidebar {
33
padding-bottom: 20px;
44
padding-top: 1rem;
55
background-color: $td-sidebar-bg-color;
66

7-
.td-sidebar-version {
8-
padding-top: 0.5rem;
9-
padding-bottom: 0.5rem;
10-
border-bottom: 1px solid #ddd;
7+
@media (min-width: 768px) {
8+
min-width: 200px;
9+
width: var(--td-sidebar-width, 300px);
10+
max-width: 50vw;
11+
flex: 0 0 var(--td-sidebar-width, 300px) !important;
12+
position: relative;
1113

12-
.td-version-menu {
13-
.nav-link {
14-
color: $black;
15-
padding: 0.25rem 0;
16-
font-size: 1rem;
17-
font-weight: 600;
18-
}
14+
// Override Bootstrap column max-width constraints.
15+
&.col-md-3,
16+
&.col-xl-2 {
17+
max-width: none;
18+
}
19+
}
20+
21+
// Drag handle for resizing.
22+
.td-sidebar-resize-handle {
23+
position: absolute;
24+
top: 0;
25+
right: -3px;
26+
width: 6px;
27+
height: 100%;
28+
cursor: col-resize;
29+
z-index: 100;
30+
background: transparent;
31+
transition: background 0.15s;
32+
33+
&:hover,
34+
&.dragging {
35+
background: rgba($primary, 0.3);
1936
}
2037
}
2138
.td-sidebar__inner {
@@ -24,104 +41,32 @@
2441
}
2542
}
2643

44+
// Version selector: more prominent with top padding.
45+
.td-version-menu {
46+
padding-top: 0.75rem;
47+
padding-bottom: 0.5rem;
48+
padding-left: 1rem;
49+
50+
.td-version-menu__title {
51+
font-weight: 700;
52+
font-size: 1.1rem;
53+
color: $black;
54+
padding: 0;
55+
}
56+
}
57+
2758
// Navigation in Left-sidebar.
2859
.td-sidebar-nav {
2960
@media (min-width: 768px) {
3061
@supports ((position: -webkit-sticky) or (position: sticky)) {
31-
// shadow overflow.
32-
background: linear-gradient(#f4f4f4 33%, rgba(255, 255, 255, 0)),
33-
linear-gradient(rgba(255, 255, 255, 0), #f4f4f4 66%) 0 100%,
34-
radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)),
35-
radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 0 100%;
36-
background-color: #f4f4f4;
37-
background-repeat: no-repeat;
38-
background-attachment: local, local, scroll, scroll;
39-
background-size: 100% 57px, 100% 57px, 100% 19px, 100% 19px;
4062
max-height: calc(100vh - 12.5rem);
63+
overflow-y: auto;
4164
}
4265
}
4366
@media (min-width: 1024px) {
4467
@supports ((position: -webkit-sticky) or (position: sticky)) {
4568
max-height: calc(100vh - 14rem);
4669
}
4770
}
48-
49-
> .td-sidebar-nav__section {
50-
padding-left: 1.5rem;
51-
52-
ul {
53-
padding-left: 0.5rem !important;
54-
}
55-
}
56-
.td-sidebar-nav__section-title {
57-
margin-bottom: 5px;
58-
> ul {
59-
margin-top: 5px;
60-
61-
.td-sidebar-nav__section-title.with-child {
62-
> a {
63-
position: relative;
64-
display: flex;
65-
justify-content: space-between;
66-
padding-right: 20px;
67-
&::after {
68-
display: inline-flex;
69-
content: '\f078';
70-
font-family: 'Font Awesome 6 Free';
71-
font-weight: 900;
72-
}
73-
}
74-
&.active-path {
75-
> a {
76-
&::after {
77-
transform: rotate(180deg);
78-
}
79-
}
80-
}
81-
ul.foldable {
82-
margin-left: 10px;
83-
}
84-
}
85-
}
86-
// Same name but this is a child of the same.
87-
.td-sidebar-nav__section-title {
88-
margin-right: 15px;
89-
@media (min-width: 768px) {
90-
margin-right: 0;
91-
}
92-
}
93-
.td-sidebar-link {
94-
// Style.
95-
font-weight: 700;
96-
font-size: 16px;
97-
line-height: 150%;
98-
letter-spacing: 0.02em;
99-
color: $black;
100-
// Spacing.
101-
display: flex;
102-
padding-top: 8px;
103-
padding-bottom: 8px;
104-
border-radius: 5px;
105-
border-left: 4px solid transparent;
106-
filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0));
107-
span {
108-
padding-left: 10px;
109-
padding-right: 20px;
110-
}
111-
&:hover {
112-
color: $link-color;
113-
}
114-
&.active {
115-
background-color: #eee;
116-
filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.05));
117-
}
118-
@media (min-width: 768px) {
119-
&.active {
120-
background-color: #f8f8f8;
121-
}
122-
}
123-
124-
}
125-
}
12671
}
12772
}

docs/assets/scss/_sidebar-toc.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
@supports (position: sticky) {
99
position: sticky;
1010
top: 4rem;
11-
height: calc(100vh - 6rem);
11+
height: calc(100vh - 4rem);
1212
overflow-y: auto;
13+
align-self: flex-start;
1314
}
1415

1516
order: 2;
1617
padding-bottom: 1.5rem;
1718
vertical-align: top;
19+
flex: 0 0 200px;
20+
min-width: 160px;
1821
}
1922

2023
.td-page-meta {

docs/config.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ pygmentsStyle = "tango"
3636
[markup.goldmark.parser]
3737
[markup.goldmark.parser.attribute]
3838
title = true
39-
[markup.goldmark.renderer.headingAnchor]
40-
enable = true
41-
prefix = ""
42-
suffix = ""
43-
plainID = true
4439

4540
[markup.highlight]
4641
style = "tango"
@@ -128,6 +123,7 @@ footer_about_disable = true
128123
navbar_logo = true
129124
navbar_translucent_over_cover_disable = false
130125
sidebar_menu_compact = true
126+
sidebar_menu_foldable = true
131127
sidebar_search_disable = false
132128

133129
# Adds a H2 section titled "Feedback" to the bottom of each doc. The responses are sent to Google Analytics as events.

docs/config/development.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Development/preview environment overrides
2+
# Enables draft content in deploy previews and branch deploys
3+
buildDrafts = true

docs/config/production.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Production environment overrides
2+
# Drafts are excluded by default (Hugo's default behavior)
3+
# This file exists so the Netlify build command doesn't warn about a missing config merge

docs/content/en/docs/12_contributing/docs-contribution/_index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,35 @@ To add a new top-level section:
248248
3. Set appropriate `weight` in front matter
249249
4. Add content files as needed
250250

251+
### Documenting Unreleased Features
252+
253+
When documenting a feature that isn't ready for public release, use Hugo's draft mechanism to keep pages out of the production site while still allowing review in deploy previews.
254+
255+
Add `draft: true` to the page's front matter:
256+
257+
```yaml
258+
---
259+
title: "New Feature"
260+
type: docs
261+
draft: true
262+
---
263+
```
264+
265+
Draft pages are excluded from production builds but included in Netlify deploy previews (pull request previews). This is controlled by environment-specific config files:
266+
267+
- `docs/config/production.toml` — default Hugo behavior (no drafts)
268+
- `docs/config/development.toml` — sets `buildDrafts = true`
269+
270+
Netlify sets `HUGO_ENV=production` for the main deploy and `HUGO_ENV=development` for deploy previews, so draft pages automatically appear in PR previews and stay hidden on the live site.
271+
272+
To preview drafts locally:
273+
274+
```bash
275+
hugo server -D
276+
```
277+
278+
When the feature is ready to publish, remove `draft: true` from the front matter and add any navigation links (e.g. references from parent `_index.md` pages) in the same commit. Avoid adding `relref` links to draft pages from non-draft pages — Hugo will fail the production build with a broken link error.
279+
251280
## Review Process
252281

253282
Documentation PRs are reviewed by maintainers. Expect feedback on:

docs/content/en/docs/1_overview/_index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Overview"
33
type: docs
44
weight: -1
55
description: >
6-
Porch is a Kubernetes extension apiserver for managing the lifecycle of KRM configuration packages in Git repositories. It provides a Kubernetes-native API for package operations, enabling GitOps workflows with approval gates, automation, and collaboration.
6+
Porch is a Kubernetes-based system for managing the lifecycle of KRM configuration packages stored in Git repositories. It exposes package operations as Kubernetes resources, enabling GitOps workflows with approval gates, automation, and collaboration.
77
---
88

99
Porch (Package Orchestration Server) is part of the [kpt project](https://github.com/kptdev/kpt). The name "Porch" is short for "Package ORCHestration."
@@ -66,12 +66,20 @@ Porch sits between package authors and deployment tools, providing the orchestra
6666

6767
## Architecture
6868

69-
Porch consists of four main deployable components.
69+
Porch consists of three main deployable components.
7070

71-
The **Porch Server** is a Kubernetes aggregated apiserver that exposes the PackageRevision and Repository APIs. It includes the Engine (orchestration logic), the Cache (repository content), and Repository Adapters that abstract Git backends.
71+
The **Porch Server** is a Kubernetes aggregated apiserver that serves the `porch.kpt.dev/v1alpha1` API PackageRevision, PackageRevisionResources, and Package resources. It includes the Engine (orchestration logic), the Cache (repository content), and Repository Adapters that abstract Git backends. As the architecture evolves toward the CRD-based model, the server will remain, and continue to serve PackageRevisionResources (PRR) package file content that can exceed etcd size limits and provides the v1alpha1 API for existing PackageRevisionResources (PRR) clients.
7272

7373
The **Function Runner** is a separate gRPC service that runs KRM functions in containers. It can execute both functions provided by Porch and externally developed function images.
7474

75-
**Controllers** are Kubernetes controllers that automate package operations. The PackageVariant controller clones and updates packages; the PackageVariantSet controller manages sets of package variants.
75+
The **Controllers** are a set of Kubernetes controllers that manage package lifecycle and automate operations:
76+
77+
- [**PackageRevision Controller**]({{% relref "/docs/5_architecture_and_components/controllers/packagerevision-controller" %}}) — manages PackageRevision custom resources (`porch.kpt.dev/v1alpha2`), handling package creation, rendering, and lifecycle transitions.
78+
- [**Repository Controller**]({{% relref "/docs/5_architecture_and_components/controllers/repository-controller" %}}) — synchronizes Repository custom resources with their backing Git repositories.
79+
- [**PackageVariant Controllers**]({{% relref "/docs/5_architecture_and_components/controllers/packagevariants" %}}) — automate creation and management of package variants through declarative configuration.
7680

7781
The **Cache** is a storage backend used to cache repository content for performance. Porch supports a CR-based cache backed by Kubernetes custom resources, or a PostgreSQL-based cache for larger deployments.
82+
83+
{{% alert title="Architecture Direction" color="info" %}}
84+
Porch is transitioning from an aggregated API model (where the API server orchestrates all operations) to a CRD-based controller model (where native Kubernetes CRDs and controllers handle package lifecycle). The aggregated API server remains for serving PackageRevisionResources content.
85+
{{% /alert %}}

0 commit comments

Comments
 (0)