From e482fefd3c0b19d1e2e30665ae342a721a39ffbb Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Tue, 29 Oct 2024 17:29:49 +0100 Subject: [PATCH] Switch to use new CreateServiceReadyCondition The current ExposeServiceReadyCondition can be confusing since it just reflects if the k8s service got created, but not the route to expose the public endpoint. This changes to a new CreateServiceReadyCondition to prevent this. Jira: OSPRH-4164 Depends-On: https://github.com/openstack-k8s-operators/lib-common/pull/572 Signed-off-by: Martin Schuppert --- api/go.mod | 2 +- api/go.sum | 4 ++-- controllers/keystoneapi_controller.go | 16 ++++++++-------- go.mod | 2 +- go.sum | 4 ++-- tests/functional/keystoneapi_controller_test.go | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/api/go.mod b/api/go.mod index 8ae88393..7822564e 100644 --- a/api/go.mod +++ b/api/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/uuid v1.6.0 github.com/gophercloud/gophercloud v1.14.1 github.com/onsi/gomega v1.34.1 - github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1 + github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333 github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1 github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241025164019-30baa23bf6f1 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 diff --git a/api/go.sum b/api/go.sum index 53c0a401..a16a7b7f 100644 --- a/api/go.sum +++ b/api/go.sum @@ -79,8 +79,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1 h1:D4H+BMVKTjgYWptCBs7Qt0rk0K/H8PnjJKoMlozoQ4g= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1/go.mod h1:tNeup9Xl7j2eaeMslJ/rt59NNEAw7ATf6RuebS/YkSk= +github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333 h1:yejekTWudX5af3mCJQ1MUPLEa0X6sIsklf07o9KilRk= +github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1 h1:k5aZEt+xNGZXvEYs02FC2nL0I6QLgsWOsDOGwgiQh2E= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1/go.mod h1:djfljx3jfHqywhY3oDvPg/GLKwiFVkds6v7P7/Yg+8g= github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241025164019-30baa23bf6f1 h1:7tlv11dDu2fKxjhbEtrjNAPRE7q0FfmCNX0sxOKdMJs= diff --git a/controllers/keystoneapi_controller.go b/controllers/keystoneapi_controller.go index 6c08ed5c..50f232eb 100644 --- a/controllers/keystoneapi_controller.go +++ b/controllers/keystoneapi_controller.go @@ -195,7 +195,7 @@ func (r *KeystoneAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) condition.UnknownCondition(condition.DBSyncReadyCondition, condition.InitReason, condition.DBSyncReadyInitMessage), condition.UnknownCondition(condition.RabbitMqTransportURLReadyCondition, condition.InitReason, condition.RabbitMqTransportURLReadyInitMessage), condition.UnknownCondition(condition.MemcachedReadyCondition, condition.InitReason, condition.MemcachedReadyInitMessage), - condition.UnknownCondition(condition.ExposeServiceReadyCondition, condition.InitReason, condition.ExposeServiceReadyInitMessage), + condition.UnknownCondition(condition.CreateServiceReadyCondition, condition.InitReason, condition.CreateServiceReadyInitMessage), condition.UnknownCondition(condition.BootstrapReadyCondition, condition.InitReason, condition.BootstrapReadyInitMessage), condition.UnknownCondition(condition.InputReadyCondition, condition.InitReason, condition.InputReadyInitMessage), condition.UnknownCondition(condition.ServiceConfigReadyCondition, condition.InitReason, condition.ServiceConfigReadyInitMessage), @@ -558,10 +558,10 @@ func (r *KeystoneAPIReconciler) reconcileInit( ) if err != nil { instance.Status.Conditions.Set(condition.FalseCondition( - condition.ExposeServiceReadyCondition, + condition.CreateServiceReadyCondition, condition.ErrorReason, condition.SeverityWarning, - condition.ExposeServiceReadyErrorMessage, + condition.CreateServiceReadyErrorMessage, err.Error())) return ctrl.Result{}, err @@ -590,19 +590,19 @@ func (r *KeystoneAPIReconciler) reconcileInit( ctrlResult, err := svc.CreateOrPatch(ctx, helper) if err != nil { instance.Status.Conditions.Set(condition.FalseCondition( - condition.ExposeServiceReadyCondition, + condition.CreateServiceReadyCondition, condition.ErrorReason, condition.SeverityWarning, - condition.ExposeServiceReadyErrorMessage, + condition.CreateServiceReadyErrorMessage, err.Error())) return ctrlResult, err } else if (ctrlResult != ctrl.Result{}) { instance.Status.Conditions.Set(condition.FalseCondition( - condition.ExposeServiceReadyCondition, + condition.CreateServiceReadyCondition, condition.RequestedReason, condition.SeverityInfo, - condition.ExposeServiceReadyRunningMessage)) + condition.CreateServiceReadyRunningMessage)) return ctrlResult, nil } // create service - end @@ -620,7 +620,7 @@ func (r *KeystoneAPIReconciler) reconcileInit( } } - instance.Status.Conditions.MarkTrue(condition.ExposeServiceReadyCondition, condition.ExposeServiceReadyMessage) + instance.Status.Conditions.MarkTrue(condition.CreateServiceReadyCondition, condition.CreateServiceReadyMessage) // // Update instance status with service endpoint url from route host information diff --git a/go.mod b/go.mod index cd4f2199..e1d0e157 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/onsi/gomega v1.34.1 github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241024081600-3e23dc62002c github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240213125925-e40975f3db7e - github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1 + github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333 github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1 github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241025164019-30baa23bf6f1 github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0 diff --git a/go.sum b/go.sum index 0ca8fa1e..549e184a 100644 --- a/go.sum +++ b/go.sum @@ -79,8 +79,8 @@ github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6 github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241024081600-3e23dc62002c h1:/TXY/Hux6hfDEx5KIWQIMx7IKs2no4Pa/TsTVKDuLkw= github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241024081600-3e23dc62002c/go.mod h1:J9oUh3eGBvAFfyUMiPxPRBSxAcO8rnwITN4RTh/It+8= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1 h1:D4H+BMVKTjgYWptCBs7Qt0rk0K/H8PnjJKoMlozoQ4g= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241025164019-30baa23bf6f1/go.mod h1:tNeup9Xl7j2eaeMslJ/rt59NNEAw7ATf6RuebS/YkSk= +github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333 h1:yejekTWudX5af3mCJQ1MUPLEa0X6sIsklf07o9KilRk= +github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1 h1:k5aZEt+xNGZXvEYs02FC2nL0I6QLgsWOsDOGwgiQh2E= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241025164019-30baa23bf6f1/go.mod h1:djfljx3jfHqywhY3oDvPg/GLKwiFVkds6v7P7/Yg+8g= github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241025164019-30baa23bf6f1 h1:7tlv11dDu2fKxjhbEtrjNAPRE7q0FfmCNX0sxOKdMJs= diff --git a/tests/functional/keystoneapi_controller_test.go b/tests/functional/keystoneapi_controller_test.go index d8fdab16..905b0341 100644 --- a/tests/functional/keystoneapi_controller_test.go +++ b/tests/functional/keystoneapi_controller_test.go @@ -141,7 +141,7 @@ var _ = Describe("Keystone controller", func() { condition.ServiceConfigReadyCondition, condition.DBReadyCondition, condition.DBSyncReadyCondition, - condition.ExposeServiceReadyCondition, + condition.CreateServiceReadyCondition, condition.BootstrapReadyCondition, condition.DeploymentReadyCondition, condition.NetworkAttachmentsReadyCondition, @@ -465,7 +465,7 @@ var _ = Describe("Keystone controller", func() { th.ExpectCondition( keystoneAPIName, ConditionGetterFunc(KeystoneConditionGetter), - condition.ExposeServiceReadyCondition, + condition.CreateServiceReadyCondition, corev1.ConditionTrue, ) th.ExpectCondition(