diff --git a/docs_dev/assemblies/development_environment.adoc b/docs_dev/assemblies/development_environment.adoc index 6b1787e48..10ae4d13b 100644 --- a/docs_dev/assemblies/development_environment.adoc +++ b/docs_dev/assemblies/development_environment.adoc @@ -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] diff --git a/docs_user/modules/openstack-glance_adoption.adoc b/docs_user/modules/openstack-glance_adoption.adoc index ebf60d560..aceda0e59 100644 --- a/docs_user/modules/openstack-glance_adoption.adoc +++ b/docs_user/modules/openstack-glance_adoption.adoc @@ -73,6 +73,103 @@ 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 <>, 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 osctlplane openstack --type=json -p="[{'op': 'replace', 'path': '/spec/glance/template/glanceAPIs/default/replicas', value: 1}]" +--- + +where `openstack` is the `osctlplane` name of the current deployment. + === Using NFS backend When the source Cloud based on TripleO uses Glance with a NFS backend, before diff --git a/tests/roles/glance_adoption/defaults/main.yaml b/tests/roles/glance_adoption/defaults/main.yaml index ba9775a51..275244f68 100644 --- a/tests/roles/glance_adoption/defaults/main.yaml +++ b/tests/roles/glance_adoption/defaults/main.yaml @@ -1,2 +1,2 @@ -# glance_backend can be 'local' or 'ceph' +# glance_backend can be 'local', 'ceph' or 'swift' glance_backend: local diff --git a/tests/roles/glance_adoption/tasks/check_glance.yaml b/tests/roles/glance_adoption/tasks/check_glance.yaml new file mode 100644 index 000000000..10431d723 --- /dev/null +++ b/tests/roles/glance_adoption/tasks/check_glance.yaml @@ -0,0 +1,36 @@ +- name: Check the resulting Glance + block: + - name: wait for Glance to start up + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + + STATUS=$(oc get pod --selector=service=glance -o jsonpath='{.items[*].status.phase}{"\n"}'); + code=1 + IFS=" " read -r -a STATUS <<< "$STATUS" + for i in "${STATUS[@]}"; do + if echo "$i" | grep -v Running; then + # if at least one instance is not Running, return + exit $code + else + code=0 + fi + done + exit $code + register: glance_running_result + until: glance_running_result is success + retries: 60 + delay: 2 + + - name: check that Glance is reachable and its endpoints are defined + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + alias openstack="oc exec -t openstackclient -- openstack" + + ${BASH_ALIASES[openstack]} endpoint list | grep glance + ${BASH_ALIASES[openstack]} image list + register: glance_responding_result + until: glance_responding_result is success + retries: 15 + delay: 2 diff --git a/tests/roles/glance_adoption/tasks/main.yaml b/tests/roles/glance_adoption/tasks/main.yaml index fd7e08f0b..ab71ecb8f 100644 --- a/tests/roles/glance_adoption/tasks/main.yaml +++ b/tests/roles/glance_adoption/tasks/main.yaml @@ -76,37 +76,48 @@ ' when: glance_backend == 'ceph' -- name: wait for Glance to start up +- 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: 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 + ' + when: glance_backend == 'swift' - STATUS=$(oc get pod --selector=service=glance -o jsonpath='{.items[*].status.phase}{"\n"}'); - code=1 - IFS=" " read -r -a STATUS <<< "$STATUS" - for i in "${STATUS[@]}"; do - if echo "$i" | grep -v Running; then - # if at least one instance is not Running, return - exit $code - else - code=0 - fi - done - exit $code - register: glance_running_result - until: glance_running_result is success - retries: 60 - delay: 2 - -- name: check that Glance is reachable and its endpoints are defined - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - alias openstack="oc exec -t openstackclient -- openstack" - - ${BASH_ALIASES[openstack]} endpoint list | grep glance - ${BASH_ALIASES[openstack]} image list - register: glance_responding_result - until: glance_responding_result is success - retries: 15 - delay: 2 +- name: Check the adopted GlanceAPI + when: glance_backend != 'swift' + ansible.builtin.include_tasks: check_glance.yaml diff --git a/tests/roles/swift_adoption/tasks/main.yaml b/tests/roles/swift_adoption/tasks/main.yaml index 24199c9b8..d6c2bd9b6 100644 --- a/tests/roles/swift_adoption/tasks/main.yaml +++ b/tests/roles/swift_adoption/tasks/main.yaml @@ -89,3 +89,24 @@ register: swift_responding_result until: swift_responding_result is success retries: 15 + +- name: Enable Glance is swift is set as backend + when: glance_backend == 'swift' + block: + - name: Update Glance replicas if Swift is set as a backend + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc patch openstackcontrolplane openstack --type=merge --patch ' + spec: + glance: + template: + glanceAPIs: + default: + replicas: 1 + ' + + - name: Check the resulting GlanceAPI + ansible.builtin.include_role: + name: glance_adoption + tasks_from: check_glance.yaml