WIP: Add Rename helper, along with ref visitors#627
WIP: Add Rename helper, along with ref visitors#627justinsb wants to merge 1 commit intokptdev:mainfrom
Conversation
Rename will rename / renamespace an object, but will also update all references to it. We introduce the idea of a Ref and functions to discover and visit references. These are currently backed by a hard-coded list of kinds and ref fields; we should move this to something backed by OpenAPI in future.
|
cc @apelisse to start thinking about replacing the hard-coded DB. |
|
|
||
| // GetRootKptfile returns the root Kptfile. Nested kpt packages can have multiple Kptfile files of the same GVKNN. | ||
| func (o KubeObjects) GetRootKptfile() *KubeObject { | ||
| kptfiles := o.Where(IsGVK(v1.KptFileGroup, v1.KptFileVersion, v1.KptFileKind)) |
There was a problem hiding this comment.
Ah, I think the kptfile v1 is only merged into kpt repo, while this lib uses https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/go/api/kptfile/v1/types.go
|
@justinsb Are you purposely placing the rename and ref visitor outside go/fn? I think that's valid if we want to separate k8s resources and google cloud CNRM resources (looks like what it is now), but that means the go/fn and go/pkg cannot import each other (pkg dependency loop), which might make future feature extension harder to do. I can see many upcoming features will be used on both k8s and cnrm resources. If this is not the case, it would be better to put the pkg in |
Rename will rename / renamespace an object, but will also update all
references to it.
We introduce the idea of a Ref and functions to discover and visit
references.
These are currently backed by a hard-coded list of kinds and ref
fields; we should move this to something backed by OpenAPI in future.