-
Story
-
Resolution: Done
-
Undefined
-
None
-
None
-
None
The controller-runtime version needs to be bumped to 0.16 to allow for k8s.io/* dependencies to be updated.
This change will involve all operators under the OKO project as all will have dependencies on other operators within the project. As an example, when doing this for for the dataplane-operator, we can see go vet failing on multiple other operators:
❯ go vet ./...# github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1../../../go/pkg/mod/github.com/openstack-k8s-operators/infra-operator/apis@v0.3.1-0.20231122104142-3b449040167e/memcached/v1beta1/memcached_webhook.go:76:27: cannot use &Memcached{} (value of type *Memcached) as admission.Validator value in variable declaration: *Memcached does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error)# github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1../../../go/pkg/mod/github.com/openstack-k8s-operators/mariadb-operator/api@v0.3.0/v1beta1/galera_webhook.go:57:27: cannot use &Galera{} (value of type *Galera) as admission.Validator value in variable declaration: *Galera does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error)../../../go/pkg/mod/github.com/openstack-k8s-operators/mariadb-operator/api@v0.3.0/v1beta1/mariadb_webhook.go:70:27: cannot use &MariaDB{} (value of type *MariaDB) as admission.Validator value in variable declaration: *MariaDB does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error)# github.com/openstack-k8s-operators/keystone-operator/api/v1beta1../../../go/pkg/mod/github.com/openstack-k8s-operators/keystone-operator/api@v0.3.1-0.20231128185906-0b4579c3dadf/v1beta1/keystoneapi_webhook.go:76:27: cannot use &KeystoneAPI{} (value of type *KeystoneAPI) as admission.Validator value in variable declaration: *KeystoneAPI does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error)
There are several breaking changes in v0.15.0:
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0
And v0.16.0:
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.16.0
Namely:
1. We need to update the web hooks to comply with the new interface definition:
https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/webhook/admission/validator.go#L33-L53
2. We need to initialise the manager with the new structs:
https://github.com/kubernetes-sigs/controller-runtime/pull/2407/files
3. The webhook needs to be initialised following the new format:
https://github.com/kubernetes-sigs/controller-runtime/pull/2422/files
I have captured some rudimentary examples of what is required in the following 3 commits:
https://github.com/openstack-k8s-operators/heat-operator/pull/127