Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ data:
prometheus:
host: 0.0.0.0
port: 8888
without_scope_info: false
without_type_suffix: false
without_units: false
kind: ConfigMap
metadata:
labels:
Expand All @@ -65,7 +62,7 @@ metadata:
app.kubernetes.io/managed-by: opentelemetry-operator
app.kubernetes.io/name: stateful-collector
app.kubernetes.io/part-of: opentelemetry
name: stateful-collector-cbacb1a5
name: stateful-collector-95bef721
namespace: chainsaw-must-gather
---
apiVersion: v1
Expand Down
104 changes: 76 additions & 28 deletions tests/e2e-openshift/must-gather/check_must_gather.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,50 @@
MUST_GATHER_DIR=$(mktemp -d)

# Run the must-gather script
oc adm must-gather --dest-dir=$MUST_GATHER_DIR --image=ghcr.io/open-telemetry/opentelemetry-operator/must-gather:latest -- /usr/bin/must-gather --operator-namespace $otelnamespace
oc adm must-gather --dest-dir=$MUST_GATHER_DIR --image=ghcr.io/open-telemetry/opentelemetry-operator/must-gather:main -- /usr/bin/gather --operator-namespace $otelnamespace

# Define required files and directories
REQUIRED_ITEMS=(
event-filter.html
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/service-stateful-collector-headless.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/service-stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/targetallocator-stateful.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/deployment-stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/service-stateful-collector-monitoring.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/poddisruptionbudget-stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/poddisruptionbudget-stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/service-stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/configmap-stateful-collector-*.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/configmap-stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/statefulset-stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/opentelemetrycollector-stateful.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/stateful/serviceaccount-stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/service-gather-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/opentelemetrycollector-gather.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/service-gather-collector-monitoring.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/configmap-gather-collector-*.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/serviceaccount-gather-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/service-gather-collector-headless.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/gather/deployment-gather-collector.yaml
*-must-gather-sha256-*/chainsaw-must-gather/instrumentation-nodejs.yaml
*-must-gather-sha256-*/opentelemetry-operator-controller-manager-*
*-must-gather-sha256-*/deployment-opentelemetry-operator-controller-manager.yaml
# stateful collector and its owned resources
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/opentelemetry.io/opentelemetrycollectors/stateful.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/opentelemetry.io/targetallocators/stateful.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/apps/statefulsets/stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/apps/deployments/stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/stateful-collector-headless.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/stateful-collector-monitoring.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/configmaps/stateful-collector-*.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/configmaps/stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/serviceaccounts/stateful-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/policy/poddisruptionbudgets/stateful-targetallocator.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/policy/poddisruptionbudgets/stateful-collector.yaml
# gather collector and its owned resources
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/opentelemetry.io/opentelemetrycollectors/gather.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/apps/deployments/gather-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/gather-collector.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/gather-collector-monitoring.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/services/gather-collector-headless.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/configmaps/gather-collector-*.yaml
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/core/serviceaccounts/gather-collector.yaml
# Instrumentation
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/opentelemetry.io/instrumentations/nodejs.yaml
# Collector pod logs
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/pods/gather-collector-*/otc-container/otc-container/logs/current.log
*-must-gather-sha256-*/namespaces/chainsaw-must-gather/pods/stateful-collector-*/otc-container/otc-container/logs/current.log
# Operator deployment and logs
*-must-gather-sha256-*/namespaces/$otelnamespace/apps/deployments/opentelemetry-operator-controller-manager.yaml
*-must-gather-sha256-*/namespaces/$otelnamespace/pods/opentelemetry-operator-controller-manager-*/manager/manager/logs/current.log
timestamp
)

# Define optional OLM-related items (only present when operator is deployed via OLM)
OPTIONAL_ITEMS=(
*-must-gather-sha256-*/olm/*opentelemetry-operator*.yaml
*-must-gather-sha256-*/olm/clusterserviceversion-opentelemetry-operator-v*.yaml
*-must-gather-sha256-*/olm/installplan-install-*.yaml
*-must-gather-sha256-*/olm/subscription-opentelemetry-*.yaml
*-must-gather-sha256-*/cluster-scoped-resources/operators.coreos.com/operators/*opentelemetry-operator*.yaml
*-must-gather-sha256-*/namespaces/$otelnamespace/operators.coreos.com/clusterserviceversions/opentelemetry-operator-v*.yaml
*-must-gather-sha256-*/namespaces/$otelnamespace/operators.coreos.com/installplans/install-*.yaml
*-must-gather-sha256-*/namespaces/$otelnamespace/operators.coreos.com/subscriptions/opentelemetry-*.yaml
)

# Verify each required item
Expand All @@ -62,5 +69,46 @@ for item in "${OPTIONAL_ITEMS[@]}"; do
fi
done

# Validate output with omc — download the binary matching the current host OS/arch
OMC=/tmp/omc
_OS=$(uname -s)
_ARCH=$(uname -m)
case "${_OS}/${_ARCH}" in
Darwin/arm64) _OMC_BIN="omc_Darwin_arm64" ;;
Darwin/x86_64) _OMC_BIN="omc_Darwin_x86_64" ;;
Linux/aarch64) _OMC_BIN="omc_Linux_arm64" ;;
*) _OMC_BIN="omc_Linux_x86_64" ;;
esac
curl -sL -o "$OMC" "https://github.com/gmeghnag/omc/releases/latest/download/${_OMC_BIN}"
chmod +x "$OMC"

OMC_ROOT=$(find "$MUST_GATHER_DIR" -maxdepth 1 -type d -name '*-must-gather-sha256-*' | head -1)
if [ -z "$OMC_ROOT" ]; then
echo "omc: could not find must-gather subdirectory"
exit 1
fi
$OMC use "$OMC_ROOT"

echo "--- omc validation ---"

$OMC get opentelemetrycollectors -A | grep -q "stateful" || { echo "omc: opentelemetrycollectors not found"; exit 1; }
echo "omc: opentelemetrycollectors OK"

$OMC get deployments -A | grep -q "gather-collector" || { echo "omc: deployments not found"; exit 1; }
echo "omc: deployments OK"

$OMC get pods -A | grep -q "gather-collector" || { echo "omc: pods not found"; exit 1; }
echo "omc: pods OK"

$OMC project chainsaw-must-gather >/dev/null

GATHER_POD=$(find "$OMC_ROOT" -path "*/pods/gather-collector-*" -type d -maxdepth 5 | head -1 | xargs -I{} basename {})
if [ -n "$GATHER_POD" ]; then
$OMC logs "$GATHER_POD" -c otc-container 2>/dev/null | head -1 | grep -q . || { echo "omc: logs empty for $GATHER_POD"; exit 1; }
echo "omc: logs OK"
else
echo "omc: no gather-collector pod directory found, skipping log check"
fi

# Cleanup the must-gather directory
rm -rf $MUST_GATHER_DIR
Loading