Problem statement
If I simply do kpt live init mypackage currently a random "inventory ID" is assigned to my local package by default.
Then, if I do kpt live apply mypackage and later loose the local copy of the package (delete the folder from my computer), it is hard to update my deployment in the cluster.
The naive way to do that would be to kpt pkg get the same package again, do my modifications and try to issue kpt live apply again. This however won't work, since it requires a new kpt live init that will by default assign a different "Inventory ID", that in turn will cause conflicts during kpt live apply.
This confused me a lot, when I was a beginner kpt user, and I suspect this is confusing to other new users, as well.
Steps to reproduce:
kpt pkg get <mypackage URL> mypackage
kpt live init mypackage
kpt live apply mypackage # this will work as expected
rm -rf mypackage
kpt pkg get <mypackage URL> mypackage
kpt live init mypackage
kpt live apply mypackage # this won't work due to conflicts (ownership of deployed resources)
How to avoid the problem with the current kpt version
Currently the solution that I use to avoid this is to always specify an "inventory ID" manually with all kpt live init that I issue. E.g. this works, as expected:
kpt pkg get <mypackage URL> mypackage
kpt live init mypackage --inventory-id mydeployment -- name mydeployment
kpt live apply mypackage # this will work as expected
rm -rf mypackage
kpt pkg get <mypackage URL> mypackage
kpt live init mypackage --inventory-id mydeployment -- name mydeployment
kpt live apply mypackage # this works as expected
A possible solution
Treat "inventory ID" as a mandatory parameter and do not generate a random ID by default. Basically I suggest to treat "Inventory ID" as the "release name" in helm (i.e. in helm install <release-name> ...).
I also suggest to make the --name parameter of kpt live init equal to the "inventory ID". Either by default, or loose --name completely and force it to be the same as the "inventory ID".
Renaming "inventory ID" to something like "deployment/instance name" could also be considered.
Problem statement
If I simply do
kpt live init mypackagecurrently a random "inventory ID" is assigned to my local package by default.Then, if I do
kpt live apply mypackageand later loose the local copy of the package (delete the folder from my computer), it is hard to update my deployment in the cluster.The naive way to do that would be to
kpt pkg getthe same package again, do my modifications and try to issuekpt live applyagain. This however won't work, since it requires a newkpt live initthat will by default assign a different "Inventory ID", that in turn will cause conflicts duringkpt live apply.This confused me a lot, when I was a beginner
kptuser, and I suspect this is confusing to other new users, as well.Steps to reproduce:
How to avoid the problem with the current
kptversionCurrently the solution that I use to avoid this is to always specify an "inventory ID" manually with all
kpt live initthat I issue. E.g. this works, as expected:A possible solution
Treat "inventory ID" as a mandatory parameter and do not generate a random ID by default. Basically I suggest to treat "Inventory ID" as the "release name" in helm (i.e. in
helm install <release-name> ...).I also suggest to make the
--nameparameter ofkpt live initequal to the "inventory ID". Either by default, or loose--namecompletely and force it to be the same as the "inventory ID".Renaming "inventory ID" to something like "deployment/instance name" could also be considered.