Skip to content

Commit

Permalink
Filter by mariadb services cluster IPs instead
Browse files Browse the repository at this point in the history
Filtered pod IP may change, if pod restarts. Use the service cluster IP
which never changes.

Signed-off-by: Bohdan Dobrelia <[email protected]>
  • Loading branch information
bogdando committed Sep 14, 2023
1 parent bc58d55 commit a15fdd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/openstack/mariadb_copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ just illustrative, use values that are correct for your environment:
```
MARIADB_IMAGE=quay.io/podified-antelope-centos9/openstack-mariadb:current-podified
PODIFIED_MARIADB_IP=$(oc get -o yaml pod mariadb-openstack | grep podIP: | awk '{ print $2; }')
PODIFIED_CELL1_MARIADB_IP=$(oc get -o yaml pod mariadb-openstack-cell1 | grep podIP: | awk '{ print $2; }')
PODIFIED_MARIADB_IP=$(oc get svc --selector "cr=mariadb-openstack" -ojsonpath='{.items[0].spec.clusterIP}')
PODIFIED_CELL1_MARIADB_IP=$(oc get svc --selector "cr=mariadb-openstack-cell1" -ojsonpath='{.items[0].spec.clusterIP}')
PODIFIED_DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
# Replace with your environment's MariaDB IP:
Expand Down
8 changes: 4 additions & 4 deletions tests/roles/mariadb_copy/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
- name: get podified MariaDB IP
- name: get podified MariaDB service cluster IP
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc get -o yaml pod mariadb-openstack | grep podIP: | awk '{ print $2; }'
oc get svc --selector "cr=mariadb-openstack" -ojsonpath='{.items[0].spec.clusterIP}'
register: podified_mariadb_ip_result

- name: get podified cell1 MariaDB IP
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc get -o yaml pod mariadb-openstack-cell1 | grep podIP: | awk '{ print $2; }'
oc get svc --selector "cr=mariadb-openstack-cell1" -ojsonpath='{.items[0].spec.clusterIP}'
register: podified_cell1_mariadb_ip_result

- name: set MariaDB copy shell vars
Expand Down Expand Up @@ -51,4 +51,4 @@
no_log: "{{ use_no_log }}"
ansible.builtin.shell:
cmd: "{{ lookup('ansible.builtin.template', 'post_checks.bash') }}"


0 comments on commit a15fdd5

Please sign in to comment.