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: adding scopedenforcementactions #403

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

JaydipGabani
Copy link
Contributor

@JaydipGabani JaydipGabani commented Mar 13, 2024

This PR implements changes for multi ea/ep design

For gatekeeper changes and CI tests refer to PR gatekeeper/3321

Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
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.

Nice! A few comments, but looking good.

constraint/pkg/apis/constraints/apis.go Outdated Show resolved Hide resolved
constraint/pkg/apis/constraints/apis.go Show resolved Hide resolved
constraint/pkg/apis/constraints/apis.go Outdated Show resolved Hide resolved
constraint/pkg/client/client.go Outdated Show resolved Hide resolved
constraint/pkg/client/client.go Show resolved Hide resolved
val = append(val, &types.Result{
Msg: r.error.Error(),
Constraint: r.constraint,
EnforcementAction: action,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably just update EnforcementAction to be an array, otherwise we use RAM storing duplicate messages.

constraint/pkg/client/drivers/k8scel/driver.go Outdated Show resolved Hide resolved
constraint/pkg/client/drivers/rego/driver.go Outdated Show resolved Hide resolved
constraint/pkg/client/drivers/to_result.go Outdated Show resolved Hide resolved
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 83.90805% with 42 lines in your changes are missing coverage. Please review.

Project coverage is 53.93%. Comparing base (76869f8) to head (e054366).
Report is 13 commits behind head on master.

Files Patch % Lines
constraint/pkg/apis/constraints/apis.go 60.71% 16 Missing and 6 partials ⚠️
...onstraint/pkg/client/clienttest/cts/constraints.go 83.33% 4 Missing and 2 partials ⚠️
...lient/drivers/k8scel/transform/make_vap_objects.go 83.87% 4 Missing and 1 partial ⚠️
constraint/pkg/client/constraint_client.go 80.00% 2 Missing and 1 partial ⚠️
constraint/pkg/client/template_client.go 85.71% 2 Missing and 1 partial ⚠️
constraint/pkg/types/validation.go 0.00% 2 Missing ⚠️
constraint/pkg/client/clienttest/client.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #403      +/-   ##
==========================================
- Coverage   54.68%   53.93%   -0.75%     
==========================================
  Files          71      104      +33     
  Lines        5241     6726    +1485     
==========================================
+ Hits         2866     3628     +762     
- Misses       2073     2729     +656     
- Partials      302      369      +67     
Flag Coverage Δ
unittests 53.93% <83.90%> (-0.75%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JaydipGabani
Copy link
Contributor Author

@maxsmythe Sorry for the delay. I have addressed all the comments and implemented the feedback. PTAL.

Signed-off-by: Jaydipkumar Arvindbhai Gabani <gabanijaydip@gmail.com>
Copy link
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.

No worries! Sorry for the delay on my end. Getting close!

constraint/pkg/apis/constraints/apis.go Outdated Show resolved Hide resolved
constraint/pkg/apis/constraints/apis.go Show resolved Hide resolved
constraint/pkg/client/client.go Outdated Show resolved Hide resolved
constraint/pkg/client/client_opts.go Outdated Show resolved Hide resolved
if err != nil {
return nil, err
}
if len(actionsForEP[apiconstraints.WebhookEnforcementPoint]) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should VAP be its own enforcement point?

Copy link
Member

Choose a reason for hiding this comment

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

that makes sense and the actions will be mapped as: deny, warn, audit as part of the generated vap resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does enforcementPoints validation.gatekeeper.sh -> gatekeeper webhook & admission.k8s.io -> VAP work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe? Probably best to bikeshed on naming at the community meeting. Admission webhooks are their own concept in K8s, IIRC.

vap.k8s.io?

Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
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.

None yet

5 participants