Merge pull request #10784 from subhamkrai/update-log-collector-script
test: update logcollector to get secrets -oyaml
This commit is contained in:
3 files changed
+20
-12
No files matched your search
@@ -85,6 +85,7 @@ func (s *TestCephSettings) readManifestFromGitHubWithClusterNamespace(filename,
|
||||
}
|
||||
|
||||
func (s *TestCephSettings) replaceOperatorSettings(manifest string) string {
|
||||
manifest = strings.ReplaceAll(manifest, `ROOK_LOG_LEVEL: "INFO"`, `ROOK_LOG_LEVEL: "DEBUG"`)
|
||||
manifest = strings.ReplaceAll(manifest, `# CSI_LOG_LEVEL: "0"`, `CSI_LOG_LEVEL: "5"`)
|
||||
manifest = strings.ReplaceAll(manifest, `ROOK_ENABLE_DISCOVERY_DAEMON: "false"`, fmt.Sprintf(`ROOK_ENABLE_DISCOVERY_DAEMON: "%t"`, s.EnableDiscovery))
|
||||
manifest = strings.ReplaceAll(manifest, `CSI_ENABLE_VOLUME_REPLICATION: "false"`, fmt.Sprintf(`CSI_ENABLE_VOLUME_REPLICATION: "%t"`, s.EnableVolumeReplication))
|
||||
|
||||
@@ -12,9 +12,9 @@ mkdir -p "${LOG_DIR}"
|
||||
|
||||
CEPH_CMD="kubectl -n ${CLUSTER_NAMESPACE} exec deploy/rook-ceph-tools -- ceph --connect-timeout 3"
|
||||
|
||||
$CEPH_CMD -s > "${LOG_DIR}"/ceph-status.txt
|
||||
$CEPH_CMD osd dump > "${LOG_DIR}"/ceph-osd-dump.txt
|
||||
$CEPH_CMD report > "${LOG_DIR}"/ceph-report.txt
|
||||
$CEPH_CMD -s >"${LOG_DIR}"/ceph-status.txt
|
||||
$CEPH_CMD osd dump >"${LOG_DIR}"/ceph-osd-dump.txt
|
||||
$CEPH_CMD report >"${LOG_DIR}"/ceph-report.txt
|
||||
|
||||
NAMESPACES=("$CLUSTER_NAMESPACE")
|
||||
if [[ "$OPERATOR_NAMESPACE" != "$CLUSTER_NAMESPACE" ]]; then
|
||||
@@ -27,32 +27,38 @@ for NAMESPACE in "${NAMESPACES[@]}"; do
|
||||
mkdir "${NS_DIR}"
|
||||
|
||||
# describe every one of the k8s resources in the namespace which rook commonly uses
|
||||
for KIND in 'pod' 'deployment' 'job' 'daemonset' 'secret' 'cm'; do
|
||||
kubectl -n "$NAMESPACE" get "$KIND" -o wide > "${NS_DIR}"/"$KIND"-list.txt
|
||||
for KIND in 'pod' 'deployment' 'job' 'daemonset' 'cm'; do
|
||||
kubectl -n "$NAMESPACE" get "$KIND" -o wide >"${NS_DIR}"/"$KIND"-list.txt
|
||||
for resource in $(kubectl -n "$NAMESPACE" get "$KIND" -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl -n "$NAMESPACE" describe "$KIND" "$resource" > "${NS_DIR}"/"$KIND"-describe--"$resource".txt
|
||||
kubectl -n "$NAMESPACE" describe "$KIND" "$resource" >"${NS_DIR}"/"$KIND"-describe--"$resource".txt
|
||||
|
||||
# collect logs for pods along the way
|
||||
if [[ "$KIND" == 'pod' ]]; then
|
||||
kubectl -n "$NAMESPACE" logs --all-containers "$resource" > "${NS_DIR}"/logs--"$resource".txt
|
||||
kubectl -n "$NAMESPACE" logs --all-containers "$resource" >"${NS_DIR}"/logs--"$resource".txt
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# secret need `-oyaml` to read the content instead of `describe` since secrets `describe` will be encrypted.
|
||||
# so keeping it in a different block.
|
||||
for secret in $(kubectl -n "$NAMESPACE" get secrets -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl -n "$NAMESPACE" get -o yaml secret "$secret" >"${NS_DIR}"/secret-describe--"$secret".txt
|
||||
done
|
||||
|
||||
# describe every one of the custom resources in the namespace since all should be rook-related and
|
||||
# they aren't captured by 'kubectl get all'
|
||||
for CRD in $(kubectl get crds -o jsonpath='{.items[*].metadata.name}'); do
|
||||
for resource in $(kubectl -n "$NAMESPACE" get "$CRD" -o jsonpath='{.items[*].metadata.name}'); do
|
||||
crd_main_type="${CRD%%.*}" # e.g., for cephclusters.ceph.rook.io, only use 'cephclusters'
|
||||
kubectl -n "$NAMESPACE" get -o yaml "$CRD" "$resource" > "${NS_DIR}"/"$crd_main_type"-describe--"$resource".txt
|
||||
kubectl -n "$NAMESPACE" get -o yaml "$CRD" "$resource" >"${NS_DIR}"/"$crd_main_type"-describe--"$resource".txt
|
||||
done
|
||||
done
|
||||
|
||||
# do simple 'get all' calls for resources we don't often want to look at
|
||||
kubectl get all -n "$NAMESPACE" -o wide > "${NS_DIR}"/all-wide.txt
|
||||
kubectl get all -n "$NAMESPACE" -o yaml > "${NS_DIR}"/all-yaml.txt
|
||||
kubectl get all -n "$NAMESPACE" -o wide >"${NS_DIR}"/all-wide.txt
|
||||
kubectl get all -n "$NAMESPACE" -o yaml >"${NS_DIR}"/all-yaml.txt
|
||||
done
|
||||
|
||||
sudo lsblk | sudo tee -a "${LOG_DIR}"/lsblk.txt
|
||||
journalctl -o short-precise --dmesg > "${LOG_DIR}"/dmesg.txt
|
||||
journalctl > "${LOG_DIR}"/journalctl.txt
|
||||
journalctl -o short-precise --dmesg >"${LOG_DIR}"/dmesg.txt
|
||||
journalctl >"${LOG_DIR}"/journalctl.txt
|
||||
@@ -199,6 +199,7 @@ function deploy_manifest_with_local_build() {
|
||||
if [[ "$USE_LOCAL_BUILD" != "false" ]]; then
|
||||
sed -i "s|image: rook/ceph:.*|image: rook/ceph:local-build|g" $1
|
||||
fi
|
||||
sed -i "s|ROOK_LOG_LEVEL:.*|ROOK_LOG_LEVEL: DEBUG|g" "$1"
|
||||
kubectl create -f $1
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user