Skip to content

[WIP]: Custom must gather image #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,24 @@ e2e-upstream-test: get-kueue-image wait-for-image deploy-cert-manager wait-for-c
@rm -rf $(TEMP_DIR)
make undeploy-ocp
@rm -f .kueue_image

MUST_GATHER_IMAGE ?= quay.io/rh-pbhojara/kueue-must-gather
MUST_GATHER_TAG ?= latest
CONTAINER_TOOL ?= podman
FULL_IMAGE := $(MUST_GATHER_IMAGE):$(MUST_GATHER_TAG)

.PHONY: build-must
build-must:
$(CONTAINER_TOOL) build -f must-gather/Dockerfile -t $(FULL_IMAGE) .

.PHONY: push-must
push-must:
$(CONTAINER_TOOL) push $(FULL_IMAGE)

.PHONY: run-must
run-must:
oc adm must-gather --image=$(FULL_IMAGE)

.PHONY: clean-must
clean-must:
-$(CONTAINER_TOOL) rmi $(FULL_IMAGE) || true
21 changes: 21 additions & 0 deletions must-gather/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM quay.io/openshift/origin-must-gather:latest as builder

FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5

RUN microdnf update -y && microdnf install tar rsync bash -y && microdnf clean all

COPY --from=builder /usr/bin/oc /usr/bin/oc
COPY --from=builder /usr/bin/gather /usr/bin/gather_original

# COPY must-gather/collection-scripts/gather /gather
# COPY must-gather/collection-scripts/gather-kueue.sh /gather-kueue.sh

COPY must-gather/collection-scripts/gather /usr/bin/gather
COPY must-gather/collection-scripts/gather-kueue /usr/bin/gather-kueue

# RUN chmod +x /gather /gather-kueue.sh
RUN chmod +x /usr/bin/gather /usr/bin/gather-kueue

# ENTRYPOINT /usr/bin/gather
# ENTRYPOINT ["/gather"]
CMD ["/bin/bash", "/usr/bin/gather"]
12 changes: 12 additions & 0 deletions must-gather/collection-scripts/gather
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euxo pipefail

OUTPUT_DIR=${OUTPUT_DIR:-/must-gather}
KUEUE_NS=openshift-kueue-operator

echo "[INFO] Gathering Kueue-specific resources from namespace: ${KUEUE_NS}"
mkdir -p ${OUTPUT_DIR}/kueue

/usr/bin/gather-kueue "${KUEUE_NS}" "${OUTPUT_DIR}/kueue"

echo "[INFO] Kueue must-gather complete."
27 changes: 27 additions & 0 deletions must-gather/collection-scripts/gather-kueue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -euxo pipefail

NAMESPACE="$1"
OUT="$2"

# Collect core Kueue custom resources
echo "[INFO] Collecting CRs..."
oc get workloads -A -o yaml > "${OUT}/workloads.yaml" || true
oc get clusterqueues -A -o yaml > "${OUT}/clusterqueues.yaml" || true
oc get localqueues -A -o yaml > "${OUT}/localqueues.yaml" || true
oc get resourceflavors -A -o yaml > "${OUT}/resourceflavors.yaml" || true
oc get admissionchecks -A -o yaml > "${OUT}/admissionchecks.yaml" || true

# Collect controller logs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would also need the operator logs (from openshift-kueue-operator pods)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be helpful get pod logs from the cert-manager namespace too.

echo "[INFO] Collecting controller-manager logs..."
oc logs -n "${NAMESPACE}" deploy/kueue-controller-manager > "${OUT}/controller-manager.log" || true

# Capture CRD definitions (for debugging schema changes)
echo "[INFO] Collecting CRD definitions..."
for crd in clusterqueues.kueue.x-k8s.io localqueues.kueue.x-k8s.io workloads.kueue.x-k8s.io resourceflavors.kueue.x-k8s.io admissionchecks.kueue.x-k8s.io; do
oc get crd "$crd" -o yaml > "${OUT}/crd-${crd}.yaml" || true
done

# Collect configmaps/services relevant to Kueue
oc get configmaps -n "${NAMESPACE}" -o yaml > "${OUT}/configmaps.yaml" || true
oc get services -n "${NAMESPACE}" -o yaml > "${OUT}/services.yaml" || true