From 6fb81cffbb46892d0058a5afeeb02cf3cc2a10c7 Mon Sep 17 00:00:00 2001 From: Rosa Maggi Date: Thu, 6 Feb 2025 12:48:32 +0100 Subject: [PATCH] [fix] WPN-297 mariadb should have each a different secret This is what we want but it doesn't work (ansible task failed) until the WPN-287 is done : https://erpdev.atlassian.net/browse/WPN-287 As all mariadbs have been already created, kubernetes doesn't allow to modify `rootPasswordSecretKeyRef` property --- ansible/roles/wordpress-namespace/tasks/mariadb.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ansible/roles/wordpress-namespace/tasks/mariadb.yml b/ansible/roles/wordpress-namespace/tasks/mariadb.yml index 23e79837a..fa6e6ce35 100644 --- a/ansible/roles/wordpress-namespace/tasks/mariadb.yml +++ b/ansible/roles/wordpress-namespace/tasks/mariadb.yml @@ -1,7 +1,7 @@ - tags: always include_vars: file : "{{ item }}" - with_items: + with_items: - mariadb-vars.yml - "backup-secrets-{{ inventory_deployment_stage }}.yml" @@ -15,7 +15,7 @@ apiVersion: k8s.mariadb.com/v1alpha1 kind: MariaDB metadata: - name: "{{ mariadb_name }}-{{ '%02d' | format(item|int) }}" + name: "{{ _mariadb_name }}" namespace: "{{ inventory_namespace }}" spec: storage: @@ -29,11 +29,13 @@ storage: 1Gi storageClassName: "{{ storage_class_to_use }}" rootPasswordSecretKeyRef: - name: mariadb + name: "{{ _mariadb_name }}" key: root-password generate: true metrics: enabled: true + vars: + _mariadb_name: "{{ mariadb_name }}-{{ '%02d' | format(item|int) }}" - name: "Backup/{{ mariadb_name }} (Backups scheduling)" with_sequence: >- @@ -58,7 +60,7 @@ # snapshotting acitvated. This means that `.snapshot` folders # pop up randomly in every directory, causing this error: # - # `mariadb-dump: Got error: 1102: "Incorrect database name + # `mariadb-dump: Got error: 1102: "Incorrect database name # '#mysql50#.snapshot'" when selecting the database` # # The following line works around that.