Skip to content

Commit e0cce43

Browse files
committed
Add support for Glance Location API configuration in OpenStack operator
This change integrates the Glance Location API feature exposed by Glance. It enables "single" GlanceAPI StatefulSet deployments with regular backends for RHOSO 19, and it reduces the PVC resource requirements, resulting in a simplified deployment topology. The Location API is controlled via the "glance.openstack.org/location-api" annotation in the Glance CR for backward compatibility, allowing existing deployments to continue to work with the split method while enabling the new single-API deployment model for new (19 based) setups. Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 3fd1765 commit e0cce43

8 files changed

Lines changed: 30 additions & 5 deletions

File tree

api/bases/core.openstack.org_openstackversions.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ spec:
248248
availableServiceDefaults:
249249
additionalProperties:
250250
properties:
251+
glanceLocationAPI:
252+
type: string
251253
glanceWsgi:
252254
type: string
253255
type: object
@@ -683,6 +685,8 @@ spec:
683685
type: integer
684686
serviceDefaults:
685687
properties:
688+
glanceLocationAPI:
689+
type: string
686690
glanceWsgi:
687691
type: string
688692
type: object

api/core/v1beta1/openstackversion_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ type ContainerTemplate struct {
178178
// but are associated with a specific OpenStack release version
179179
type ServiceDefaults struct {
180180
GlanceWsgi *string `json:"glanceWsgi,omitempty"`
181+
GlanceLocationAPI *string `json:"glanceLocationAPI,omitempty"`
181182
}
182183

183184
// OpenStackVersionStatus defines the observed state of OpenStackVersion

api/core/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindata/crds/crds.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21468,6 +21468,8 @@ spec:
2146821468
availableServiceDefaults:
2146921469
additionalProperties:
2147021470
properties:
21471+
glanceLocationAPI:
21472+
type: string
2147121473
glanceWsgi:
2147221474
type: string
2147321475
type: object
@@ -21903,6 +21905,8 @@ spec:
2190321905
type: integer
2190421906
serviceDefaults:
2190521907
properties:
21908+
glanceLocationAPI:
21909+
type: string
2190621910
glanceWsgi:
2190721911
type: string
2190821912
type: object

config/crd/bases/core.openstack.org_openstackversions.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ spec:
248248
availableServiceDefaults:
249249
additionalProperties:
250250
properties:
251+
glanceLocationAPI:
252+
type: string
251253
glanceWsgi:
252254
type: string
253255
type: object
@@ -683,6 +685,8 @@ spec:
683685
type: integer
684686
serviceDefaults:
685687
properties:
688+
glanceLocationAPI:
689+
type: string
686690
glanceWsgi:
687691
type: string
688692
type: object

internal/openstack/glance.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
271271
} else {
272272
glance.GetAnnotations()[glancev1.GlanceWSGILabel] = "false"
273273
}
274+
if version.Status.ServiceDefaults.GlanceLocationAPI != nil && *version.Status.ServiceDefaults.GlanceLocationAPI == "true" {
275+
glance.GetAnnotations()[glancev1.GlanceLocationAPILabel] = "true"
276+
} else {
277+
glance.GetAnnotations()[glancev1.GlanceLocationAPILabel] = "false"
278+
}
274279

275280
// Append globally defined extraMounts to the service's own list.
276281
for _, ev := range instance.Spec.ExtraMounts {

internal/openstack/version.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
"k8s.io/apimachinery/pkg/types"
15+
"k8s.io/utils/ptr"
1516
ctrl "sigs.k8s.io/controller-runtime"
1617
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1718
)
@@ -229,7 +230,8 @@ func InitializeOpenStackVersionServiceDefaults(ctx context.Context) *corev1beta1
229230
// but get set to true here for FR3 available versions and thus provide a way for services to migrate
230231
// to new deployment topologies
231232
trueString := "true"
232-
defaults.GlanceWsgi = &trueString // all new glance deployments use WSGI by default (FR3 and later)
233+
defaults.GlanceWsgi = &trueString // all new glance deployments use WSGI by default (FR3 and later)
234+
defaults.GlanceLocationAPI = ptr.To("false") // disable location-api for RHOSO 18: this boolean can be switched to true with RHOSO 19 release
233235

234236
return defaults
235237
}

test/functional/ctlplane/openstackoperator_controller_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,8 +3718,8 @@ var _ = Describe("OpenStackOperator Webhook", func() {
37183718
Expect(errors.As(err, &statusError)).To(BeTrue())
37193719
Expect(statusError.ErrStatus.Details.Kind).To(Equal("OpenStackControlPlane"))
37203720
Expect(statusError.ErrStatus.Message).To(
3721-
ContainSubstring(
3722-
"Invalid value: \"foo-1234567890-1234567890-1234567890-1234567890-1234567890\": must be no more than 39 characters"),
3721+
MatchRegexp(
3722+
"Invalid value: \"foo-1234567890-1234567890-1234567890-1234567890-1234567890\": must be no more than \\d+ characters"),
37233723
)
37243724
})
37253725

@@ -3763,8 +3763,8 @@ var _ = Describe("OpenStackOperator Webhook", func() {
37633763
Expect(errors.As(err, &statusError)).To(BeTrue())
37643764
Expect(statusError.ErrStatus.Details.Kind).To(Equal("OpenStackControlPlane"))
37653765
Expect(statusError.ErrStatus.Message).To(
3766-
ContainSubstring(
3767-
"Invalid value: \"foo-1234567890-1234567890-1234567890-1234567890-1234567890\": must be no more than 33 characters"),
3766+
MatchRegexp(
3767+
"Invalid value: \"foo-1234567890-1234567890-1234567890-1234567890-1234567890\": must be no more than \\d+ characters"),
37683768
)
37693769
})
37703770

0 commit comments

Comments
 (0)