Skip to content
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

feat: implement cleanup policy matching #5614

Merged
merged 11 commits into from
Dec 8, 2022

Conversation

eddycharly
Copy link
Member

Explanation

This PR implements cleanup policy matching against resources

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@eddycharly eddycharly marked this pull request as ready for review December 7, 2022 16:35
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
api/kyverno/v1alpha1/cleanup_policy_types.go Show resolved Hide resolved
cmd/cleanup-controller/handlers/cleanup/handlers.go Outdated Show resolved Hide resolved
cmd/cleanup-controller/handlers/cleanup/match.go Outdated Show resolved Hide resolved
if resourceName == "" {
resourceName = resource.GetGenerateName()
}
if conditionBlock.Name != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Is name also deprecated?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it ?

Copy link
Member

Choose a reason for hiding this comment

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

I remember name is deprecated and will be replaced by names, but I don't find the deprecation label on this field.

}
}
}
// keys := append(admissionInfo.AdmissionUserInfo.Groups, admissionInfo.AdmissionUserInfo.Username)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why commenting out userInfo related logic. If we don't have it supported in this PR, would be good to remove them.

Copy link
Member Author

Choose a reason for hiding this comment

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

We just can't support admission related criterias at this point.

eddycharly and others added 3 commits December 7, 2022 18:00
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
realshuting
realshuting previously approved these changes Dec 8, 2022
api/kyverno/v1alpha1/cleanup_policy_types.go Show resolved Hide resolved
eddycharly and others added 2 commits December 8, 2022 09:47
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #5614 (e682d8b) into main (acc2089) will decrease coverage by 0.09%.
The diff coverage is 3.84%.

@@            Coverage Diff             @@
##             main    #5614      +/-   ##
==========================================
- Coverage   36.47%   36.38%   -0.10%     
==========================================
  Files         174      174              
  Lines       19254    19157      -97     
==========================================
- Hits         7023     6970      -53     
+ Misses      11440    11407      -33     
+ Partials      791      780      -11     
Impacted Files Coverage Δ
api/kyverno/v1/common_types.go 0.00% <0.00%> (ø)
api/kyverno/v1/resource_description_types.go 53.33% <0.00%> (-19.40%) ⬇️
api/kyverno/v1/user_info_types.go 64.28% <0.00%> (-10.72%) ⬇️
api/kyverno/v1alpha1/zz_generated.deepcopy.go 0.00% <0.00%> (ø)
api/kyverno/v1alpha1/cleanup_policy_types.go 53.84% <20.00%> (+5.34%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eddycharly eddycharly merged commit f5adb50 into kyverno:main Dec 8, 2022
@eddycharly eddycharly deleted the cleanup-match branch December 8, 2022 10:31
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Dec 29, 2022
* chore: bump a couple of deps

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* feat: implement cleanup policy matching

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* delete

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* check namespace

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* ns labels

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* review

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Md Sahil <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* chore: bump a couple of deps

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* feat: implement cleanup policy matching

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* delete

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* check namespace

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* ns labels

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* review

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* chore: bump a couple of deps

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* feat: implement cleanup policy matching

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* delete

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* check namespace

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* ns labels

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* review

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants