Packages
Understanding packages in Porch: the relationship between kpt packages and Porch’s PackageRevision API.
This section introduces some core concepts of Porch’s package orchestration:
Package: A Porch Package encapsulates the orchestration of a single
kpt package,
stored in a Git repository. A package may be orchestrated many times, resulting in the creation of many revisions of the
package, each of which is modelled as a package revision. Packages are stored in Git repositories. When you interact
with Porch via porchctl or kubectl, you orchestrate revisions of packages, thus working with PackageRevision resources
and not directly with packages.
Repository: This is a version-control repository used to store package file contents. For example, a Git or (experimentally) OCI repository.
Package Revision: This is a single version of a package. Many versions of a package may exist because Porch allows users to perform multiple orchestrations on a single package. A Package Revision represents a particular version of a package and tracks the state of its orchestration.
Lifecycle: The orchestration of a package revision in Porch has a lifecycle. The package revision passes through a number of lifecycle stages in its journey towards publication as a published package revision (as illustrated below):
Workspace: A workspace is the unique identifier of a package revision within a package. It is specified either by the user (when creating a new package revision by initialisation, cloning, or editing) or by Porch (when discovering a package revision in a Git repository). For the workspace name, the following rules apply:
ran-package and
ev-battery-package it is legal for both to have a workspace called cell1cell1 workspaces above have no intrinsic relationship whateverThe workspace name of a package revision never changes once it is specified, and persists through all lifecycle transitions, even when the package revision is approved and is assigned a revision number.
Revision numbering: A Revision number on a package revision identifies the order in which package revisions of a package were published. When a PackageRevision is approved and moves to the Published lifecycle stage, it is assigned a Revision one higher than the highest existing Revision.
The following rules apply:
00-1-1Notes:
04 once published
Placeholder package revision: A package revision that tracks
the content of a package’s configured Git branch (typically main). It is created automatically when the first revision
of a package is published and updated on each subsequent publish.
Upstream and Downstream: source-and-derivation relationships between package revisions. When a package revision is cloned, it becomes the upstream (source) in its relationship to the newly-created downstream (derived) package revision(s). Downstream package revisions maintain a link to their upstream source package revision and can be upgraded when new versions of the upstream package revision are published.
Functions: Specifically, KRM functions. Functions can be added to a package’s kptfile pipeline in the course of modifying a package revision in Draft state. When a user updates or proposes a package revision, Porch automatically calls kpt to run the pipeline on the package contents, mutating and validating the KRM resource files.
Package Variant and Package Variant Set: These Kubernetes objects represent higher levels of package revision automation. Package variants can be used to automatically track an upstream package revision and manage cloning it to one or several downstream package revisions, as well as preparing new downstream package revisions when a new revision of the upstream package revision is published. Package variant sets enable the same behaviour for package variants themselves.
Configuration as Data (CaD): The architectural approach that Porch implements. CaD treats configuration with the same rigour as application code: configuration data is the source of truth (stored separately from live state), uses a uniform serialisable data model (KRM YAML), separates data from code that acts on it (functions transform, controllers apply), and abstracts storage from operations (clients use APIs, not direct Git/OCI access). Key principles include decoupling abstractions from data, separating actuation from processing, and preferring transformation over generation.
Deployment repository: A repository can be designated as a deployment repository (via spec.deployment: true).
Package revisions in Published state in a deployment repository are considered deployment-ready and can be consumed
by GitOps tools like Flux or Config Sync. See
Repositories
for details.
Understanding packages in Porch: the relationship between kpt packages and Porch’s PackageRevision API.
Understanding repositories in Porch: connecting Porch to Git and OCI storage backends.
Understanding package revisions: their versioning and nature as the working unit in Porch.
The placeholder package revision tracks the configured Git branch for a package. This page explains its behaviour, lifecycle interactions, and how it relates to GitOps workflows.
Understanding workspaces: how Porch isolates concurrent work on packages.
Understanding package revision lifecycle stages and workflow in Porch.
Understanding upstream and downstream packages: the source/derivation relationship in Porch.
Understanding KRM functions in Porch: how functions transform and validate package resources.
Understanding PackageVariant and PackageVariantSet: automation for package cloning and lifecycle management.