Skip to content

📖 docs: update Placement debug endpoint documentation - #554

Open
haoqing0110 wants to merge 1 commit into
open-cluster-management-io:mainfrom
haoqing0110:update-placement-debug-docs
Open

📖 docs: update Placement debug endpoint documentation#554
haoqing0110 wants to merge 1 commit into
open-cluster-management-io:mainfrom
haoqing0110:update-placement-debug-docs

Conversation

@haoqing0110

@haoqing0110 haoqing0110 commented Apr 3, 2026

Copy link
Copy Markdown
Member

Update the debug section to reflect changes from ocm PR #1461:

  • Add PlacementDebugServer feature gate enablement steps
  • Update port from 8443 to 9443 (debug-server sidecar)
  • Add Service port-forward option
  • Fix kubectl create role command syntax
  • Add POST method for placement simulation
  • Fix field name: filteredPiplieResults -> filteredPipelineResults
  • Add new fields: placement, aggregatedScores
  • Update example output with proper JSON formatting
  • Add troubleshooting section

The debug server now runs as a standalone sidecar container with proper ClusterSet validation and permission checks.

Summary by CodeRabbit

  • Documentation
    • Switched placement debug workflow to a sidecar-based debug server enabled via a feature gate
    • Debug endpoints now reachable on port 9443 with updated /debug/placements/ path
    • Added "Simulate a Placement" step to POST a Placement JSON for testing without creating real resources
    • Updated example debug responses: corrected field names and added aggregatedScores for richer output

@netlify

netlify Bot commented Apr 3, 2026

Copy link
Copy Markdown

Deploy Preview for open-cluster-management ready!

Name Link
🔨 Latest commit 62109fe
🔍 Latest deploy log https://app.netlify.com/projects/open-cluster-management/deploys/69d60bc984610b0008f58b7a
😎 Deploy Preview https://deploy-preview-554--open-cluster-management.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci
openshift-ci Bot requested review from qiujian16 and xuezhaojun April 3, 2026 07:47
@openshift-ci

openshift-ci Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: haoqing0110
Once this PR has been reviewed and has the lgtm label, please assign mikeshng for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown

Walkthrough

Updated placement controller debug documentation to use a sidecar PlacementDebugServer, change port-forwarding to 9443, switch debug endpoints to /debug/placements/*, revise RBAC guidance, add a POST-based "simulate placement" flow, and update the example debug response structure.

Changes

Cohort / File(s) Summary
Placement Controller Debug Documentation
content/en/docs/concepts/content-placement/placement.md
Reworked Debug section to use the PlacementDebugServer sidecar feature gate; replace previous clusterrole/port-forward approach with port-forwarding to placement service on 9443; change debug paths to /debug/placements/*; update anonymous RBAC non-resource path and add per-target-namespace role for placements.cluster.open-cluster-management.io create/get; add POST /debug/placements/ to simulate custom Placement JSON; update example response to include filteredPipelineResults, prioritizeResults, and aggregatedScores (removed old filteredPiplieResults and 8443 references).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: updating documentation for the Placement debug endpoint, which aligns with the primary focus of the PR on reworking the debug section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@content/en/docs/concepts/content-placement/placement.md`:
- Around line 729-731: The fenced bash code block containing the curl example
includes a leading shell prompt `$` which triggers MD014; edit the fenced block
(the ```bash block that currently contains "$ curl -k
https://127.0.0.1:9443/debug/placements/default/placement1") to remove the `$`
so the block contains just the plain command `curl -k
https://127.0.0.1:9443/debug/placements/default/placement1` and close the fence
as ``` to satisfy markdownlint.
- Around line 675-689: Replace the unsafe use of the unauthenticated principal
`system:anonymous` in the ClusterRoleBinding `debugger` and the RoleBinding
`placement-debugger` with a dedicated ServiceAccount: create a ServiceAccount
(e.g., `debugger-sa`) in the intended namespace, bind the `debugger` ClusterRole
and the `placement-debugger` Role to that ServiceAccount instead of
`system:anonymous`, and add a short note documenting how to delete the
ServiceAccount and its bindings after debugging (e.g., `kubectl delete
rolebinding placement-debugger`, `kubectl delete clusterrolebinding debugger`,
`kubectl delete serviceaccount debugger-sa -n <namespace>`).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8e465120-705b-4bac-abc4-b4d86618e08c

📥 Commits

Reviewing files that changed from the base of the PR and between d3fe08f and 7dfd8e6.

📒 Files selected for processing (1)
  • content/en/docs/concepts/content-placement/placement.md

Comment on lines +675 to +689
kubectl create clusterrolebinding debugger \
--clusterrole=debugger \
--user=system:anonymous

# Grant permission to create placements in the target namespace
# Replace <namespace> with your placement namespace
kubectl create role placement-debugger \
--verb=create,get \
--resource=placements.cluster.open-cluster-management.io \
-n <namespace>

kubectl create rolebinding placement-debugger \
--role=placement-debugger \
--user=system:anonymous \
-n <namespace>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid binding debug privileges to system:anonymous.

Line 675 and Line 686 grant debug and placement-create permissions to an unauthenticated principal. This is risky for shared or production-like hubs; use a dedicated user/service account and document cleanup after debugging.

Suggested doc patch
-kubectl create clusterrolebinding debugger \
-  --clusterrole=debugger \
-  --user=system:anonymous
+kubectl create clusterrolebinding debugger \
+  --clusterrole=debugger \
+  --user=<debug-user>
@@
-kubectl create rolebinding placement-debugger \
-  --role=placement-debugger \
-  --user=system:anonymous \
-  -n <namespace>
+kubectl create rolebinding placement-debugger \
+  --role=placement-debugger \
+  --user=<debug-user> \
+  -n <namespace>
+
+# (Optional) remove bindings after debugging
+# kubectl delete clusterrolebinding debugger
+# kubectl delete rolebinding placement-debugger -n <namespace>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/concepts/content-placement/placement.md` around lines 675 -
689, Replace the unsafe use of the unauthenticated principal `system:anonymous`
in the ClusterRoleBinding `debugger` and the RoleBinding `placement-debugger`
with a dedicated ServiceAccount: create a ServiceAccount (e.g., `debugger-sa`)
in the intended namespace, bind the `debugger` ClusterRole and the
`placement-debugger` Role to that ServiceAccount instead of `system:anonymous`,
and add a short note documenting how to delete the ServiceAccount and its
bindings after debugging (e.g., `kubectl delete rolebinding placement-debugger`,
`kubectl delete clusterrolebinding debugger`, `kubectl delete serviceaccount
debugger-sa -n <namespace>`).

Comment thread content/en/docs/concepts/content-placement/placement.md
@haoqing0110
haoqing0110 force-pushed the update-placement-debug-docs branch from 7dfd8e6 to 7dd4e92 Compare April 8, 2026 07:21

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
content/en/docs/concepts/content-placement/placement.md (2)

729-729: ⚠️ Potential issue | 🟡 Minor

Remove shell prompt to satisfy markdownlint MD014.

Line 729 should not include $ in this fenced bash command block.

Suggested doc fix
- $ curl -k https://127.0.0.1:9443/debug/placements/default/placement1
+ curl -k https://127.0.0.1:9443/debug/placements/default/placement1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/concepts/content-placement/placement.md` at line 729, The
fenced bash code block contains a shell prompt character ("$") before the curl
command which violates markdownlint MD014; edit the placement example (the
fenced block that currently contains "$ curl -k
https://127.0.0.1:9443/debug/placements/default/placement1") and remove the
leading "$" so the block contains only the command "curl -k
https://127.0.0.1:9443/debug/placements/default/placement1".

675-689: ⚠️ Potential issue | 🟠 Major

Avoid documenting system:anonymous for debug RBAC bindings.

Line 675 and Line 686 still bind powerful debug permissions to an unauthenticated principal. Please switch to a dedicated user or ServiceAccount and add cleanup commands after debugging.

Suggested doc fix
 kubectl create clusterrolebinding debugger \
   --clusterrole=debugger \
-  --user=system:anonymous
+  --user=<debug-user>
@@
 kubectl create rolebinding placement-debugger \
   --role=placement-debugger \
-  --user=system:anonymous \
+  --user=<debug-user> \
   -n <namespace>
+
+# Optional cleanup
+# kubectl delete clusterrolebinding debugger
+# kubectl delete rolebinding placement-debugger -n <namespace>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/concepts/content-placement/placement.md` around lines 675 -
689, Replace the unauthenticated system:anonymous subject in the debug RBAC
examples by creating and using a dedicated ServiceAccount (e.g., create a
ServiceAccount in the target namespace and bind it with kubectl create
clusterrolebinding/debugger and kubectl create rolebinding/placement-debugger
via the --serviceaccount=<namespace>:<name> subject), update the kubectl
examples that currently use --user=system:anonymous to use --serviceaccount and
the correct namespace, and add cleanup commands to delete the ServiceAccount,
Role, RoleBinding, ClusterRoleBinding (e.g., kubectl delete rolebinding
placement-debugger, role placement-debugger, clusterrolebinding debugger, and
kubectl delete serviceaccount <name> -n <namespace>) after debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@content/en/docs/concepts/content-placement/placement.md`:
- Line 729: The fenced bash code block contains a shell prompt character ("$")
before the curl command which violates markdownlint MD014; edit the placement
example (the fenced block that currently contains "$ curl -k
https://127.0.0.1:9443/debug/placements/default/placement1") and remove the
leading "$" so the block contains only the command "curl -k
https://127.0.0.1:9443/debug/placements/default/placement1".
- Around line 675-689: Replace the unauthenticated system:anonymous subject in
the debug RBAC examples by creating and using a dedicated ServiceAccount (e.g.,
create a ServiceAccount in the target namespace and bind it with kubectl create
clusterrolebinding/debugger and kubectl create rolebinding/placement-debugger
via the --serviceaccount=<namespace>:<name> subject), update the kubectl
examples that currently use --user=system:anonymous to use --serviceaccount and
the correct namespace, and add cleanup commands to delete the ServiceAccount,
Role, RoleBinding, ClusterRoleBinding (e.g., kubectl delete rolebinding
placement-debugger, role placement-debugger, clusterrolebinding debugger, and
kubectl delete serviceaccount <name> -n <namespace>) after debugging.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a76c7fb4-bfc8-4bac-b38e-3007588987a9

📥 Commits

Reviewing files that changed from the base of the PR and between 7dfd8e6 and 7dd4e92.

📒 Files selected for processing (1)
  • content/en/docs/concepts/content-placement/placement.md

Update the debug section to reflect changes from ocm PR #1461:
- Add PlacementDebugServer feature gate enablement steps
- Update port from 8443 to 9443 (debug-server sidecar)
- Add Service port-forward option
- Fix kubectl create role command syntax
- Add POST method for placement simulation
- Fix field name: filteredPiplieResults -> filteredPipelineResults
- Add new fields: placement, aggregatedScores
- Update example output with proper JSON formatting
- Add troubleshooting section

The debug server now runs as a standalone sidecar container with
proper ClusterSet validation and permission checks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Qing Hao <qhao@redhat.com>
@haoqing0110
haoqing0110 force-pushed the update-placement-debug-docs branch from 7dd4e92 to 62109fe Compare April 8, 2026 08:03
@haoqing0110

Copy link
Copy Markdown
Member Author

/assign @qiujian16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
content/en/docs/concepts/content-placement/placement.md (1)

657-663: Improve the section title for clarity.

Export placement 9443 port to local. is grammatically awkward. Consider phrasing it as a port-forward action.

Suggested doc wording
-#### Export placement 9443 port to local.
+#### Port-forward debug server port 9443 to local
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/concepts/content-placement/placement.md` around lines 657 -
663, The section heading "Export placement 9443 port to local." is awkward;
update the heading to a clearer port-forward action such as "Port-forward
placement port 9443 to localhost" or "Port-forward the placement service (port
9443) to localhost", and ensure the accompanying command block (kubectl
port-forward -n open-cluster-management-hub svc/cluster-manager-placement
9443:9443) remains unchanged and still follows the new heading.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@content/en/docs/concepts/content-placement/placement.md`:
- Around line 657-663: The section heading "Export placement 9443 port to
local." is awkward; update the heading to a clearer port-forward action such as
"Port-forward placement port 9443 to localhost" or "Port-forward the placement
service (port 9443) to localhost", and ensure the accompanying command block
(kubectl port-forward -n open-cluster-management-hub
svc/cluster-manager-placement 9443:9443) remains unchanged and still follows the
new heading.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7fd423a-7fa5-429b-9886-69d687bfdb00

📥 Commits

Reviewing files that changed from the base of the PR and between 7dd4e92 and 62109fe.

📒 Files selected for processing (1)
  • content/en/docs/concepts/content-placement/placement.md

Access the debug endpoint for a specific placement:

```bash
curl -k https://127.0.0.1:9443/debug/placements/<namespace>/<name>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we mention that it should include credential info, like bearer token?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants