From 584d7dcfe7f50c93be0e2a6d13d09dfa82fbf1a7 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Wed, 12 Jun 2024 13:41:22 +0200 Subject: [PATCH] Bump Glance with the new storage interface We currently provide both StorageClass and StorageRequest that can be propagated to the Glance underlying instances. However, it might be possible that operators use extraMounts to plug a NFS share mapped to /var/lib/glance/os_staging_store. In this case, the API should be updated to not provision any PVC and let the human operator to take care about it using the extraMounts interface. This patch updates the Glance bits to reflect the new behavior introduced in the glance-operator. Signed-off-by: Francesco Pantano --- ....openstack.org_openstackcontrolplanes.yaml | 30 +++++++++++-------- ....openstack.org_openstackcontrolplanes.yaml | 30 +++++++++++-------- .../core_v1beta1_openstackcontrolplane.yaml | 5 ++-- ..._openstackcontrolplane_collapsed_cell.yaml | 5 ++-- ..._v1beta1_openstackcontrolplane_galera.yaml | 5 ++-- ...penstackcontrolplane_galera_3replicas.yaml | 5 ++-- ...controlplane_galera_network_isolation.yaml | 5 ++-- ...ne_galera_network_isolation_3replicas.yaml | 5 ++-- ...eplicas_only_default_enabled_services.yaml | 5 ++-- ...enstackcontrolplane_network_isolation.yaml | 5 ++-- ...ckcontrolplane_network_isolation_ceph.yaml | 5 ++-- ...network_isolation_tls_public_endpoint.yaml | 5 ++-- go.mod | 2 ++ go.sum | 4 +-- pkg/openstack/glance.go | 4 +-- 15 files changed, 72 insertions(+), 48 deletions(-) diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index c7dfeca4c..50bc61055 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -4373,8 +4373,6 @@ spec: type: object type: object type: object - pvc: - type: string replicas: default: 1 format: int32 @@ -4412,10 +4410,15 @@ spec: x-kubernetes-int-or-string: true type: object type: object - storageClass: - type: string - storageRequest: - type: string + storage: + properties: + external: + type: boolean + storageClass: + type: string + storageRequest: + type: string + type: object tls: properties: api: @@ -4443,7 +4446,6 @@ spec: type: string required: - containerImage - - storageRequest type: object type: object imageCache: @@ -4506,10 +4508,15 @@ spec: serviceUser: default: glance type: string - storageClass: - type: string - storageRequest: - type: string + storage: + properties: + external: + type: boolean + storageClass: + type: string + storageRequest: + type: string + type: object required: - databaseInstance - glanceAPIs @@ -4517,7 +4524,6 @@ spec: - keystoneEndpoint - memcachedInstance - secret - - storageRequest type: object type: object heat: diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index c7dfeca4c..50bc61055 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -4373,8 +4373,6 @@ spec: type: object type: object type: object - pvc: - type: string replicas: default: 1 format: int32 @@ -4412,10 +4410,15 @@ spec: x-kubernetes-int-or-string: true type: object type: object - storageClass: - type: string - storageRequest: - type: string + storage: + properties: + external: + type: boolean + storageClass: + type: string + storageRequest: + type: string + type: object tls: properties: api: @@ -4443,7 +4446,6 @@ spec: type: string required: - containerImage - - storageRequest type: object type: object imageCache: @@ -4506,10 +4508,15 @@ spec: serviceUser: default: glance type: string - storageClass: - type: string - storageRequest: - type: string + storage: + properties: + external: + type: boolean + storageClass: + type: string + storageRequest: + type: string + type: object required: - databaseInstance - glanceAPIs @@ -4517,7 +4524,6 @@ spec: - keystoneEndpoint - memcachedInstance - secret - - storageRequest type: object type: object heat: diff --git a/config/samples/core_v1beta1_openstackcontrolplane.yaml b/config/samples/core_v1beta1_openstackcontrolplane.yaml index ea73797a7..abc222eb6 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane.yaml @@ -56,8 +56,9 @@ spec: template: secret: osp-secret databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G keystoneEndpoint: default glanceAPIs: default: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml index 38dd371d6..ea63a0487 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml @@ -46,8 +46,9 @@ spec: template: secret: osp-secret databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G keystoneEndpoint: default glanceAPIs: default: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml index 343263083..78ab13cde 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml @@ -54,8 +54,9 @@ spec: template: secret: osp-secret databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G keystoneEndpoint: default glanceAPIs: default: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml index 740d89be3..55520e60a 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml @@ -53,8 +53,9 @@ spec: glance: template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml index 5994f1bd5..87440d2ed 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml @@ -55,8 +55,9 @@ spec: route: {} template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml index ee8758833..5a19f6bc3 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml @@ -77,8 +77,9 @@ spec: route: {} template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas_only_default_enabled_services.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas_only_default_enabled_services.yaml index f6aebd416..6c3be36ba 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas_only_default_enabled_services.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas_only_default_enabled_services.yaml @@ -77,8 +77,9 @@ spec: route: {} template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml index b3c778b59..b3273d0c3 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml @@ -77,8 +77,9 @@ spec: route: {} template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml index e2174cf23..d33366f9f 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml @@ -122,8 +122,9 @@ spec: store_description = "RBD backend" rbd_store_pool = images rbd_store_user = openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_tls_public_endpoint.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_tls_public_endpoint.yaml index b5843a59b..fb6a1c924 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_tls_public_endpoint.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_tls_public_endpoint.yaml @@ -80,8 +80,9 @@ spec: route: {} template: databaseInstance: openstack - storageClass: "" - storageRequest: 10G + storage: + storageClass: "" + storageRequest: 10G secret: osp-secret keystoneEndpoint: default glanceAPIs: diff --git a/go.mod b/go.mod index 48bcc3138..6c4f0adf0 100644 --- a/go.mod +++ b/go.mod @@ -129,3 +129,5 @@ replace github.com/openshift/api => github.com/openshift/api v0.0.0-202304141430 // custom RabbitmqClusterSpecCore for OpenStackControlplane (v2.6.0_patches_tag) replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20240313124519-961a0ee8bf7f //allow-merging + +replace github.com/openstack-k8s-operators/glance-operator/api => github.com/fmount/glance-operator/api v0.0.0-20240614060531-8f314f258e12 //allow-merging diff --git a/go.sum b/go.sum index ada94b45d..7488ead6c 100644 --- a/go.sum +++ b/go.sum @@ -15,6 +15,8 @@ github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRr github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/fmount/glance-operator/api v0.0.0-20240614060531-8f314f258e12 h1:jliwtCaxG3k9DiSQuqCuD7rvfpRA1GGD+FWCYSC4i6k= +github.com/fmount/glance-operator/api v0.0.0-20240614060531-8f314f258e12/go.mod h1:67lzyETgcPlb0qqmES+Cc/VLuC5yPscFeutezT9AEWo= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -104,8 +106,6 @@ github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.2024060802425 github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20240608024258-319ec0e5a28b/go.mod h1:ESTcEmtCGEvlrMPzdbNDeIUozxfKA4zEqhYt/rxJxmE= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20240604124031-77b21b330d86 h1:pE/BD9Qg5A2CFQHiKJfqZ8Os7obIoTsy8UYNI3sDblc= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20240604124031-77b21b330d86/go.mod h1:u53p2KRT083miTWA5oQlU4zITB4FXJOzI/eao51CkbE= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20240610071145-9fc8ef9f3c7c h1:MvciJWQenAmUjAL5p3TkSlgZ45VUc0nzCWJpW+2VLME= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20240610071145-9fc8ef9f3c7c/go.mod h1:67lzyETgcPlb0qqmES+Cc/VLuC5yPscFeutezT9AEWo= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240610020058-4a722aada8e9 h1:STYwJ9MAg4CvR4dYZjKNbx8q4wX64c2muXKaOX8lJbo= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240610020058-4a722aada8e9/go.mod h1:h7k9mJ8F9Imch6bqXdKB1I6IlF+N7RM2yyOSlFBWMVA= github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240604091541-cdb648f9a7ac h1:PefPL9dy16A47TmEsjlGbJcM9tmXA75qAxh9jxQ/Vx4= diff --git a/pkg/openstack/glance.go b/pkg/openstack/glance.go index 7af739d34..9f46c7aa9 100644 --- a/pkg/openstack/glance.go +++ b/pkg/openstack/glance.go @@ -149,8 +149,8 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl if glance.Spec.DatabaseInstance == "" { glance.Spec.DatabaseInstance = "openstack" } - if glance.Spec.StorageClass == "" { - glance.Spec.StorageClass = instance.Spec.StorageClass + if glance.Spec.Storage.StorageClass == "" { + glance.Spec.Storage.StorageClass = instance.Spec.StorageClass } // Append globally defined extraMounts to the service's own list. for _, ev := range instance.Spec.ExtraMounts {