Skip to content

Commit

Permalink
Use ctlplane ip from status.allIPs if ansibleHost isn't available
Browse files Browse the repository at this point in the history
This patch is a followup of
#49
since we can't access to hostname from must-gather container because it
doesn't have access to OSP controlplane DNS server.

Signed-off-by: Roberto Alfieri <[email protected]>
  • Loading branch information
rebtoor committed May 9, 2024
1 parent 08b35ee commit 9485e00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion collection-scripts/gather_edpm_sos
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# networks to do the work.
# TODO: Add openstack_edpm to the list once this PR merges and is released
# https://github.com/openstack-k8s-operators/openstack-must-gather/pull/18
set -euo pipefail

# When called from the shell directly
if [[ -z "$DIR_NAME" ]]; then
Expand Down Expand Up @@ -100,7 +101,7 @@ gather_edpm_sos () {
}


data=$(oc get openstackdataplanenodesets --all-namespaces -o go-template='{{range $indexns,$nodeset := .items}}{{range $index,$node := $nodeset.spec.nodes}}{{printf "%s " $node.hostName}}{{if $node.ansible.ansibleHost}}{{printf "%s " $node.ansible.ansibleHost}}{{else}}{{printf "%s " $node.hostName}}{{end}}{{printf "%s %s %s\n" $nodeset.spec.nodeTemplate.ansible.ansibleUser $nodeset.spec.nodeTemplate.ansibleSSHPrivateKeySecret $nodeset.metadata.namespace}}{{end}}{{end}}')
data=$(oc get openstackdataplanenodesets --all-namespaces -o go-template='{{range $indexns,$nodeset := .items}}{{range $index,$node := $nodeset.spec.nodes}}{{printf "%s " $node.hostName}}{{if $node.ansible.ansibleHost}}{{printf "%s " $node.ansible.ansibleHost}}{{else}}{{range $idxnet,$net := $nodeset.status.allIPs}}{{if eq $idxnet $node.hostName}}{{printf "%s " $net.ctlplane}}{{end}}{{end}}{{end}}{{printf "%s %s %s\n" $nodeset.spec.nodeTemplate.ansible.ansibleUser $nodeset.spec.nodeTemplate.ansibleSSHPrivateKeySecret $nodeset.metadata.namespace}}{{end}}{{end}}')

while read -r node address username secret namespace; do
[[ -z "$node" ]] && continue
Expand Down

0 comments on commit 9485e00

Please sign in to comment.