Skip to content

Loose random generated "inventory ID" in order to make kpt less confusing to new users #4387

@kispaljr

Description

@kispaljr

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.

Metadata

Metadata

Labels

enhancementNew feature or requesttriagedIssue has been triaged by adding an `area/` label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions