Creating Packages
Create, push content to, render, and publish a package using the CRD-based architecture.
Before enabling the CRD-based architecture, ensure you have:
Packagerevisions reconciler)Porch supports a controller-based architecture where PackageRevisions are managed as native Kubernetes CRDs (API version porch.kpt.dev/v1alpha2). This replaces the synchronous aggregated API model with an asynchronous controller that reconciles desired state against Git in the background.
For now, this is an opt-in feature. You enable it by adding the Packagerevisions reconciler to the controllers deployment. The aggregated API and CRD-based architectures can coexist in the same cluster.
kubectl describe show exactly what is happening.The PackageRevision CRD (porch.kpt.dev/v1alpha2) must be installed in the cluster. If you deployed Porch using the standard manifests, the CRD is included. Verify it exists:
kubectl get crd packagerevisions.porch.kpt.dev
Expected output:
NAME CREATED AT
packagerevisions.porch.kpt.dev 2025-01-15T10:00:00Z
Add packagerevisions to the --reconcilers flag on the controllers deployment. If you are already running the repository controller, the flag becomes:
--reconcilers=repositories,packagerevisions
You can patch an existing deployment:
kubectl -n porch-system patch deployment porch-controllers \
--type='json' \
-p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": ["--reconcilers=repositories,packagerevisions"]}]'
Repositories must be annotated to opt into CRD-based management. Without this annotation, the repository controller will not create v1alpha2 PackageRevision CRDs, and the API server will continue to handle the repository via the v1alpha1 path.
Add the annotation to each repository you want managed by the PR Controller:
kubectl annotate repository my-repo porch.kpt.dev/v1alpha2-migration=true
Or include it in the Repository manifest:
apiVersion: config.porch.kpt.dev/v1alpha1
kind: Repository
metadata:
name: my-repo
namespace: default
annotations:
porch.kpt.dev/v1alpha2-migration: "true"
spec:
type: git
git:
repo: https://github.com/example/my-repo.git
branch: main
Once annotated:
Check that the controllers pod restarted and the PR Controller is active:
kubectl -n porch-system logs deployment/porch-controllers | grep "packagerevisions"
You should see log lines indicating the reconciler has started:
"Starting workers" controller="packagerevisions" worker count=50
If you plan to use external KRM functions (container-based), confirm the function runner is reachable:
kubectl -n porch-system get pods -l app=function-runner
The FUNCTION_RUNNER_ADDRESS environment variable must be set on the controllers deployment. The default Porch manifests already configure this.
Create, push content to, render, and publish a package using the CRD-based architecture.
What changes for users when moving from the aggregated API to the CRD-based architecture.