@@ -92,16 +92,18 @@ do_master () {
92
92
continue
93
93
fi
94
94
95
- resolv_ip=$( awk ' /\s' $node ' $/ { print $1; exit; }' /etc/hosts)
96
- if [ -z " $resolv_ip " ]; then
97
- resolv_ip=$( host $node 2> /dev/null | sed -ne ' s/.*has address //p' | head -1)
95
+ if ! [[ $node =~ ^[0-9.]* $ ]]; then
96
+ resolv_ip=$( awk ' /\s' $node ' $/ { print $1; exit; }' /etc/hosts)
98
97
if [ -z " $resolv_ip " ]; then
99
- echo " Node $node : no IP address in either DNS or /etc/hosts"
98
+ resolv_ip=$( host $node 2> /dev/null | sed -ne ' s/.*has address //p' | head -1)
99
+ if [ -z " $resolv_ip " ]; then
100
+ echo " Node $node : no IP address in either DNS or /etc/hosts"
101
+ fi
100
102
fi
101
- fi
102
103
103
- if [ " $reg_ip " != " $resolv_ip " ]; then
104
- echo " Node $node : the IP in OpenShift ($reg_ip ) does not match DNS/hosts ($resolv_ip )"
104
+ if [ " $reg_ip " != " $resolv_ip " ]; then
105
+ echo " Node $node : the IP in OpenShift ($reg_ip ) does not match DNS/hosts ($resolv_ip )"
106
+ fi
105
107
fi
106
108
107
109
try_eval ping -c1 -W2 $node
@@ -110,10 +112,10 @@ do_master () {
110
112
# Outputs a list of nodes in the form "nodename IP"
111
113
oc get nodes --template ' {{range .items}}{{$name := .metadata.name}}{{range .status.addresses}}{{if eq .type "InternalIP"}}{{$name}} {{.address}}{{"\n"}}{{end}}{{end}}{{end}}' > $logdir /meta/nodeinfo
112
114
113
- # Outputs a list of pods in the form "minion-1 mypod namespace 10.1.0.2 e4f1d61b"
114
- oc get pods --all-namespaces --template ' {{range .items}}{{if .status.containerStatuses}}{{if (index .status.containerStatuses 0).ready}}{{if not .spec.hostNetwork}}{{.spec.nodeName}} {{.metadata.name}} {{.metadata.namespace}} {{.status.podIP}} {{printf "%.21s" (index .status.containerStatuses 0).containerID}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}' | sed -e ' s|docker://||' > $logdir /meta/podinfo
115
+ # Outputs a list of pods in the form "minion-1 172.17.0.1 mypod namespace 10.1.0.2 e4f1d61b"
116
+ oc get pods --all-namespaces --template ' {{range .items}}{{if .status.containerStatuses}}{{if (index .status.containerStatuses 0).ready}}{{if not .spec.hostNetwork}}{{.spec.nodeName}} {{.status.hostIP}} {{. metadata.name}} {{.metadata.namespace}} {{.status.podIP}} {{printf "%.21s" (index .status.containerStatuses 0).containerID}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}' | sed -e ' s|docker://||' > $logdir /meta/podinfo
115
117
116
- # Outputs a list of services in the form "myservice: namespace: 172.30.0.99: tcp: 5454"
118
+ # Outputs a list of services in the form "myservice namespace 172.30.0.99 tcp 5454"
117
119
oc get services --all-namespaces --template ' {{range .items}}{{if ne .spec.clusterIP "None"}}{{.metadata.name}} {{.metadata.namespace}} {{.spec.clusterIP}} {{(index .spec.ports 0).protocol}} {{(index .spec.ports 0).port}}{{"\n"}}{{end}}{{end}}' | sed -e ' s/ TCP / tcp /g' -e ' s/ UDP / udp /g' > $logdir /meta/serviceinfo
118
120
}
119
121
@@ -145,14 +147,16 @@ do_pod_to_pod_connectivity_check () {
145
147
base_pod_ether=$8
146
148
other_pod_name=$9
147
149
other_pod_addr=${10}
150
+ other_pod_nodeaddr=${11}
148
151
149
152
echo $where pod, $namespace namespace: | tr ' [a-z]' ' [A-Z]'
150
153
echo " "
151
154
152
155
other_pod_port=$( get_port_for_addr $other_pod_addr )
153
- other_pod_vnid=$( get_vnid_for_addr $other_pod_addr )
154
- if [ -z " $other_pod_port " ]; then
155
- other_pod_port=1 # vxlan
156
+ if [ -n " $other_pod_port " ]; then
157
+ other_pod_vnid=$( get_vnid_for_addr $other_pod_addr )
158
+ in_spec=" in_port=${other_pod_port} "
159
+ else
156
160
case $namespace in
157
161
default)
158
162
other_pod_vnid=0
@@ -165,13 +169,14 @@ do_pod_to_pod_connectivity_check () {
165
169
other_pod_vnid=6
166
170
;;
167
171
esac
172
+ in_spec=" in_port=1,tun_src=${other_pod_nodeaddr} ,tun_id=${other_pod_vnid} "
168
173
fi
169
174
170
175
echo " $base_pod_name -> $other_pod_name "
171
176
echo_and_eval ovs-appctl ofproto/trace br0 " in_port=${base_pod_port} ,reg0=${base_pod_vnid} ,ip,nw_src=${base_pod_addr} ,nw_dst=${other_pod_addr} "
172
177
echo " "
173
178
echo " $other_pod_name -> $base_pod_name "
174
- echo_and_eval ovs-appctl ofproto/trace br0 " in_port= ${other_pod_port} ,reg0= ${other_pod_vnid } ,ip,nw_src=${other_pod_addr} ,nw_dst=${base_pod_addr} ,dl_dst=${base_pod_ether} "
179
+ echo_and_eval ovs-appctl ofproto/trace br0 " ${in_spec } ,ip,nw_src=${other_pod_addr} ,nw_dst=${base_pod_addr} ,dl_dst=${base_pod_ether} "
175
180
echo " "
176
181
177
182
if nsenter -n -t $base_pod_pid -- ping -c 1 -W 2 $other_pod_addr & > /dev/null; then
@@ -281,7 +286,7 @@ do_node () {
281
286
# Remember the name, address, namespace, and pid of the first pod we find on
282
287
# this node which is not in the default namespace
283
288
base_pod_addr=
284
- while read pod_node pod_name pod_ns pod_addr pod_id; do
289
+ while read pod_node pod_nodeaddr pod_name pod_ns pod_addr pod_id; do
285
290
if [ " $pod_node " != " $node " ]; then
286
291
continue
287
292
fi
@@ -341,7 +346,7 @@ do_node () {
341
346
342
347
# Now find other pods of various types to test connectivity against
343
348
touch $lognode /pod-connectivity
344
- while read pod_node pod_name pod_ns pod_addr pod_id; do
349
+ while read pod_node pod_nodeaddr pod_name pod_ns pod_addr pod_id; do
345
350
if [ " $pod_addr " = " $base_pod_addr " ]; then
346
351
continue
347
352
fi
@@ -367,7 +372,7 @@ do_node () {
367
372
$base_pod_name $base_pod_addr \
368
373
$base_pod_pid $base_pod_port \
369
374
$base_pod_vnid $base_pod_ether \
370
- $pod_name $pod_addr \
375
+ $pod_name $pod_addr $pod_nodeaddr \
371
376
& >> $lognode /pod-connectivity
372
377
eval did_${where} _${namespace} =1
373
378
done < $logdir /meta/podinfo
@@ -456,14 +461,15 @@ do_master_and_nodes ()
456
461
457
462
# ####### Main program starts here
458
463
459
- systemd_dir=/usr/lib/systemd/system/
460
- for name in openshift origin atomic-openshift; do
461
- if [ -f $systemd_dir /$name -master.service ]; then
462
- aos_master_service=$name -master.service
463
- fi
464
- if [ -f $systemd_dir /$name -node.service ]; then
465
- aos_node_service=$name -node.service
466
- fi
464
+ for systemd_dir in /etc/systemd/system /usr/lib/systemd/system; do
465
+ for name in openshift origin atomic-openshift; do
466
+ if [ -f $systemd_dir /$name -master.service ]; then
467
+ aos_master_service=$name -master.service
468
+ fi
469
+ if [ -f $systemd_dir /$name -node.service ]; then
470
+ aos_node_service=$name -node.service
471
+ fi
472
+ done
467
473
done
468
474
469
475
case " $1 " in
0 commit comments