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

Make use of the controller-runtime helper function to create and update resources #723

Closed jvanz closed 1 month ago

jvanz commented 2 months ago

Currently in the controller we wrote code to detect if policy server resource should be create and/or updated. However, this is not necessary because the controller-runtime package has a helper function that does that for us. Therefore, we shoud use and simplify our code. Which makes our life easier in the longer run because we do not need to keep track of the fields that should trigger a resource update.

@kubewarden/kubewarden-developers this is block due an issue in the upgrade process of the controller. As we discussed during one of our daily, I'll work on code to use the createOrUpdate helper function from the controller-runtime package to simplify our code and workaround this.

Originally posted by @jvanz in #660

Acceptance criteria

jvanz commented 2 months ago

I'm moving this to block until @flavio is able to review the PR as well.