Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-2357

Update operators controller-runtime dependency

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Done
    • Icon: Blocker Blocker
    • rhos-18.0.0
    • None
    • None
    • None
    • Controller-runtime 0.16 update
    • False
    • Hide

      None

      Show
      None
    • False
    • OSPRH-811Red Hat OpenStack 18.0 Greenfield Deployment
    • Committed
    • No Docs Impact
    • To Do
    • OSPRH-811 - Red Hat OpenStack 18.0 Greenfield Deployment
    • Committed
    • No impact
    • 0% To Do, 0% In Progress, 100% Done
    • EDPM

       

      Description

      Issues introduce by k8s.io/* v0.27.x mean there are broken interfaces with controller-runtime as outlined here:
      https://github.com/kubernetes-sigs/controller-runtime/pull/2223

      This has since been fixed, but to upgrade controller-runtime, we have several methods within our operators that need to be updated. 

      • Webhooks must change their method signatures on:
      ValidateCreate()
      ValidateUpdate()
      ValidateDelete()

      These signatures now need to include `admission.Warnings` in the return values:
      https://github.com/kubernetes-sigs/controller-runtime/commit/8770b4d3b5425b156f48c971ee140ea25f9c1bfa#diff-0b6c79b3483fe5ad476ea26192f2d8bfe05a44688209721b626dc793204df28eR42

      https://github.com/kubernetes-sigs/controller-runtime/blob/30eae58f1b984c1b8139dd9b9f68dd2d530ed429/pkg/webhook/admission/validator.go#L36-L55

      Example update:
      https://github.com/openstack-k8s-operators/heat-operator/pull/283/commits/23a867bf5297be8a87079a1c76c85b70d1570dae#diff-679ec6f4dfb4f66a176174a183dd664de224980c68edc68cca76072eb70bf564R88-R108

      https://github.com/kubernetes-sigs/controller-runtime/commit/dc62ed5dadc6ea2d3e22546368b939a2db1edfb2

      Example change:
      https://github.com/openstack-k8s-operators/heat-operator/pull/283/commits/23a867bf5297be8a87079a1c76c85b70d1570dae#diff-dc46da6f97cbd197e2808f95d64e4a2c46acc2356aaad651ef772982aee38a72R280-R282

      Given the dependencies between each of the Operators, it appears all will hinge on MariaDB and Keystone being updated first. These PR's already exist:
      https://github.com/openstack-k8s-operators/mariadb-operator/pull/110
      https://github.com/openstack-k8s-operators/keystone-operator/pull/252

      Until then, the other operators will fail with the following complaints about the Validate*() interfaces:

      ❯ go vet ./...# github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1../../../go/pkg/mod/github.com/openstack-k8s-operators/mariadb-operator/api@v0.0.0-20230517052836-8478be8b3aaa/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.0.0-20230517052836-8478be8b3aaa/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.0.0-20230519193353-09694c267b18/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) 

       

      References:

      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

      Resolution steps

      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

       

            rhn-support-bshephar Brendan Shephard
            rhn-support-bshephar Brendan Shephard
            David Rosenfeld David Rosenfeld
            rhos-dfg-df
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: