Composing packages

17 views
Skip to first unread message

Randolph Chung

unread,
Dec 4, 2021, 1:05:25 PM12/4/21
to kpt-users
Hi, I have a question about how kpt packages are supposed to be composed.

In the kpt documentation, there's an example of a wordpress package that contains a subpackage mysql.

Now obviously mysql can be used for other applications. Let's say there is also a numberpress application that wants to use mysql.

What is the expected pattern of creating these packages?

As a publisher, if we had:

wordpress/
  mysql/
numberpress/
  mysql/

then the mysql contents are duplicated (presumably, the top level wordpress/setters.yaml and numberpress/setters.yaml configure mysql slightly differently, but the actual mysql manifests are similar)

If we instead publish these independently as three packages:
wordpress
numberpress
mysql

then how are consumers expected to utilize these packages while ensuring the dependencies are satisfied?

thanks
randolph

Karl Isenberg

unread,
Dec 6, 2021, 12:00:50 PM12/6/21
to Randolph Chung, kpt-users
Each time you “kpt pkg get” you’re making a copy of the upstream package that can later be updated to pull down upstream changes. So if you need to use a package multiple times, it’s usually a good idea to manage the shared config in an upstream package. 

This means that you can put your mysql package in one repo and then check it out into another repo.  

Repo1:
mysql/

Repo2:
wordpress/
  mysql/
numberpress/
  mysql/

This way you can manage shared config in repo1 and “kpt pkg get” it into the subdirectories in repo2. Then your downstream users only need to “kpt pkg get” the parent directories in repo2. And you control when repo2 gets updated from repo1 using “kpt pkg update”.

Other than using subpackages, kpt doesn’t current have a mechanism for dependency management between packages. But we did just add dependency ordering for individual resources: 

--
You received this message because you are subscribed to the Google Groups "kpt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kpt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kpt-users/ade21e58-76cc-455b-b0df-91abae777144n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages