Skip to content

Commit

Permalink
Glance adoption with Swift backend
Browse files Browse the repository at this point in the history
This patch describes the required steps to adopt the OpenStack Image
Service (Glance) with a Swift backend. It also improves the testsuite
to make sure we can cover such scenario.

Signed-off-by: Francesco Pantano <[email protected]>
  • Loading branch information
fmount committed Feb 19, 2024
1 parent ff9b204 commit 2c05629
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs_dev/assemblies/development_environment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,15 @@ cat << EOF > /tmp/addtional_nets.json
EOF
export EDPM_COMPUTE_ADDITIONAL_NETWORKS=$(jq -c . /tmp/addtional_nets.json)
export STANDALONE_COMPUTE_DRIVER=ironic
export NTP_SERVER=pool.ntp.org # Only neccecary if not on the RedHat network ...
export NTP_SERVER=pool.ntp.org # Only necessary if not on the RedHat network ...
export EDPM_COMPUTE_CEPH_ENABLED=false # Optional
----

[Note]
===
If `EDPM_COMPUTE_CEPH_ENABLED=false` is set, TripleO configures `Glance` with
`Swift` as a backend.
===
'''

Use the https://github.com/openstack-k8s-operators/install_yamls/tree/main/devsetup[install_yamls devsetup]
Expand Down
95 changes: 95 additions & 0 deletions docs_user/modules/openstack-glance_adoption.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,101 @@ spec:
'
----

=== Using swift backend

When Glance is deployed with Swift as a backend in the source environment based
on TripleO, the podified `glanceAPI` instance should be deployed with the following
configuration:

----
..
spec
glance:
...
customServiceConfig: |
[DEFAULT]
enabled_backends = default_backend:swift
[glance_store]
default_backend = default_backend
[default_backend]
swift_store_create_container_on_put = True
swift_store_auth_version = 3
swift_store_auth_address = {{ .KeystoneInternalURL }}
swift_store_endpoint_type = internalURL
swift_store_user = service:glance
swift_store_key = {{ .ServicePassword }}
----

It is recommended to write the patch manifest into a file, for example `glance_swift.patch`,
and then apply it with the following command:

----
oc patch openstackcontrolplane openstack --type=merge --patch-file=glance_swift.patch
----

For example, the Glance deployment with a Swift backend would look like this:

----
spec:
glance:
enabled: true
apiOverride:
route: {}
template:
databaseInstance: openstack
storageClass: "local-storage"
storageRequest: 10G
customServiceConfig: |
[DEFAULT]
enabled_backends = default_backend:swift
[glance_store]
default_backend = default_backend
[default_backend]
swift_store_create_container_on_put = True
swift_store_auth_version = 3
swift_store_auth_address = {{ .KeystoneInternalURL }}
swift_store_endpoint_type = internalURL
swift_store_user = service:glance
swift_store_key = {{ .ServicePassword }}
glanceAPIs:
default:
replicas: 0
override:
service:
internal:
metadata:
annotations:
metallb.universe.tf/address-pool: internalapi
metallb.universe.tf/allow-shared-ip: internalapi
metallb.universe.tf/loadBalancerIPs: 172.17.0.80
spec:
type: LoadBalancer
networkAttachments:
- storage
----

The example above sets `GlanceAPI` `replicas:0`. Having `Swift` as a backend,
establishes a dependency between the two services, and any deployed `GlanceAPI`
instance would **not work** if `Glance` is configured with `Swift` thae is
still not available in the `OpenStackControlPlane`.
Once Swift, and in particular `SwiftProxy`, has been adopted through the
procedure described in <<adopting-object-storage-service>>, it is possible
to set `GlanceAPI` `replicas:1` (or. greater that 1).

Verify that `SwiftProxy` is available with the following command:

----
$ oc get pod -l component=swift-proxy | grep Running
swift-proxy-75cb47f65-92rxq 3/3 Running 0
----

If the output is similar to the above, it is possible to move forward and patch
the `GlanceAPI` service deployed in the podified context.

---
$ oc patch glance glance --type=json -p="[{'op': 'replace', 'path': '/spec/glanceAPIs/default/replicas', value: 1}]"
---

=== Using NFS backend

When the source Cloud based on TripleO uses Glance with a NFS backend, before
Expand Down
2 changes: 1 addition & 1 deletion tests/roles/glance_adoption/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# glance_backend can be 'local' or 'ceph'
# glance_backend can be 'local', 'ceph' or 'swift'
glance_backend: local
42 changes: 42 additions & 0 deletions tests/roles/glance_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,48 @@
'
when: glance_backend == 'ceph'

- name: deploy podified Glance with Swift backend
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc patch openstackcontrolplane openstack --type=merge --patch '
spec:
glance:
enabled: true
template:
databaseInstance: openstack
customServiceConfig: |
[DEFAULT]
enabled_backends = default_backend:swift
[glance_store]
default_backend = default_backend
[default_backend]
swift_store_create_container_on_put = True
swift_store_auth_version = 3
swift_store_auth_address = {{ .KeystoneInternalURL }}
swift_store_endpoint_type = internalURL
swift_store_user = service:glance
swift_store_key = {{ .ServicePassword }}
storageClass: "local-storage"
storageRequest: 10G
glanceAPIs:
default:
replicas: 1
override:
service:
internal:
metadata:
annotations:
metallb.universe.tf/address-pool: internalapi
metallb.universe.tf/allow-shared-ip: internalapi
metallb.universe.tf/loadBalancerIPs: 172.17.0.80
spec:
type: LoadBalancer
networkAttachments:
- storage
'
when: glance_backend == 'swift'

- name: wait for Glance to start up
ansible.builtin.shell: |
{{ shell_header }}
Expand Down

0 comments on commit 2c05629

Please sign in to comment.