From 654e8ebe6718258e5917bc03a53e12d7b3027c5d Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Tue, 29 Oct 2024 17:17:48 +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 ++-- api/v1beta1/heatapi_types.go | 2 +- api/v1beta1/heatcfnapi_types.go | 2 +- controllers/heatapi_controller.go | 14 +++++++------- controllers/heatcfnapi_controller.go | 14 +++++++------- go.mod | 2 +- go.sum | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/api/go.mod b/api/go.mod index e9b8c4e0..f5a51c7e 100644 --- a/api/go.mod +++ b/api/go.mod @@ -3,7 +3,7 @@ module github.com/openstack-k8s-operators/heat-operator/api go 1.21 require ( - github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb + github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241029151503-4878b3fa3333 k8s.io/api v0.29.10 k8s.io/apimachinery v0.29.10 sigs.k8s.io/controller-runtime v0.17.6 diff --git a/api/go.sum b/api/go.sum index 765f58d9..d772e597 100644 --- a/api/go.sum +++ b/api/go.sum @@ -72,8 +72,8 @@ github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb h1:hbHzQN4NiRJPLZ10ctnPPygmaFIxQyYovCfgp7e9K88= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs= +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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/api/v1beta1/heatapi_types.go b/api/v1beta1/heatapi_types.go index d0eece92..2da6c4fd 100644 --- a/api/v1beta1/heatapi_types.go +++ b/api/v1beta1/heatapi_types.go @@ -116,7 +116,7 @@ func init() { func (instance HeatAPI) StatusConditionsList() condition.Conditions { return condition.CreateList( condition.UnknownCondition(condition.ReadyCondition, condition.InitReason, condition.ReadyInitMessage), - condition.UnknownCondition(condition.ExposeServiceReadyCondition, condition.InitReason, condition.ExposeServiceReadyInitMessage), + condition.UnknownCondition(condition.CreateServiceReadyCondition, condition.InitReason, condition.CreateServiceReadyInitMessage), condition.UnknownCondition(condition.InputReadyCondition, condition.InitReason, condition.InputReadyInitMessage), condition.UnknownCondition(condition.ServiceConfigReadyCondition, condition.InitReason, condition.ServiceConfigReadyInitMessage), condition.UnknownCondition(condition.DeploymentReadyCondition, condition.InitReason, condition.DeploymentReadyInitMessage), diff --git a/api/v1beta1/heatcfnapi_types.go b/api/v1beta1/heatcfnapi_types.go index 371f8ccc..28241a16 100644 --- a/api/v1beta1/heatcfnapi_types.go +++ b/api/v1beta1/heatcfnapi_types.go @@ -117,7 +117,7 @@ func init() { func (instance *HeatCfnAPI) StatusConditionsList() condition.Conditions { return condition.CreateList( condition.UnknownCondition(condition.ReadyCondition, condition.InitReason, condition.ReadyInitMessage), - condition.UnknownCondition(condition.ExposeServiceReadyCondition, condition.InitReason, condition.ExposeServiceReadyInitMessage), + condition.UnknownCondition(condition.CreateServiceReadyCondition, condition.InitReason, condition.CreateServiceReadyInitMessage), condition.UnknownCondition(condition.InputReadyCondition, condition.InitReason, condition.InputReadyInitMessage), condition.UnknownCondition(condition.ServiceConfigReadyCondition, condition.InitReason, condition.ServiceConfigReadyInitMessage), condition.UnknownCondition(condition.DeploymentReadyCondition, condition.InitReason, condition.DeploymentReadyInitMessage), diff --git a/controllers/heatapi_controller.go b/controllers/heatapi_controller.go index aab599a2..5c57efc7 100644 --- a/controllers/heatapi_controller.go +++ b/controllers/heatapi_controller.go @@ -419,10 +419,10 @@ func (r *HeatAPIReconciler) 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 @@ -451,19 +451,19 @@ func (r *HeatAPIReconciler) 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 @@ -481,7 +481,7 @@ func (r *HeatAPIReconciler) reconcileInit( } } - instance.Status.Conditions.MarkTrue(condition.ExposeServiceReadyCondition, condition.ExposeServiceReadyMessage) + instance.Status.Conditions.MarkTrue(condition.CreateServiceReadyCondition, condition.CreateServiceReadyMessage) // expose service - end diff --git a/controllers/heatcfnapi_controller.go b/controllers/heatcfnapi_controller.go index b5c495f2..72904fc9 100644 --- a/controllers/heatcfnapi_controller.go +++ b/controllers/heatcfnapi_controller.go @@ -421,10 +421,10 @@ func (r *HeatCfnAPIReconciler) 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 @@ -453,19 +453,19 @@ func (r *HeatCfnAPIReconciler) 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 @@ -483,7 +483,7 @@ func (r *HeatCfnAPIReconciler) reconcileInit( } } - instance.Status.Conditions.MarkTrue(condition.ExposeServiceReadyCondition, condition.ExposeServiceReadyMessage) + instance.Status.Conditions.MarkTrue(condition.CreateServiceReadyCondition, condition.CreateServiceReadyMessage) // expose service - end diff --git a/go.mod b/go.mod index 656ec05a..803deaaa 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240214134649-6643d1b09d49 github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241024081600-3e23dc62002c github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241028071533-ae2b9a574fda - github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb + 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.20241028071009-a8404d0ab6bb github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241028071009-a8404d0ab6bb github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241028074300-17b2cf83d27e diff --git a/go.sum b/go.sum index 1ff81426..ea70654c 100644 --- a/go.sum +++ b/go.sum @@ -81,8 +81,8 @@ github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241024081600-3 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/keystone-operator/api v0.5.1-0.20241028071533-ae2b9a574fda h1:aCBLS8MvLJhiOOVyYcukaReeqM01c26eKjRI2w29FWI= github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241028071533-ae2b9a574fda/go.mod h1:llI4Qbt8Rj9sWLpkY32u3UJBh1tFKPiS1RGgBaYVq/g= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb h1:hbHzQN4NiRJPLZ10ctnPPygmaFIxQyYovCfgp7e9K88= -github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241028071009-a8404d0ab6bb/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs= +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.20241028071009-a8404d0ab6bb h1:kcXt7azDv8c5Bdu46u0nBmhGDMaX/bJrtiYhNSLxRDg= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20241028071009-a8404d0ab6bb/go.mod h1:IASoGvp5QM/tBJUd/8i8uIjj4DBnI+64Ydh4r7pmnvA= github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241028071009-a8404d0ab6bb h1:YgSMEU/uEx9k1LVt4nnlumV37pXMCgOxi7dHDMwT6q8=