Repositories

Understanding repositories in Porch: connecting Porch to Git and OCI storage backends.

What is a Repository in Porch?

A Repository is a Kubernetes resource that connects Porch to a Git repository where kpt packages are stored. When you register a repository with Porch, you’re creating a Repository resource that tells Porch:

  • Where the storage backend is located (Git URL)
    • including a particular branch within the repository - the deployment branch
  • How to authenticate (via references to a Kubernetes Secret containing the credentials)
  • Whether it’s a deployment repository (packages ready for deployment)
  • How often to sync/refresh the package revision cache

Repository Types

Porch supports two storage backends:

Git Repositories

Git repositories are the primary and fully-supported storage backend for Porch. Packages are stored as kpt packages in a Git branch, each in a directory with a Kptfile. When using the CR cache, Draft and Proposed package revisions live on temporary branches (for example, drafts/my-package/v1 or proposed/my-package/v1), while Published package revisions are committed to the registered deployment branch. The full Git history is preserved for audit and rollback, and standard Git authentication (username/password, SSH keys, tokens) is used.

OCI Repositories (Experimental)

OCI (Open Container Initiative) registries provide an alternative storage backend. Packages are stored as OCI artifacts (similar to container images). Support is experimental and may be unstable. This option is useful in environments that already use OCI registries.

Deployment vs Blueprint Repositories

Repositories can be designated as either deployment or blueprint repositories via the spec.deployment field. This field is merely an indicator - Porch does not treat deployment repositories differently from blueprint repositories in any respect.

  • Blueprint repositories (deployment: false) store reusable template packages that are meant to be cloned and customized. They are typically maintained by platform teams. Examples include shared infrastructure patterns and application templates.
  • Deployment repositories (deployment: true) store deployment-ready packages: published packages that GitOps tools (such as Flux) can deploy. They typically target specific environments or clusters. Examples include prod-cluster-configs and dev-environment-packages.

The Repository-Package Relationship

When a Repository resource is registered with Porch, Porch automatically conducts package revision discovery: it scans the storage backend for kpt packages (directories containing a Kptfile), creates PackageRevision resources for each discovered package, maintains a cache of package metadata for performance, and periodically syncs to detect new or updated packages. This means the Repository resource acts as the bridge between Porch’s Kubernetes API and the actual Git repository where kpt package files are stored.

Key Points

  • Repository is a Kubernetes resource, not the Git/OCI storage itself
  • It tells Porch where to find kpt packages and how to access them
  • Git repositories are production-ready; OCI support is experimental
  • Deployment repositories should contain packages that are ready for deployment
  • Porch automatically discovers packages, parses their history, and exposes them as package revisions