-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
add replacement filter to support replacmenttransformer #3735
add replacement filter to support replacmenttransformer #3735
Conversation
e7cc1a1
to
35422be
Compare
35422be
to
71afbb8
Compare
71afbb8
to
dac984e
Compare
dac984e
to
c6bf10f
Compare
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.
I have a question about the feature set we want for the source/target fields, but it doesn't need to block this initial iteration from merging.
/lgtm
c6bf10f
to
14b64b1
Compare
@monopole could you take a look? This still needs approval from someone on the kustomize maintainers list |
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.
added comment above, request no new use of the Target
struct.
14b64b1
to
b920d64
Compare
@monopole @KnVerey updated the PR to reflect the proposed config I also added a field (fieldPaths) to make it possible for targets to have multiple fieldpaths. An example use case for this is in one of the tests, but if this functionality is not desired I can take it out. To keep the size of the PR down, I haven't yet implemented use of the |
looks great, just minor nits. thanks for deferring Deny and fieldoptions. |
b920d64
to
9e4aac0
Compare
6e9034d
to
7560846
Compare
7560846
to
0b3f9bd
Compare
0b3f9bd
to
fa0b237
Compare
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.
I think we should add more test coverage, including regression cases for the empty namespace and missing group issues identified in the last round. But that can be done in follow-ups; there's already at least one other testing TODO. Found a few documentation typos, but they're about the deferred fields anyway.
/lgtm
Select *Selector `json:"select" yaml:"select"` | ||
|
||
// From the allowed set, remove objects that match this. | ||
// TODO (#3492): Remove matches listed in the exclude field |
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.
// TODO (#3492): Remove matches listed in the exclude field | |
// TODO (#3492): Remove matches listed in the Reject field |
type ReplTarget struct { | ||
ObjRef *Selector `json:"objref,omitempty" yaml:"objref,omitempty"` | ||
FieldRefs []string `json:"fieldrefs,omitempty" yaml:"fieldrefs,omitempty"` | ||
// FieldPath is a structured field path to the desired object |
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.
// FieldPath is a structured field path to the desired object | |
// FieldOptions refine the interpretation of FieldPaths. |
FieldRefs []string `json:"fieldrefs,omitempty" yaml:"fieldrefs,omitempty"` | ||
// FieldPath is a structured field path to the desired object | ||
// TODO (#3492): Implement use of these options, they are | ||
// currently used |
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.
// currently used | |
// currently unused |
input string | ||
replacements string | ||
expected string | ||
expectedErr bool |
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.
Is using a bool for this the norm on this project? I'm used to matching against an error string when an error is expected, since there are typically multiple places an error could occur, and it's also nice to assert against what the user will actually see.
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.
I can update this on a followup PR (along with all the typos). Thanks so much for your help!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, monopole, natasha41575 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 |
Part of #3492
The existing, untested replacement transformer converts the resource to a map, applies the transformations, and then must convert it back to a resource. Instead of doing this, it will be better to directly transform the resource's underlying RNode and avoiding these conversions. Here is an implementation for a filter to do it. For now it is only handles simple cases, we can build on it after we have a simple version working.
Next steps would be to rewrite the replacement transformer plugin to use this filter, and move the plugin to the examples folder.