Desc
Display upstream package metadata
Reads From | Writes To |
---|---|
git repository | local directory |
The pkg
command group contains subcommands which read remote upstream
git repositories, and write local directories. They are focused on
providing porcelain on top of workflows which would otherwise require
wrapping git to pull clone subdirectories and perform updates by merging
resources rather than files.
kpt pkg [SUBCOMMAND]
# create your workspace
$ mkdir hello-world-workspace
$ cd hello-world-workspace
$ git init
# get the package
$ export SRC_REPO=https://github.com/GoogleContainerTools/kpt.git
$ kpt pkg get $SRC_REPO/package-examples/helloworld-set@v0.3.0 helloworld
# add helloworld to your workspace
$ git add .
$ git commit -am "Add hello world to my workspace."
# pull in upstream updates by merging Resources
$ kpt pkg update helloworld@v0.5.0 --strategy=resource-merge
kubectl apply -R -f
.vi
) or programmatically.Packages are simply subdirectories of resource configuration files in git
Any existing git subdirectory containing resource configuration files may be used as a package
Nothing besides a git directory containing resource configuration is required.
e.g. any example in the examples repo may be used as a package:
kpt pkg get https://github.com/kubernetes/examples/staging/cockroachdb \
my-cockroachdb
kubectl apply -R -f my-cockroachdb
Packages should use git references for versioning.
We recommend package authors use semantic versioning when publishing packages for others to consume.
kpt pkg get https://github.com/kubernetes/examples/staging/cockroachdb@VERSION \
my-cockroachdb
kubectl apply -R -f my-cockroachdb
Packages may be modified or customized in place.
The same package may be fetched multiple times to separate locations.
Each instance may be modified and updated independently of the others.
# fetch an instance of a java package
kpt pkg get https://github.com/kubernetes/examples/staging/cockroachdb db1
# make changes...
# fetch a second instance of a java package
kpt pkg get https://github.com/kubernetes/examples/staging/cockroachdb db2
# make changes...
Packages may pull upstream updates after they have been fetched and modified.
Specify the target version to update to, and an (optional) update strategy for how to apply the upstream changes.
kpt pkg get https://github.com/kubernetes/examples/staging/cockroachdb \
my-cockroachdb
# make changes...
kpt pkg update my-cockroachdb@NEW_VERSION --strategy=resource-merge
Packages must be customized and updated within a git repo.
Display upstream package metadata
Diff a local package against upstream
Fix a local package which is using deprecated features.
Fetch a package from a git repo.
Initialize an empty package
Apply upstream package updates