Skip to content

Commit

Permalink
Fix ansible issue when using golang templating
Browse files Browse the repository at this point in the history
This patch introduces the usage of files/ instead of hardcoded
spec. This would likely avoid issues when we use golang templates
and we can mantain files with per-backend configuration.

Signed-off-by: Francesco Pantano <[email protected]>
  • Loading branch information
fmount committed Mar 22, 2024
1 parent c45bf37 commit 73db89d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docs_user/modules/openstack-glance_adoption.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
spec:
type: LoadBalancer
networkAttachments:
- storage
- storage
----

Having `Swift` as a backend establishes a dependency between the two services,
Expand Down
6 changes: 3 additions & 3 deletions tests/roles/cinder_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
'
- name: Deploy cinder-volume if necessary
when: cinder_volume_backend != ''
when: cinder_volume_backend | default('') != ''
ansible.builtin.include_tasks: volume_backend.yaml

- name: Deploy cinder-backup if necessary
when: cinder_backup_backend != ''
when: cinder_backup_backend | default('') != ''
ansible.builtin.include_tasks: backup_backend.yaml

- name: wait for Cinder pods to start up
Expand All @@ -58,7 +58,7 @@
# Give time for volume and backup services to initialize drivers, otherwise they
# always looks ok (up) because that's the default at the start.
- name: Pause to allow backend drivers to start
when: cinder_volume_backend != '' or cinder_backup_backend != ''
when: cinder_volume_backend | default('') != '' or cinder_backup_backend | default('') != ''
ansible.builtin.pause:
seconds: 90

Expand Down
37 changes: 37 additions & 0 deletions tests/roles/glance_adoption/files/glance_swift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
spec:
glance:
enabled: true
apiOverrides:
default:
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: 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
37 changes: 1 addition & 36 deletions tests/roles/glance_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,7 @@
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
'
oc patch openstackcontrolplane openstack --type=merge --patch-file={{ role_path }}/files/glance_swift.yaml
when: glance_backend == 'swift'

- name: Check the adopted GlanceAPI
Expand Down

0 comments on commit 73db89d

Please sign in to comment.