Skip to content

Commit ca4105c

Browse files
Merge pull request #1841 from fmount/location-api
Add support for Glance Location API configuration in OpenStack operator
2 parents 4e1f4fb + a0fdac5 commit ca4105c

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
rabbitmqVersion:
@@ -685,6 +687,8 @@ spec:
685687
type: integer
686688
serviceDefaults:
687689
properties:
690+
glanceLocationAPI:
691+
type: string
688692
glanceWsgi:
689693
type: string
690694
rabbitmqVersion:

api/core/v1beta1/openstackversion_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ type ContainerTemplate struct {
179179
type ServiceDefaults struct {
180180
GlanceWsgi *string `json:"glanceWsgi,omitempty"`
181181
RabbitmqVersion *string `json:"rabbitmqVersion,omitempty"`
182+
GlanceLocationAPI *string `json:"glanceLocationAPI,omitempty"`
182183
}
183184

184185
// 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
@@ -21474,6 +21474,8 @@ spec:
2147421474
availableServiceDefaults:
2147521475
additionalProperties:
2147621476
properties:
21477+
glanceLocationAPI:
21478+
type: string
2147721479
glanceWsgi:
2147821480
type: string
2147921481
rabbitmqVersion:
@@ -21911,6 +21913,8 @@ spec:
2191121913
type: integer
2191221914
serviceDefaults:
2191321915
properties:
21916+
glanceLocationAPI:
21917+
type: string
2191421918
glanceWsgi:
2191521919
type: string
2191621920
rabbitmqVersion:

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
rabbitmqVersion:
@@ -685,6 +687,8 @@ spec:
685687
type: integer
686688
serviceDefaults:
687689
properties:
690+
glanceLocationAPI:
691+
type: string
688692
glanceWsgi:
689693
type: string
690694
rabbitmqVersion:

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
@@ -11,6 +11,7 @@ import (
1111
corev1beta1 "github.com/openstack-k8s-operators/openstack-operator/api/core/v1beta1"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"k8s.io/apimachinery/pkg/types"
14+
"k8s.io/utils/ptr"
1415
ctrl "sigs.k8s.io/controller-runtime"
1516
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1617
)
@@ -228,7 +229,8 @@ func InitializeOpenStackVersionServiceDefaults(ctx context.Context) *corev1beta1
228229
// but get set to true here for FR3 available versions and thus provide a way for services to migrate
229230
// to new deployment topologies
230231
trueString := "true"
231-
defaults.GlanceWsgi = &trueString // all new glance deployments use WSGI by default (FR3 and later)
232+
defaults.GlanceWsgi = &trueString // all new glance deployments use WSGI by default (FR3 and later)
233+
defaults.GlanceLocationAPI = ptr.To("false") // disable location-api for RHOSO 18: this boolean can be switched to true with RHOSO 19 release
232234

233235
versionString := "4.2"
234236
defaults.RabbitmqVersion = &versionString // all new rabbitmq deployments will have rabbitmq-server 4.2 (FR5)

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)