Skip to content

Commit 542f3b6

Browse files
committed
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 Signed-off-by: Martin Schuppert <[email protected]>
1 parent 270dd04 commit 542f3b6

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

api/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ require (
6767
// mschuppert: map to latest commit from release-4.16 tag
6868
// must consistent within modules and service operators
6969
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 //allow-merging
70+
71+
replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo
7272
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
7373
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7474
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
75-
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20241014140317-e5c35d28f3af h1:MNNuYPfaXWf14lfsWGay3WjLjIIu9KN5+iHrLdCMQac=
76-
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20241014140317-e5c35d28f3af/go.mod h1:EKfyFMU2brJYqR4M2Hwfo5ZLBQxAJXAYfHjpdqX6N5g=
7775
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
7876
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
7977
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -94,6 +92,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
9492
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
9593
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
9694
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
95+
github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a h1:EwM7cE7V0YTs4CczUe6vI9ZQl6Yo7dVWeLG5w4M//eE=
96+
github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a/go.mod h1:tNeup9Xl7j2eaeMslJ/rt59NNEAw7ATf6RuebS/YkSk=
9797
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
9898
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
9999
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=

controllers/placementapi_controller.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ func (r *PlacementAPIReconciler) ensureServiceExposed(
534534
)
535535
if err != nil {
536536
instance.Status.Conditions.Set(condition.FalseCondition(
537-
condition.ExposeServiceReadyCondition,
537+
condition.CreateServiceReadyCondition,
538538
condition.ErrorReason,
539539
condition.SeverityWarning,
540-
condition.ExposeServiceReadyErrorMessage,
540+
condition.CreateServiceReadyErrorMessage,
541541
err.Error()))
542542

543543
return apiEndpoints, ctrl.Result{}, err
@@ -566,19 +566,19 @@ func (r *PlacementAPIReconciler) ensureServiceExposed(
566566
ctrlResult, err := svc.CreateOrPatch(ctx, h)
567567
if err != nil {
568568
instance.Status.Conditions.Set(condition.FalseCondition(
569-
condition.ExposeServiceReadyCondition,
569+
condition.CreateServiceReadyCondition,
570570
condition.ErrorReason,
571571
condition.SeverityWarning,
572-
condition.ExposeServiceReadyErrorMessage,
572+
condition.CreateServiceReadyErrorMessage,
573573
err.Error()))
574574

575575
return apiEndpoints, ctrlResult, err
576576
} else if (ctrlResult != ctrl.Result{}) {
577577
instance.Status.Conditions.Set(condition.FalseCondition(
578-
condition.ExposeServiceReadyCondition,
578+
condition.CreateServiceReadyCondition,
579579
condition.RequestedReason,
580580
condition.SeverityInfo,
581-
condition.ExposeServiceReadyRunningMessage))
581+
condition.CreateServiceReadyRunningMessage))
582582
return apiEndpoints, ctrlResult, nil
583583
}
584584
// create service - end
@@ -596,7 +596,7 @@ func (r *PlacementAPIReconciler) ensureServiceExposed(
596596
}
597597
}
598598

599-
instance.Status.Conditions.MarkTrue(condition.ExposeServiceReadyCondition, condition.ExposeServiceReadyMessage)
599+
instance.Status.Conditions.MarkTrue(condition.CreateServiceReadyCondition, condition.CreateServiceReadyMessage)
600600
return apiEndpoints, ctrl.Result{}, nil
601601
}
602602

@@ -747,9 +747,9 @@ func (r *PlacementAPIReconciler) initConditions(
747747
condition.DBSyncReadyInitMessage,
748748
),
749749
condition.UnknownCondition(
750-
condition.ExposeServiceReadyCondition,
750+
condition.CreateServiceReadyCondition,
751751
condition.InitReason,
752-
condition.ExposeServiceReadyInitMessage,
752+
condition.CreateServiceReadyInitMessage,
753753
),
754754
condition.UnknownCondition(
755755
condition.InputReadyCondition,

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,5 @@ replace github.com/openstack-k8s-operators/placement-operator/api => ./api
8686
// mschuppert: map to latest commit from release-4.16 tag
8787
// must consistent within modules and service operators
8888
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 //allow-merging
89+
90+
replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6
7979
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
8080
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20241018180515-61e711f07467 h1:AJVVQrnWg2o/dVOgu++oHBMFxFe27R/a52qGGjxviRc=
8181
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20241018180515-61e711f07467/go.mod h1:saoorrsPo3DzDPGM6PJ8sQJBNuNRGCHjRHChRQmkoQ0=
82-
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20241014140317-e5c35d28f3af h1:MNNuYPfaXWf14lfsWGay3WjLjIIu9KN5+iHrLdCMQac=
83-
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20241014140317-e5c35d28f3af/go.mod h1:EKfyFMU2brJYqR4M2Hwfo5ZLBQxAJXAYfHjpdqX6N5g=
8482
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20241014140317-e5c35d28f3af h1:fevDUHmqcnI4wDTKupKe/CcgVdgNpZXWkJx8u0/xEXs=
8583
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20241014140317-e5c35d28f3af/go.mod h1:djfljx3jfHqywhY3oDvPg/GLKwiFVkds6v7P7/Yg+8g=
8684
github.com/openstack-k8s-operators/lib-common/modules/test v0.4.1-0.20241014140317-e5c35d28f3af h1:u5yJ/rV9VBMjKIcsu16/3rhiPcBxZN2sPqxnZHoRrNc=
@@ -107,6 +105,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
107105
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
108106
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
109107
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
108+
github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a h1:EwM7cE7V0YTs4CczUe6vI9ZQl6Yo7dVWeLG5w4M//eE=
109+
github.com/stuggi/lib-common/modules/common v0.0.0-20241024081204-572296943a4a/go.mod h1:tNeup9Xl7j2eaeMslJ/rt59NNEAw7ATf6RuebS/YkSk=
110110
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
111111
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
112112
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=

tests/functional/placementapi_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ var _ = Describe("PlacementAPI controller", func() {
114114
unknownConditions := []condition.Type{
115115
condition.DBReadyCondition,
116116
condition.DBSyncReadyCondition,
117-
condition.ExposeServiceReadyCondition,
117+
condition.CreateServiceReadyCondition,
118118
condition.ServiceConfigReadyCondition,
119119
condition.DeploymentReadyCondition,
120120
condition.KeystoneServiceReadyCondition,
@@ -510,7 +510,7 @@ var _ = Describe("PlacementAPI controller", func() {
510510
th.ExpectCondition(
511511
names.PlacementAPIName,
512512
ConditionGetterFunc(PlacementConditionGetter),
513-
condition.ExposeServiceReadyCondition,
513+
condition.CreateServiceReadyCondition,
514514
corev1.ConditionUnknown,
515515
)
516516

@@ -532,7 +532,7 @@ var _ = Describe("PlacementAPI controller", func() {
532532
th.ExpectCondition(
533533
names.PlacementAPIName,
534534
ConditionGetterFunc(PlacementConditionGetter),
535-
condition.ExposeServiceReadyCondition,
535+
condition.CreateServiceReadyCondition,
536536
corev1.ConditionTrue,
537537
)
538538
})

tests/kuttl/common/assert_sample_deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ status:
3636
reason: Ready
3737
status: "True"
3838
type: DeploymentReady
39-
- message: Exposing service completed
39+
- message: Create service completed
4040
reason: Ready
4141
status: "True"
42-
type: ExposeServiceReady
42+
type: CreateServiceReady
4343
- message: Input data complete
4444
reason: Ready
4545
status: "True"

tests/kuttl/tests/placement_deploy_tls/03-assert.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ status:
4343
reason: Ready
4444
status: "True"
4545
type: DeploymentReady
46-
- message: Exposing service completed
46+
- message: Create service completed
4747
reason: Ready
4848
status: "True"
49-
type: ExposeServiceReady
49+
type: CreateServiceReady
5050
- message: Input data complete
5151
reason: Ready
5252
status: "True"

0 commit comments

Comments
 (0)