kubewarden / kubewarden-controller

Manage admission policies in your Kubernetes cluster with ease
https://kubewarden.io
Apache License 2.0
181 stars 30 forks source link

refactor: policy server reconciler #785

Closed fabriziosestito closed 1 day ago

fabriziosestito commented 3 days ago

Description

This PR refactors the PolicyServerReconciler to encapsulate all the logic needed to reconcile a policy server. This means moving the related methods and utility functions from the admission.Reconciler "god class" to the PolicyServerReconciler controller.

It also removes the unit tests, superseded by the ginkgo-based integration tests. This drops the coverage by 1.70%, but re-adding the missing paths to the integration suite will be possible later.

Part of #773

codecov[bot] commented 3 days ago

Codecov Report

Attention: Patch coverage is 78.65169% with 38 lines in your changes missing coverage. Please review.

Project coverage is 72.02%. Comparing base (0915fa0) to head (529db12).

Files Patch % Lines
internal/controller/policyserver_controller.go 72.97% 22 Missing and 8 partials :warning:
...al/controller/policyserver_controller_ca_secret.go 53.84% 3 Missing and 3 partials :warning:
...al/controller/policyserver_controller_configmap.go 95.34% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #785 +/- ## ========================================== - Coverage 73.70% 72.02% -1.69% ========================================== Files 26 23 -3 Lines 1780 1705 -75 ========================================== - Hits 1312 1228 -84 - Misses 354 366 +12 + Partials 114 111 -3 ``` | [Flag](https://app.codecov.io/gh/kubewarden/kubewarden-controller/pull/785/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden) | Coverage Δ | | |---|---|---| | [integration-tests](https://app.codecov.io/gh/kubewarden/kubewarden-controller/pull/785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden) | `63.87% <78.65%> (+2.52%)` | :arrow_up: | | [unit-tests](https://app.codecov.io/gh/kubewarden/kubewarden-controller/pull/785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden) | `31.90% <ø> (-5.97%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.