Skip to content

Conversation

justinsb
Copy link
Contributor

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.

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.
@justinsb justinsb changed the title Add Rename helper, along with ref visitors WIP: Add Rename helper, along with ref visitors Sep 27, 2022
@justinsb
Copy link
Contributor Author

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@yuwenma
Copy link
Contributor

yuwenma commented Sep 30, 2022

@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 go/fn, because that's the go repo path and the SDK users can better discover the cnrm functions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants