blob: 599a824b130549d0f03f042bcc2876b493ff2cda [file] [log] [blame]
Joey Armstrongaf679da2023-01-31 14:22:41 -05001#!/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 Scandolod82d1de2021-04-06 14:55:58 -070017// 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 Armstrongaf679da2023-01-31 14:22:41 -050019// -----------------------------------------------------------------------
20
Matteo Scandolod82d1de2021-04-06 14:55:58 -070021def call(String dest) {
22 sh """
23 mkdir -p ${dest}
Matteo Scandolo8b62af32021-05-25 08:41:12 -070024 # only tee the main infos
Matteo Scandolod82d1de2021-04-06 14:55:58 -070025 kubectl get pods --all-namespaces -o wide | tee ${dest}/pods.txt || true
Matteo Scandolo8b62af32021-05-25 08:41:12 -070026 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 Scandolod82d1de2021-04-06 14:55:58 -070033 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 Scandolod82d1de2021-04-06 14:55:58 -070035 """
36}