From 12b786a61c0b99fad85574179a5c6dec73eeca98 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Wed, 7 Feb 2024 09:53:07 +0100 Subject: [PATCH] Remove enabled_backend entry from 00-config.conf With webhooks we prevent the glance deploy unless a backend is specified via customServiceConfig. It doesn't fail if replicas is set to 0, but in general a backend must be specified. Signed-off-by: Francesco Pantano --- config/samples/backends/README.md | 64 +++++++++++++++++++ config/samples/backends/file/file.yaml | 21 ++++++ .../samples/backends/file/kustomization.yaml | 7 ++ templates/common/config/00-config.conf | 4 -- 4 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 config/samples/backends/file/file.yaml create mode 100644 config/samples/backends/file/kustomization.yaml diff --git a/config/samples/backends/README.md b/config/samples/backends/README.md index dd1527ed..90c224c9 100644 --- a/config/samples/backends/README.md +++ b/config/samples/backends/README.md @@ -19,6 +19,7 @@ Currently available samples are: - Ceph - NFS +- File - CEPH + NFS - CEPH + Sparse Image Upload - Cinder backends @@ -170,6 +171,55 @@ openstack role add --project admin --user admin swiftoperator Additional details on the `Ceph RGW` configuration are described in the [openstack-k8s-operators/docs repo](https://github.com/openstack-k8s-operators/docs/blob/main/ceph.md#configure-swift-with-a-rgw-backend). +## FILE example + +**For development only purposes**, as this is an unsupported configuration, +you can configure Glance with `File` backend. +Set `glanceAPI` to `replicas: 1` since it assumes that Persistent Volume Claims +are `RWO`, and image data are local on the Pod. +However, you can scale up the number of replicas if an `RWX` PVC is provided +through the `extraMounts` interface. + +### Configure the File backend + +The following snippet shows how the Glance configuration looks like in the +OpenStackControlPlane when File is set as a backend: + +``` +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: +... +... + glance: + template: + customServiceConfig: | + [DEFAULT] + enabled_backends = default_backend:file + [glance_store] + default_backend = default_backend + [default_backend] + filesystem_store_datadir = /var/lib/glance/images/ + databaseInstance: openstack + glanceAPIs: + default: + replicas: 1 + type: single +``` + +Once you have `crc` running making a deployment with File as a backend is +trivial: + +``` +$ cd install_yamls +$ make ceph TIMEOUT=90 +$ make crc_storage openstack +$ oc kustomize ../glance-operator/config/samples/backends/file > ~/openstack-deployment.yaml +$ export OPENSTACK_CR=`realpath ~/openstack-deployment.yaml` +$ make openstack_deploy +``` ## NFS Example @@ -198,6 +248,20 @@ metadata: spec: ... ... + glance: + template: + customServiceConfig: | + [DEFAULT] + enabled_backends = default_backend:file + [glance_store] + default_backend = default_backend + [default_backend] + filesystem_store_datadir = /var/lib/glance/images/ + databaseInstance: openstack + glanceAPIs: + default: + replicas: 1 + type: single extraMounts: - extraVol: - extraVolType: Nfs diff --git a/config/samples/backends/file/file.yaml b/config/samples/backends/file/file.yaml new file mode 100644 index 00000000..335d26f8 --- /dev/null +++ b/config/samples/backends/file/file.yaml @@ -0,0 +1,21 @@ +# ** FOR DEVELOPMENT PURPOSES ONLY** +# Sample using File as a glance backend +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + glance: + template: + customServiceConfig: | + [DEFAULT] + enabled_backends = default_backend:file + [glance_store] + default_backend = default_backend + [default_backend] + filesystem_store_datadir = /var/lib/glance/images/ + databaseInstance: openstack + glanceAPIs: + default: + replicas: 1 + type: single diff --git a/config/samples/backends/file/kustomization.yaml b/config/samples/backends/file/kustomization.yaml new file mode 100644 index 00000000..e3d7c727 --- /dev/null +++ b/config/samples/backends/file/kustomization.yaml @@ -0,0 +1,7 @@ +resources: +- ../base/openstack + +patches: +- path: file.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization diff --git a/templates/common/config/00-config.conf b/templates/common/config/00-config.conf index 0481e48a..62d9f82b 100644 --- a/templates/common/config/00-config.conf +++ b/templates/common/config/00-config.conf @@ -18,7 +18,6 @@ max_logfile_count=1 max_logfile_size_mb=20 log_rotation_type=size log_file = {{ .LogFile }} -enabled_backends=default_backend:file {{ if (index . "CacheEnabled") -}} image_cache_dir = {{ .ImageCacheDir }} image_cache_max_size = {{ .CacheMaxSize }} @@ -35,9 +34,6 @@ db_max_retries = -1 [file] filesystem_store_datadir = /var/lib/glance/images -[glance_store] -default_backend=default_backend - [keystone_authtoken] www_authenticate_uri={{ .KeystonePublicURL }} auth_url={{ .KeystoneInternalURL }}