Skip to content

Add name to match criteria#1542

Merged
julianKatz merged 17 commits into
open-policy-agent:masterfrom
julianKatz:add-name-to-match-criteria-1402
Sep 17, 2021
Merged

Add name to match criteria#1542
julianKatz merged 17 commits into
open-policy-agent:masterfrom
julianKatz:add-name-to-match-criteria-1402

Conversation

@julianKatz
Copy link
Copy Markdown
Contributor

In #1402, a user sought to modify an object of a specific name.
Previously, there was no way to do this. The user attempted to use
assignIf against metadata.name, but assignIf only allows a mutation to
check against the current value of the field to be mutated.

This PR adds exact name matching support, as well as prefix-based glob
matching.

Contributes to #1402

Signed-off-by: juliankatz juliankatz@google.com

Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
… add-name-to-match-criteria-1402

Signed-off-by: juliankatz <juliankatz@google.com>
In open-policy-agent#1402, a user sought to modify an object of a specific name.
Previously, there was no way to do this.  The user attempted to use
assignIf against metadata.name, but assignIf only allows a mutation to
check against the current value of the field to be mutated.

This PR adds exact name matching support, as well as prefix-based glob
matching.

Contributes to open-policy-agent#1402

Signed-off-by: juliankatz <juliankatz@google.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 8, 2021

Codecov Report

Merging #1542 (421aa72) into master (97e3ae5) will decrease coverage by 0.23%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1542      +/-   ##
==========================================
- Coverage   52.35%   52.12%   -0.24%     
==========================================
  Files          86       86              
  Lines        7844     7854      +10     
==========================================
- Hits         4107     4094      -13     
- Misses       3387     3403      +16     
- Partials      350      357       +7     
Flag Coverage Δ
unittests 52.12% <89.47%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/mutation/match/zz_generated.deepcopy.go 0.00% <0.00%> (ø)
pkg/mutation/match/match.go 84.17% <100.00%> (+0.41%) ⬆️
pkg/target/target.go 66.89% <100.00%> (+0.69%) ⬆️
pkg/readiness/list.go 79.41% <0.00%> (-11.77%) ⬇️
...onstrainttemplate/constrainttemplate_controller.go 52.63% <0.00%> (-2.88%) ⬇️
pkg/watch/replay.go 78.97% <0.00%> (-2.28%) ⬇️
pkg/controller/config/config_controller.go 65.33% <0.00%> (-1.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97e3ae5...421aa72. Read the comment docs.

Copy link
Copy Markdown
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM!

@julianKatz julianKatz changed the title Add name to match criteria 1402 Add name to match criteria Sep 9, 2021
… add-name-to-match-criteria-1402

Signed-off-by: juliankatz <juliankatz@google.com>
Comment thread config/crd/bases/mutations.gatekeeper.sh_assign.yaml
Comment thread pkg/target/regolib/src.rego
… add-name-to-match-criteria-1402

Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
…valid

Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Comment thread website/docs/howto.md Outdated
Copy link
Copy Markdown
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

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

One nit, otherwise, LGTM

@julianKatz julianKatz force-pushed the add-name-to-match-criteria-1402 branch from 3d00dd1 to 421aa72 Compare September 17, 2021 01:24
@julianKatz julianKatz merged commit a7373bb into open-policy-agent:master Sep 17, 2021
@julianKatz julianKatz deleted the add-name-to-match-criteria-1402 branch September 17, 2021 01:34
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.

5 participants