Skip to content

Commit 40a447b

Browse files
committed
Add ServiceDefaults mechanism for updates support
ServiceDefaults is a new feild in the OpenStackVersion status that can be used to manage service defaults during an update. Older OpenStackVersions won't have newly initialized defaults set and thus we treat them as legacy. In the case of glance they would continue to deploy with httpd+proxypass until the new OpenStackVersion for FR3 is selected and deployed.
1 parent 1ec2176 commit 40a447b

7 files changed

Lines changed: 58 additions & 0 deletions

File tree

apis/bases/core.openstack.org_openstackversions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ spec:
638638
observedGeneration:
639639
format: int64
640640
type: integer
641+
serviceDefaults:
642+
properties:
643+
glanceWsgi:
644+
type: string
645+
type: object
641646
type: object
642647
type: object
643648
served: true

apis/core/v1beta1/openstackversion_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ type ContainerTemplate struct {
164164
TestAnsibletestImage *string `json:"testAnsibletestImage,omitempty"`
165165
}
166166

167+
// ServiceDefaults - struct that contains defaults for OSP services that can change over time
168+
// but are associated with a specific OpenStack release version
169+
type ServiceDefaults struct {
170+
GlanceWsgi *string `json:"glanceWsgi,omitempty"`
171+
}
172+
167173
// OpenStackVersionStatus defines the observed state of OpenStackVersion
168174
type OpenStackVersionStatus struct {
169175
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"}
@@ -179,6 +185,9 @@ type OpenStackVersionStatus struct {
179185
// where we keep track of the container images for previous versions
180186
ContainerImageVersionDefaults map[string]*ContainerDefaults `json:"containerImageVersionDefaults,omitempty"`
181187

188+
// ServiceDefaults - struct that contains defaults for OSP services that can change over time
189+
ServiceDefaults ServiceDefaults `json:"serviceDefaults,omitempty"`
190+
182191
//ObservedGeneration - the most recent generation observed for this object.
183192
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
184193
}

apis/core/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20301,6 +20301,11 @@ spec:
2030120301
observedGeneration:
2030220302
format: int64
2030320303
type: integer
20304+
serviceDefaults:
20305+
properties:
20306+
glanceWsgi:
20307+
type: string
20308+
type: object
2030420309
type: object
2030520310
type: object
2030620311
served: true

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ spec:
638638
observedGeneration:
639639
format: int64
640640
type: integer
641+
serviceDefaults:
642+
properties:
643+
glanceWsgi:
644+
type: string
645+
type: object
641646
type: object
642647
type: object
643648
served: true

controllers/core/openstackversion_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
190190
}
191191
// store the defaults for the currently available version
192192
instance.Status.ContainerImageVersionDefaults[envAvailableVersion] = defaults
193+
// setup per service defaults
194+
trueString := "true"
195+
instance.Status.ServiceDefaults.GlanceWsgi = &trueString // all new glance deployments are wsgi
193196

194197
// calculate the container images for the target version
195198
Log.Info("Target version: ", "targetVersion", instance.Spec.TargetVersion)

pkg/openstack/glance.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
180180
if glance.Spec.Storage.StorageClass == "" {
181181
glance.Spec.Storage.StorageClass = instance.Spec.StorageClass
182182
}
183+
184+
if glance.GetAnnotations() == nil {
185+
glance.SetAnnotations(make(map[string]string))
186+
}
187+
if version.Status.ServiceDefaults.GlanceWsgi != nil && *version.Status.ServiceDefaults.GlanceWsgi == "true" {
188+
glance.GetAnnotations()["glance.openstack.org/wsgi"] = "true"
189+
} else {
190+
glance.GetAnnotations()["glance.openstack.org/wsgi"] = "false"
191+
}
192+
183193
// Append globally defined extraMounts to the service's own list.
184194
for _, ev := range instance.Spec.ExtraMounts {
185195
glance.Spec.ExtraMounts = append(glance.Spec.ExtraMounts, glancev1.GlanceExtraVolMounts{

0 commit comments

Comments
 (0)