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: add limits and requests to PolicyServer #708

Merged
merged 6 commits into from Apr 9, 2024

Conversation

fabriziosestito
Copy link
Contributor

@fabriziosestito fabriziosestito commented Apr 5, 2024

Description

#710

Adds limits and requests field to the PolicyServer resource.
The fields are propagated to the PolicyServer deployment down to the running PolicyServer pods.

The PolicyServer webhook validates the fields and implements the default logic (if limits are specified and requests are left empty, the requests default to limits).

Testing

Integration tests and unit tests added

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

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

Project coverage is 51.48%. Comparing base (fd29429) to head (8363401).

Files Patch % Lines
pkg/apis/policies/v1/policyserver_webhook.go 83.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #708      +/-   ##
==========================================
+ Coverage   44.97%   51.48%   +6.51%     
==========================================
  Files          22       27       +5     
  Lines        1543     2049     +506     
==========================================
+ Hits          694     1055     +361     
- Misses        788      886      +98     
- Partials       61      108      +47     
Flag Coverage Δ
integration-tests 69.45% <ø> (?)
unit-tests 46.02% <86.20%> (+1.04%) ⬆️

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.

@fabriziosestito fabriziosestito self-assigned this Apr 5, 2024
@fabriziosestito fabriziosestito force-pushed the feat/limits-requests branch 5 times, most recently from f937ba3 to 61ae5b8 Compare April 8, 2024 07:09
@kkaempf kkaempf added this to the 1.12 milestone Apr 8, 2024
@fabriziosestito fabriziosestito marked this pull request as ready for review April 8, 2024 13:47
@fabriziosestito fabriziosestito requested a review from a team as a code owner April 8, 2024 13:47
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
@fabriziosestito fabriziosestito changed the title feat: add limits and requests feat: add limits and requests to PolicyServer Apr 8, 2024
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
pkg/apis/policies/v1/policyserver_webhook.go Show resolved Hide resolved
controllers/policyserver_controller_test.go Show resolved Hide resolved
controllers/policyserver_controller_test.go Show resolved Hide resolved
controllers/utils_test.go Show resolved Hide resolved
Comment on lines 127 to +128
!reflect.DeepEqual(originalDeployment.Spec.Template.Spec.Containers[0].Env, newDeployment.Spec.Template.Spec.Containers[0].Env) ||
!reflect.DeepEqual(originalDeployment.Spec.Template.Spec.Containers[0].Resources, newDeployment.Spec.Template.Spec.Containers[0].Resources) ||
Copy link
Member

Choose a reason for hiding this comment

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

This made me think... can we have 100% sure that the first container will be the policy server one? Cannot be the OPTEL collector sometimes?

If we are not sure about that, I think we should open an issue to investigate or maybe mitigate this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I would defer the changes here as we are probably going to refactor this by using controller-runtime CreateOrUpdate utilities in 1.13

Copy link
Member

@viccuad viccuad left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Copy link
Member

@flavio flavio 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
Member

@jvanz jvanz left a comment

Choose a reason for hiding this comment

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

As we discuss during the daily... LGTM

@flavio flavio merged commit 3c264c0 into kubewarden:main Apr 9, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants