kubewarden / kubewarden-controller

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

refactor: use helper from controller runtime #725

Closed flavio closed 1 month ago

flavio commented 2 months ago

Use a more concise way to handle "not found" errors that is made possible by using a controller runtime helper.

codecov[bot] commented 2 months ago

Codecov Report

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

Project coverage is 71.78%. Comparing base (9c3dd61) to head (783f2bd).

Files Patch % Lines
internal/pkg/admission/policy-server-ca-secret.go 0.00% 3 Missing :warning:
...g/admission/policy-server-pod-disruption-budget.go 0.00% 3 Missing :warning:
controllers/admissionpolicy_controller.go 0.00% 1 Missing :warning:
internal/pkg/admission/policy-server-configmap.go 0.00% 1 Missing :warning:
internal/pkg/admission/policy-server-deployment.go 0.00% 1 Missing :warning:
internal/pkg/admission/policy-server-service.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #725 +/- ## ========================================== - Coverage 72.84% 71.78% -1.07% ========================================== Files 28 28 Lines 1812 1804 -8 ========================================== - Hits 1320 1295 -25 - Misses 373 388 +15 - Partials 119 121 +2 ``` | [Flag](https://app.codecov.io/gh/kubewarden/kubewarden-controller/pull/725/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/725/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden) | `59.42% <45.00%> (-1.29%)` | :arrow_down: | | [unit-tests](https://app.codecov.io/gh/kubewarden/kubewarden-controller/pull/725/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kubewarden) | `50.11% <20.00%> (-0.08%)` | :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.

flavio commented 2 months ago

@jvanz, @viccuad : I've updated golanglint-ci and then fixed all the warnings via 8d936333779b11f9cb2f1314341325b0f3af80a3. Please take a look at the commit description to see the reasons of the changes I've made

flavio commented 2 months ago

Note: this cannot be merged until the 1.12 release is done

jvanz commented 2 months ago

It seems there is something wrong, because tests and linter are failing. =(

flavio commented 1 month ago

@jvanz I'm a bit stuck with other tasks, would you be so kind to take this over once your PR about the owner reference is merged? :pray:

jvanz commented 1 month ago

@kubewarden/kubewarden-developers , I've updated this PR rebasing it on top of main and did some fixes to make the CI happy. To make all our CI green I had to update the controller-gen binary used. Otherwise, we get a nil pointer deref. That's why you can see so many line changes, I've commited the result of the generator after updating it. Let me know if you're fine with that. Otherwise, I can update the generator in another PR or commit the updated manifest files in another PR.

jvanz commented 1 month ago

@kubewarden/kubewarden-developers I've updated this branch rebasing it on top of main and squashing some commits to reduce the number of them.