Skip to content

Commit 10d8272

Browse files
committed
feat: remove OpenStack DB secrets
Since we're now using the MariaDB operator to generate the DB connection, we don't need to have this generated by OpenStack Helm. So that means we don't need to inject the passwords in via plain text since OpenStack Helm does not support passing secrets by reference. Instead we are using the db connection snippet of the prior commit. Keystone and Placement currently do not support mounting the DB connection snippet for the db_sync job currently so we must wait until that is fixed upstream and we bump to a new enough version. Placement fix: https://review.opendev.org/c/openstack/openstack-helm/+/942131
1 parent cc88726 commit 10d8272

File tree

2 files changed

+2
-46
lines changed

2 files changed

+2
-46
lines changed

components/openstack-secrets.tpl.yaml

-37
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,6 @@ endpoints:
4040
# this is used for encrypting / protecting the memcache tokens
4141
memcache_secret_key: "${MEMCACHE_SECRET_KEY}"
4242

43-
# 'oslo_db' is for MariaDB
44-
oslo_db:
45-
auth:
46-
# this is what the keystone service uses to connect to MariaDB
47-
keystone:
48-
password: "${KEYSTONE_DB_PASSWORD}"
49-
# this is what the glance service uses to connect to MariaDB
50-
glance:
51-
password: "${GLANCE_DB_PASSWORD}"
52-
# this is what the ironic service uses to connect to MariaDB
53-
ironic:
54-
password: "${IRONIC_DB_PASSWORD}"
55-
# this is what the neutron service uses to connect to MariaDB
56-
neutron:
57-
password: "${NEUTRON_DB_PASSWORD}"
58-
# this is what the nova service uses to connect to MariaDB
59-
nova:
60-
password: "${NOVA_DB_PASSWORD}"
61-
# this is what the placement service uses to connect to MariaDB
62-
placement:
63-
password: "${PLACEMENT_DB_PASSWORD}"
64-
# this is what the horizon dashboard service uses to connect to MariaDB
65-
horizon:
66-
password: "${HORIZON_DB_PASSWORD}"
67-
68-
# 'oslo_db_api' is for MariaDB specific for nova
69-
oslo_db_api:
70-
auth:
71-
nova:
72-
password: "${NOVA_DB_PASSWORD}"
73-
74-
# 'oslo_db_cell0' is for MariaDB specific for nova
75-
oslo_db_cell0:
76-
auth:
77-
nova:
78-
password: "${NOVA_DB_PASSWORD}"
79-
8043
# 'oslo_messaging' is for RabbitMQ
8144
oslo_messaging:
8245
auth:

scripts/gitops-secrets-gen.sh

+2-9
Original file line numberDiff line numberDiff line change
@@ -320,26 +320,23 @@ for component in keystone ironic placement neutron nova glance; do
320320

321321
# environment variable names
322322
VARNAME_RABBITMQ_PASSWORD="$(convert_to_var_name "${component}" "RABBITMQ_PASSWORD")"
323-
VARNAME_DB_PASSWORD="$(convert_to_var_name "${component}" "DB_PASSWORD")"
324323
VARNAME_KEYSTONE_PASSWORD="$(convert_to_var_name "${keystone_user}" "KEYSTONE_PASSWORD")"
325324

326325
# k8s secret names
327326
SECRET_RABBITMQ_PASSWORD="$(convert_to_secret_name "${VARNAME_RABBITMQ_PASSWORD}")"
328-
SECRET_DB_PASSWORD="$(convert_to_secret_name "${VARNAME_DB_PASSWORD}")"
329327
SECRET_KEYSTONE_PASSWORD="$(convert_to_secret_name "${VARNAME_KEYSTONE_PASSWORD}")"
330328

331329
# attempt to load the existing secrets from the cluster and use those
332330
# otherwise generate the passwords and set the variable names
333331
load_or_gen_os_secret "${VARNAME_RABBITMQ_PASSWORD}" "${SECRET_RABBITMQ_PASSWORD}" && \
334332
create_os_secret "RABBITMQ_PASSWORD" "${component}" "${component}"
335-
load_or_gen_os_secret "${VARNAME_DB_PASSWORD}" "${SECRET_DB_PASSWORD}" && \
333+
[ ! -f "${DEST_DIR}/${component}/secret-db-password.yaml" ] && \
336334
create_os_secret "DB_PASSWORD" "${component}" "${component}"
337335
load_or_gen_os_secret "${VARNAME_KEYSTONE_PASSWORD}" "${SECRET_KEYSTONE_PASSWORD}" && \
338336
create_os_secret "KEYSTONE_PASSWORD" "${component}" "${keystone_user}"
339337

340338
# export the variables for templating the openstack secret
341339
export "${VARNAME_RABBITMQ_PASSWORD?}"
342-
export "${VARNAME_DB_PASSWORD?}"
343340
export "${VARNAME_KEYSTONE_PASSWORD?}"
344341

345342
done
@@ -348,12 +345,8 @@ echo "Checking horizon"
348345
# horizon credentials
349346
mkdir -p "${DEST_DIR}/horizon"
350347
# horizon user password for database
351-
VARNAME_DB_PASSWORD="HORIZON_DB_PASSWORD"
352-
SECRET_DB_PASSWORD="horizon-db-password"
353-
load_or_gen_os_secret "${VARNAME_DB_PASSWORD}" "${SECRET_DB_PASSWORD}" && \
348+
[ ! -f "${DEST_DIR}/horizon/secret-db-password.yaml" ] && \
354349
create_os_secret "DB_PASSWORD" "horizon" "horizon"
355-
# export the variable for templating into the openstack secret / values.yaml
356-
export HORIZON_DB_PASSWORD
357350

358351
# generate the secret-openstack.yaml file every time from our secrets data
359352
# this is a helm values.yaml but it contains secrets because of the lack

0 commit comments

Comments
 (0)