Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | // ----------------------------------------------------------------------- |
| 3 | // Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | // ----------------------------------------------------------------------- |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 17 | // This keyword will get all the kubernetes pods info needed for debugging |
| 18 | // the only parameter required is the destination folder to store the collected information |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 19 | // ----------------------------------------------------------------------- |
| 20 | |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 21 | def call(String dest) { |
| 22 | sh """ |
| 23 | mkdir -p ${dest} |
Matteo Scandolo | 8b62af3 | 2021-05-25 08:41:12 -0700 | [diff] [blame] | 24 | # only tee the main infos |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 25 | kubectl get pods --all-namespaces -o wide | tee ${dest}/pods.txt || true |
Matteo Scandolo | 8b62af3 | 2021-05-25 08:41:12 -0700 | [diff] [blame] | 26 | helm ls --all-namespaces | tee ${dest}/helm-charts.txt |
| 27 | |
| 28 | # everything else should not be dumped on the console |
| 29 | kubectl get svc --all-namespaces -o wide > ${dest}/svc.txt || true |
| 30 | kubectl get pvc --all-namespaces -o wide > ${dest}/pvcs.txt || true |
| 31 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq > ${dest}/pod-images.txt || true |
| 32 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq > ${dest}/pod-imagesId.txt || true |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 33 | kubectl describe pods --all-namespaces -l app.kubernetes.io/part-of=voltha > ${dest}/voltha-pods-describe.txt |
| 34 | kubectl describe pods --all-namespaces -l app=onos-classic > ${dest}/onos-pods-describe.txt |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 35 | """ |
| 36 | } |