kpt icon indicating copy to clipboard operation
kpt copied to clipboard

kpt live apply: "Multiple ResourceGroup objects found"

Open justinsb opened this issue 3 years ago • 3 comments

I'm iterating on a few packages locally and trying to use kpt live apply (because kubectl apply doesn't ignore local-config annotations, also pruning is nice)

However, when I nest packages and try to apply a "parent" package, I get:

Error: Multiple ResourceGroup objects found. Please make sure at most one ResourceGroup object exists within the package.

That makes sense, but there doesn't appear a workaround (that I found).

I would expect kpt live apply to either apply a set of ResourceGroups or restrict to the "top" ResourceGroup (and not recurse down)

justinsb avatar Aug 17 '22 17:08 justinsb

I wonder how the ResourceGroup sharding feature (https://github.com/GoogleContainerTools/kpt/pull/3430) would impact this and for the ResourceGroup resource adoption use case. @rquitales @karlkfi

janetkuo avatar Aug 18 '22 21:08 janetkuo

My understanding of the kpt deployment feature is that

  1. A KRM object should only be managed by a single ResourceGroup.
  2. One package can have at most one ResourceGroup (that's also the original reason why resource group is placed inside the Kptfile)
  3. Assuming users know what they are doing, they can force a KRM resource to belong to another ResourceGroup.

For nested packages, the workaround or the user-aware approach will be to specifically delete ResourceGroup objects in sub-packages and only keep the one in root pacakge, and force the root ResourceGroup to adopt all resources.

+cc @mortent

yuwenma avatar Aug 18 '22 22:08 yuwenma

@janetkuo The sharding should not be impacted by this feature request to support nested sub-packages (ie. nested ResourceGroup objects, assuming that we don't want to use the workaround provided by @yuwenma where the parent ResourceGroup owns all sub-packages' resources).

Sharding of resources only occurs on the live cluster due to etcd limitations. The local ResourceGroup object is not split up.

rquitales avatar Aug 18 '22 22:08 rquitales