Skip to content

Commit 7aea11e

Browse files
authored
Package Orchestration Design Document (#3066)
* Package Orchestration Design Document, including user guide * `porch-roadmap.md` document with initial set of future Porch directions.
1 parent 94da3ee commit 7aea11e

File tree

9 files changed

+1100
-8
lines changed

9 files changed

+1100
-8
lines changed

docs/design-docs/06-config-as-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Data* which:
8484
* uses [Kptfile](https://kpt.dev/reference/schema/kptfile/) to store package
8585
metadata
8686
* uses [ResourceList](https://kpt.dev/reference/schema/resource-list/) as a
87-
serialized packge wire-format
87+
serialized package wire-format
8888
* uses a function `ResourceList → ResultList` (`kpt` function) as the
8989
foundational, composable unit of package-manipulation code (note that other
9090
forms of code can manipulate packages as well, i.e. UIs, custom algorithms

docs/design-docs/07-package-orchestration.md

Lines changed: 941 additions & 0 deletions
Large diffs are not rendered by default.

docs/design-docs/CaD Core Architecture.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/design-docs/Porch Architecture.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/design-docs/Porch Inner Loop.svg

Lines changed: 1 addition & 0 deletions
Loading

porch/docs/porch-roadmap.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Porch Roadmap
2+
3+
This document outlines next steps for Porch in several areas. This is a living
4+
document outlining future direction and work in different Porch subsystems.
5+
6+
## API Changes
7+
8+
* Expression kpt function type 'signature', including:
9+
* types of resources the function acts on
10+
* schema of the function config
11+
* types of resources the function _produces_ (if the function introduces new
12+
resources into the configuration package)
13+
* Add `Package` resource to encapsulate all `PackageRevision`s of the same
14+
package, link to the latest `PackageRevision`. Possibly the `Package` resource
15+
can allow mutation of the package or its contents, and automatically create
16+
new (_Draft_) `PackageRevision` resources on mutations.
17+
* Implement support for API-level filtering (field and label selectors) for all
18+
`list` operations.
19+
* Implement support for k8s API primitives such as `Watch`, correct use of all
20+
`ObjectMeta` fields.
21+
* Make sure that all errors translate to the appropriate API-level HTTP status
22+
with clear, actionable messages.
23+
24+
## Repository Management
25+
26+
* Support for specifying repository-wide, default _upstream_ repository which
27+
would become the default upstream repository for cloned packages
28+
* Repository-wide guardrails - functions registered with the repository that
29+
then are evaluated on packages in that repository whenever those packages
30+
change.
31+
* Support updating repository registration, for example when `Repository`
32+
resource is modified to point to a different repository, or even a different
33+
type of a repository (Git --> OCI).
34+
* Implement repository cache eviction policy
35+
* Support `ObjectMeta.GenerateName` for `PackageRevision` creation. Currently
36+
package names are computed as <repository>-<sha>. Ideally Porch would accept
37+
name prefix (constrained for example to the last segment of the package name)
38+
as `GenerateName` value, for example `istions` and Porch would append the SHA.
39+
This will require creating an inverse mapping from package name to its owning
40+
repository. Currently the inverse mapping is encoded in the package name,
41+
whose format is `<repository name>-<package name hash>`.
42+
* Error-resilient repository ingestion (some erroneous packages in the
43+
repository should not prevent repository from successfully loading).
44+
* Make the background repository routine a controller to leverage functionality
45+
in the common controller libraries, such as maintaining reliable `Watch`
46+
connection (`background.go`).
47+
* Enable OCI repositories with heterogeneous contents (containing both
48+
`Package` and `Function` resources)?
49+
* Improve synchronization of repository actions to avoid simultaneous repository
50+
fetches and repository access that requires synchronization.
51+
52+
### Git
53+
54+
* Support for additional authentication schemes (ssh keys, GCP service account),
55+
as required to enable integration with additional Git providers such as
56+
[Cloud Source Repositories](https://cloud.google.com/source-repositories/docs)
57+
* Support authentication for cloning packages from unregistered repositories.
58+
* Porch will need to store more information associated with a package revision,
59+
for example:
60+
* information about the package's error status (to populate the `status`
61+
section of the PackageRevision API resource))
62+
* rationale for rejection proposal to publish a package
63+
64+
We will need to utilize Git repository or some auxiliary storage (git is
65+
preferred because it also propagates information across Porch instances)
66+
and we can consider:
67+
* storing the information in a HEAD draft commit. When draft is updated,
68+
Porch would drop this HEAD commit, stack more mutation commits and then
69+
add a new HEAD commit with additional meta information
70+
* using separate 'meta' branches
71+
* Git notes (though these are attached to object )
72+
* Implement appropriate caching when cloning packages from unregistered
73+
repositories (currently, those repositories are fetched and immediately
74+
deleted))
75+
76+
## OCI
77+
78+
* Complete the OCI support (current implementation is partial, missing package
79+
lifecycle support, cloning from OCI repository is not supported, etc.)
80+
* Support for authentication methods as required by integration with specific
81+
OCI repository providers. Currently Porch authenticates as the workload
82+
identity GCP service account which works well with Google Container Registry
83+
and Artifact Registry; different methods will likely be needed for other
84+
providers.
85+
86+
## Engine
87+
88+
* Create a unified representation of a package and its contents in the system.
89+
Porch Engine currently stores package contents as `map[string]string` (file
90+
name --> file contents, see `PackageResources` type) and kpt intrinsic
91+
algorithms work with `kyaml filesys.FileSys` interface, necessitating
92+
translation. Ideal representation would help minimize the need to not only
93+
translate the representation at the macro level but also reduce need for
94+
repeated parsing and serialization of YAML.
95+
* Support package contents that are not text
96+
* Revisit package update mutation to avoid using local file system and integrate
97+
better with CaD library (`updatePackageMutation.Apply`).
98+
99+
## Package Lifecycle
100+
101+
* Ensure that all operations can be performed only on package revision in the
102+
appropriate lifecycle state (example: only _Published_ packages can be cloned,
103+
deployed, etc.)
104+
* Support detection of new version of upstream package and downstream package
105+
update
106+
* Support sub-packages
107+
* Handling of merge conflicts, assistance with manual conflict resolution
108+
* Bulk package operations (bulk upgrade from updated upstream package)
109+
* Permission model to enable admins more fine-grained control over repository
110+
access than what it supported by underlying Git or other providers
111+
112+
## CLI Integration
113+
114+
* Support for registering repository-wide guardrails - mutators or validators.
115+
* Support for updating repository registration (currently only `register`,
116+
`unregister`, and `get` are implemented)
117+
* On repository unregistration, the CLI can check all other registered
118+
repositories and suggest to the user to keep or delete the secret containing
119+
credentials depending on whether other repository registrations use it or
120+
the last one is being deleted; today, a `--keep-auth-secret` flag is used.
121+
* Registration of _function_ repositories (only _package_ repositories are
122+
currently supported in the CLI).
123+
* Function discovery via in registered function repositories.
124+
* Consider revising the structure of the `kpt alpha` command groups. `kubectl`
125+
organizes the groups by action, for example `kpt get <resource>` whereas
126+
`kpt` by resource: `kpt alpha rpkg get`. Consider `kpt alpha get rpkg` or
127+
`kpt alpha get repo` for consistency with `kubectl` experience.
128+
* Implement richer support for referencing to packages by URLs with proper
129+
parsing, reduce number of command line flags required. For example, support:
130+
`https://github.com/org/repo.git/packge/patch@reference`; Make the parsing
131+
code reusable with the rest of kpt CLI.
132+
133+
## Testing
134+
135+
* Enable the e2e tests to run against a specified Git repository
136+
* Accept Git test image as an argument to avoid requiring the Porch server
137+
image and Git test server image to share the same tag
138+
(see `InferGitServerImage` function and `suite.go` file)
139+
140+
## Broader Changes
141+
142+
* Support non-KRM content as part of `ResourceList` to allow lossless package
143+
transformations, or compensate for lack of this support in general by enabling
144+
in Porch partial package revision `pull` and `push`.
145+
* Make it possible for `R*Sync` resources to be created in arbitrary namespace
146+
* Enable `R*Sync` to sync both namespaced and non-namespaced resources
147+
* Improve the overall deletion flow, possibly implement it as:
148+
- deleting a package means creating a new revision of the package emptied
149+
of content
150+
- rolling out the updated package (this will delete the deployed resources)
151+
- delete the configuration package from repository completely
152+
* Reconcile Porch `RemoteRootSync` controller with Config Sync.
153+
* Create a rollout controller to drive cross-cluster deployment activity.

porch/hack/create-deployment-blueprint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ metadata:
140140
image:
141141
name: ${OLD}
142142
newName: ${IMG}
143-
newTag: ${TAG}
143+
newTag: "${TAG}"
144144
additionalImageFields:
145145
- group: apps
146146
version: v1

porch/repository/pkg/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

porch/repository/pkg/repository/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (n PackageRevisionKey) String() string {
3838
// PackageRevision is an abstract package version.
3939
// We have a single object for both Revision and Resources, because conceptually they are one object.
4040
// The best way we've found (so far) to represent them in k8s is as two resources, but they map to the same object.
41-
// Interesting reading: https://github.com/zecke/Kubernetes/blob/master/docs/devel/api-conventions.md#differing-representations
41+
// Interesting reading: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#differing-representations
4242
type PackageRevision interface {
4343
// KubeObjectName returns an encoded name for the object that should be unique.
4444
// More "readable" values are returned by Key()

0 commit comments

Comments
 (0)