feat(orchestrator): include orchestrator namespaces in namespace-inspect#149
Conversation
When orchestrator resources are detected (Serverless operators, Knative namespaces, SonataFlowPlatform CRs, SonataFlow workflows), gather_orchestrator now writes their namespaces to a detected-namespaces.txt file. gather_namespace-inspect reads this file during auto-detection and merges those namespaces into the inspection list, giving deeper diagnostic coverage of orchestrator infrastructure. When the user explicitly specifies --namespaces, only those namespaces are inspected — orchestrator namespaces are not appended, respecting the user's explicit scope. Assisted-by: Claude
… merge Move the empty-namespaces exit check to after orchestrator namespaces are merged, so clusters with only orchestrator components (and no direct RHDH deployments) are still inspected. Assisted-by: Claude
Simplify grep patterns in orchestrator and namespace-inspect tests to avoid escaped dollar signs inside single quotes, which ShellCheck flags as unexpanded expressions. Assisted-by: Claude
|
PR images are available (for 1 week):
|
Review Summary by QodoInclude orchestrator namespaces in namespace-inspect inspection
WalkthroughsDescription• Orchestrator namespaces automatically included in namespace-inspect • gather_orchestrator writes detected namespaces to file • gather_namespace-inspect merges orchestrator namespaces during auto-detection • Respects explicit --namespaces flag by not appending orchestrator namespaces • Comprehensive test coverage for orchestrator namespace tracking Diagramflowchart LR
A["gather_orchestrator"] -->|"detects namespaces"| B["detected-namespaces.txt"]
B -->|"read during auto-detect"| C["gather_namespace-inspect"]
C -->|"merges with RHDH"| D["namespaces_to_inspect array"]
D -->|"oc adm inspect"| E["namespace-inspect output"]
F["--namespaces flag"] -->|"skips merge"| C
File Changes1. collection-scripts/gather_orchestrator
|
Code Review by Qodo
1.
|
|
PR images are available (for 1 week):
|
…paces_to_namespace_inspect
Orchestrator namespaces read from detected-namespaces.txt were deduplicated before whitespace trimming, allowing entries like " foo " and "foo" to both appear in the final list. This caused redundant oc adm inspect targets and inflated timeouts. Normalize each namespace (trim whitespace) immediately upon reading, both for orchestrator entries and existing entries during comparison. Replace the post-merge trim-only loop with a full cleanup pass that trims, removes empty entries, and deduplicates the entire array. Assisted-by: Claude
The script unconditionally truncated detected-namespaces.txt at startup, leaving an empty file when no orchestrator components were found. This can confuse users and downstream tools inspecting the output artifacts. Remove the eager truncation (`: > "$ORCH_NAMESPACES_FILE"`). All writes already use append (>>), so the file is created naturally on the first detected namespace. gather_namespace-inspect already guards with `[[ -s file ]]`, so file absence is handled correctly. Assisted-by: Claude
…or tests The previous tests only grepped for strings in the script source, which validated code presence but not runtime behavior. Replace them with tests that actually execute the script against mock binaries (oc, kubectl, helm, jq) and verify the resulting oc adm inspect arguments. New tests cover: - Deduplication of orchestrator namespaces with whitespace variants - Explicit --namespaces mode ignoring orchestrator namespaces - Empty detected-namespaces.txt producing no extra namespaces - Absent detected-namespaces.txt handled gracefully - Merging auto-detected and orchestrator namespaces without duplicates - Whitespace-only lines in detected-namespaces.txt being ignored Assisted-by: Claude
|
PR images are available (for 1 week):
|
Description
When orchestrator resources are detected (Serverless operators, Knative namespaces, SonataFlowPlatform CRs, SonataFlow workflows),
gather_orchestratornow writes their namespaces to adetected-namespaces.txtfile.gather_namespace-inspectreads this file during auto-detection and merges those namespaces into theoc adm inspectcommand, providing deeper diagnostic coverage of orchestrator infrastructure.When the user explicitly specifies
--namespaces, orchestrator namespaces are not appended — the user's explicit scope is respected.Which issue(s) does this PR fix or relate to
—
PR acceptance criteria
How to test changes / Special notes to the reviewer
openshift-serverless,knative-serving) appear in thenamespace-inspect/output--namespaces ns1and verify onlyns1is inspected (no orchestrator namespaces added)--without-orchestratorand verifydetected-namespaces.txtis not created, so namespace-inspect skips orchestrator namespacesmake test— all 157 BATS tests pass