Skip to content

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

Merged
merged 1 commit into from
Apr 30, 2025
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
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OPERATOR_VERSION ?= 0.0.1
OPERATOR_IMAGE ?= mustchange
BUNDLE_IMAGE ?= mustchange
KUEUE_IMAGE ?= mustchange
MUST_GATHER_IMAGE ?= https://quay.io/redhat-user-workloads/kueue-operator-tenant/kueue-must-gather:latest

KUBECONFIG ?= ${HOME}/.kube/config

Expand Down Expand Up @@ -246,3 +247,37 @@ e2e-tech-preview-upstream-test: wait-for-image deploy-cert-manager wait-for-cert
@rm -rf $(TEMP_DIR)
make undeploy-ocp
@rm -f .kueue_image

.PHONY: e2e-tech-preview-test
e2e-tech-preview-test: wait-for-image deploy-cert-manager ginkgo
@echo "Running operator e2e tests with released images..."
export KUEUE_IMAGE=registry.redhat.io/kueue-tech-preview/kueue-rhel9@sha256:d0d6c34952e3d60be62fe7add33aa7ae2b0ac5c1bd2592e319f4cc28b2a2783e
$(GINKGO) -v ./test/e2e/...
make undeploy-ocp
@rm -f .kueue_image

.PHONY: e2e-tech-preview-upstream-test
e2e-tech-preview-upstream-test: wait-for-image deploy-cert-manager wait-for-cert-manager deploy-ocp
@echo "Running upstream e2e tests with released images..."
export KUEUE_IMAGE=registry.redhat.io/kueue-tech-preview/kueue-rhel9@sha256:d0d6c34952e3d60be62fe7add33aa7ae2b0ac5c1bd2592e319f4cc28b2a2783e
cd $(TEMP_DIR) && KUEUE_NAMESPACE="openshift-kueue-operator" make -f Makefile-test-ocp.mk test-e2e-upstream-ocp
@echo "Cleaning up TEMP_DIR: $(TEMP_DIR)"
@rm -rf $(TEMP_DIR)
make undeploy-ocp
@rm -f .kueue_image

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

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

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

.PHONY: clean-must
clean-must:
-$(CONTAINER_TOOL) rmi $(MUST_GATHER_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."
52 changes: 52 additions & 0 deletions must-gather/collection-scripts/gather-kueue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
set -euxo pipefail

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

mkdir -p "${OUT}"

echo "[INFO] Collecting Kueue Custom Resources"
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

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

echo "[INFO] Collecting Services and Endpoints"
oc get services -n "${NAMESPACE}" -o yaml > "${OUT}/services.yaml" || true
oc get endpoints -n "${NAMESPACE}" -o yaml > "${OUT}/endpoints.yaml" || true

for svc in kueue-controller-manager-metrics-service kueue-webhook-service kueue-visibility-server; do
oc describe service "$svc" -n "${NAMESPACE}" > "${OUT}/describe-svc-${svc}.txt" || true
done

echo "[INFO] Collecting Webhook Configurations"
oc get mutatingwebhookconfiguration -o yaml > "${OUT}/mutatingwebhookconfiguration.yaml" || true
oc get validatingwebhookconfiguration -o yaml > "${OUT}/validatingwebhookconfiguration.yaml" || true

echo "[INFO] Collecting Operator Deployment Pod Logs"
for pod in $(oc get pods -n "${NAMESPACE}" -l name=openshift-kueue-operator -o jsonpath='{.items[*].metadata.name}'); do
oc logs -n "${NAMESPACE}" "$pod" > "${OUT}/logs-operator-${pod}.log" || true
done

echo "[INFO] Collecting kueue-controller-manager Pod Logs"
for pod in $(oc get pods -n "${NAMESPACE}" -l control-plane=controller-manager -o jsonpath='{.items[*].metadata.name}'); do
oc logs -n "${NAMESPACE}" "$pod" > "${OUT}/logs-controller-manager-${pod}.log" || true
done

echo "[INFO] Collecting Deployments"
oc get deployment openshift-kueue-operator -n "${NAMESPACE}" -o yaml > "${OUT}/deployment-openshift-kueue-operator.yaml" || true
oc get deployment kueue-controller-manager -n "${NAMESPACE}" -o yaml > "${OUT}/deployment-kueue-controller-manager.yaml" || true

echo "[INFO] Collecting RBAC"
oc get serviceaccount -n "${NAMESPACE}" -o yaml > "${OUT}/serviceaccounts.yaml" || true
oc get role -n "${NAMESPACE}" -o yaml > "${OUT}/roles.yaml" || true
oc get rolebinding -n "${NAMESPACE}" -o yaml > "${OUT}/rolebindings.yaml" || true

echo "[INFO] Kueue must-gather collection completed successfully."