-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name Prefix and Suffix Transformation for multi level level kustomize context #1378
Conversation
/assign @Liujingfang1 |
8b6fdf5
to
96c85cb
Compare
It seems this PR fixes:
|
bd2110d
to
fc7f6ae
Compare
@Liujingfang1 Gentle bump of the PR. Rebase was successful |
@jbrette Thank you. Will review it today. |
@Liujingfang1 This is done. I did the changes and repushed. Thanks for the review. Was able to simplify even further. Can you have a look at it again. |
- Update PrefixSuffixTransfomer to add empty prefix and suffix
pkg/resmap/resmap.go
Outdated
// Need to match more accuratly both at the time of selection and transformation. | ||
// OutmostPrefixSuffixEquals is not accurate enough since it is only using | ||
// the outer most suffix and the last prefix. Use PrefixedSuffixesEquals instead. | ||
if (!inputId.IsNamespaceableKind() && r.InSameKustomizeCtx(rctxm)) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(!inputId.IsNamespaceableKind() || !r.OrgId().IsNamespaceableKind || r.CurId.IsNsEquals(input)) && r.InSameKustomizeCtx(rctxm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Liujingfang1 Sorry. Should have seen that. This is done now. Ready for merge I hope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you.
- Leverage nameprefix and namesuffix contextual data
- Update unit and integration tests.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jbrette, Liujingfang1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR builds on the "OuterMost" Prefix and Suffix usage for the name transformation.
Current code was unable to deal properly with a last level of kustomize that was combining two sub levels. In such as case the outermost prefix and suffix where often empty.
This PR is using the stack of prefixes and suffixes accumulated during the name prefix/suffix transformation to handle properly the namereference transformation.
The ResCtx (Resource Context) interface has been introduced. It is currently relying on name prefix and suffix but long term it should be possible to extend it to use a filename or a commit id equivalent to identify a kustomize content (a.k.a a folder with a kustomization.yaml).