Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kube OVN
Commits
4b98d15f
Commit
4b98d15f
authored
3 years ago
by
zhangzujian
Browse files
Options
Download
Email Patches
Plain Diff
kubectl-ko: support trace Pods being created
parent
6d07efc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dist/images/install.sh
+13
-5
dist/images/install.sh
dist/images/kubectl-ko
+13
-5
dist/images/kubectl-ko
with
26 additions
and
10 deletions
+26
-10
dist/images/install.sh
+
13
-
5
View file @
4b98d15f
...
...
@@ -2555,22 +2555,30 @@ trace(){
proto="6"
fi
podIPs=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
=
"{.status.podIPs[*].ip}"
)
)
mac=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/mac_address
}
)
ls=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/logical_switch
}
)
hostNetwork=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.hostNetwork
}
)
nodeName=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.nodeName
}
)
if [ "
$hostNetwork
" = "true" ]; then
echo "Can not trace host network pod"
exit 1
fi
ls=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/logical_switch
}
)
if [ -z "
$ls
" ]; then
echo "pod address not ready"
exit 1
fi
podIPs=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
=
"{.status.podIPs[*].ip}"
)
)
if [
${#
podIPs
[@]
}
-eq 0 ]; then
podIPs=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/ip_address
}
|
sed
's/,/ /g'
)
)
if [
${#
podIPs
[@]
}
-eq 0 ]; then
echo "pod address not ready"
exit 1
fi
fi
mac=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/mac_address
}
)
nodeName=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.nodeName
}
)
podIP=""
for ip in
${
podIPs
[@]
}
; do
if [ "
$af
" = "4" ]; then
...
...
This diff is collapsed.
Click to expand it.
dist/images/kubectl-ko
+
13
-
5
View file @
4b98d15f
...
...
@@ -86,22 +86,30 @@ trace(){
proto
=
"6"
fi
podIPs
=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
=
"{.status.podIPs[*].ip}"
)
)
mac
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/mac_address
}
)
ls
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/logical_switch
}
)
hostNetwork
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.hostNetwork
}
)
nodeName
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.nodeName
}
)
if
[
"
$hostNetwork
"
=
"true"
]
;
then
echo
"Can not trace host network pod"
exit
1
fi
ls
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/logical_switch
}
)
if
[
-z
"
$ls
"
]
;
then
echo
"pod address not ready"
exit
1
fi
podIPs
=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
=
"{.status.podIPs[*].ip}"
)
)
if
[
${#
podIPs
[@]
}
-eq
0
]
;
then
podIPs
=(
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/ip_address
}
|
sed
's/,/ /g'
)
)
if
[
${#
podIPs
[@]
}
-eq
0
]
;
then
echo
"pod address not ready"
exit
1
fi
fi
mac
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.metadata.annotations.ovn
\\
.kubernetes
\\
.io/mac_address
}
)
nodeName
=
$(
kubectl get pod
"
$podName
"
-n
"
$namespace
"
-o
jsonpath
={
.spec.nodeName
}
)
podIP
=
""
for
ip
in
${
podIPs
[@]
}
;
do
if
[
"
$af
"
=
"4"
]
;
then
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help