Skip to content

add how-to-customize-consoleyamlsamples#45

Merged
zhhray merged 3 commits intomainfrom
feat/add-how-to-customize-consoleyamlsamples
Sep 9, 2025
Merged

add how-to-customize-consoleyamlsamples#45
zhhray merged 3 commits intomainfrom
feat/add-how-to-customize-consoleyamlsamples

Conversation

@zhhray
Copy link
Copy Markdown
Contributor

@zhhray zhhray commented Aug 29, 2025

add how to customize consoleyamlsamples

Summary by CodeRabbit

  • Documentation
    • Added a user guide for integrating custom YAML samples into the web console via a new ConsoleYAMLSample resource.
    • Describes required fields (title, description, target resource, yaml), optional snippet display, and cluster-scoped usage (do not set a namespace).
    • Notes that sample YAML must match the target resource schema.
    • Includes a full example and a field reference for authors.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 29, 2025

Walkthrough

Adds documentation for a new cluster-scoped Kubernetes CRD, ConsoleYAMLSample (console.alauda.io/v1), describing its spec (title, description, targetResource, yaml, optional snippet), required/optional fields, an example targeting a Deployment, and notes on schema conformance and cluster scope for integrating YAML samples into the Alauda web console.

Changes

Cohort / File(s) Summary
Docs: ConsoleYAMLSample CRD guide
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
New/updated documentation introducing the cluster-scoped ConsoleYAMLSample CRD: explains spec fields (title, description, targetResource.apiVersion & targetResource.kind, yaml, optional snippet), required vs optional fields, example manifest (sample-deployment targeting Deployment), note that samples must conform to target resource schema, and that resource must not set a namespace.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant WebConsole
  participant K8sAPI as "K8s API Server"

  User->>WebConsole: Open YAML samples panel
  WebConsole->>K8sAPI: List ConsoleYAMLSample (console.alauda.io/v1)
  K8sAPI-->>WebConsole: Return ConsoleYAMLSample objects
  WebConsole->>WebConsole: Filter by targetResource (apiVersion/kind)
  alt snippet == true
    WebConsole->>User: Render code snippet only
  else full sample
    WebConsole->>User: Render full YAML template
  end
  note over WebConsole,K8sAPI: Samples must conform to target resource schema and be cluster-scoped
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump and jot a YAML beat,
Cluster samples tidy, neat.
Titles, kinds, and snippets gleam,
Deployments dance inside the stream.
A rabbit hops — docs done right, sweet treat! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-how-to-customize-consoleyamlsamples

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (4)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (4)

10-10: Grammar: singular “resource”.

Use singular when referring to “any … resource”.

-You can dynamically add YAML examples to any Kubernetes resources at any time. 
+You can dynamically add YAML examples to any Kubernetes resource at any time.

23-51: Optional: demonstrate snippet usage.

Since snippet is documented below, add a minimal second example that sets snippet: true.

@@
 ```yaml
 apiVersion: console.alauda.io/v1
 kind: ConsoleYAMLSample
 metadata:
   name: sample-deployment
 spec:
   title: "NGINX Deployment"
   description: "Sample deployment with 2 replicas"
   targetResource:
     apiVersion: apps/v1
     kind: Deployment
   yaml: |
@@
             image: nginx:1.25

+```yaml
+# Optional: snippet-only example
+apiVersion: console.alauda.io/v1
+kind: ConsoleYAMLSample
+metadata:

  • name: sample-pod-snippet
    +spec:
  • title: "Pod container snippet"
  • description: "Container spec only; shown as a snippet"
  • targetResource:
  • apiVersion: v1
  • kind: Pod
  • snippet: true
  • yaml: |
  • containers:
    • name: app
  •  image: nginx:1.25
    

+```


---

`53-53`: **Normalize note punctuation; remove hidden characters.**

Use a standard “Note:” and an em dash for clarity; avoids zero-width characters.


```diff
-Note​​: ConsoleYAMLSample is a cluster-scoped resource – do not specify a namespace during creation.
+Note: ConsoleYAMLSample is a cluster-scoped resource—do not specify a namespace during creation.

66-66: Tighten closing sentence.

Minor style polish.

-This resource allows users to seamlessly integrate custom YAML examples directly into the Alauda web console, improving usability and accelerating development workflows.
+This resource integrates custom YAML examples into the Alauda web console, improving usability and accelerating workflows.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 563d3dc and e175758.

📒 Files selected for processing (1)
  • docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

[grammar] ~56-~56: There might be a mistake here.
Context: ...ion. Below is the field specification: | Field | Description | Required/Option...

(QB_NEW_EN)


[grammar] ~57-~57: There might be a mistake here.
Context: ...eld | Description | Required/Optional | | --- | --- | --- | | title | The title ...

(QB_NEW_EN)


[grammar] ~58-~58: There might be a mistake here.
Context: ... Required/Optional | | --- | --- | --- | | title | The title of the sample as dis...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

57-57: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md Outdated
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (4)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (4)

15-16: Clarify CRD requirement.

 - You must have cluster administrator privileges. 
 - The resource you want to add a sample for must already exist in the cluster.
+ - For Custom Resources, ensure the CRD (apiVersion/kind) is already installed in the cluster.

13-13: Typo: “Prerequisites”.

-## Rerequisites
+## Prerequisites

18-22: Make steps actionable; number them and show apply command.

 ## Resolution
-
-Creating a YAML example for the `Deployment` resource.
-
-Create a `ConsoleYAMLSample` object.
+1) Create a YAML example for the `Deployment` resource by defining a `ConsoleYAMLSample` object:

Add after the YAML block:

+2) Apply the object to the cluster:
+
+```bash
+kubectl apply -f sample-deployment.yaml
+```

Also applies to: 52-52


57-65: Fix table formatting (MD058) and tighten intro.

Add blank lines around the table and streamline the lead-in so linters render it correctly.

-Below is the field specification:
+Field specification:
+
 | Field | Description |  Required/Optional |
 | --------- | --------- | ----------- |
 | title | The title of the sample as displayed in the web UI. | Required |
 | description | A detailed description of the sample. | Required |
 | targetResource | Specifies the target resource type using apiVersion and kind. This supports both native Kubernetes resources and Custom Resource Definitions (CRDs). | Required |
 | yaml | The actual YAML template. Must conform to the schema of the target resource. | Required |
 | snippet | When set to true, only a code snippet is displayed instead of the full YAML. | Optional |
+
🧹 Nitpick comments (2)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (2)

11-11: Tighten phrasing.

Prefer singular or drop “any” to avoid redundancy.

-You can dynamically add YAML examples to any Kubernetes resources at any time. 
+You can dynamically add YAML examples to Kubernetes resources at any time.

54-54: Normalize the Note line; remove zero‑width characters and use a standard dash.

-Note​​: ConsoleYAMLSample is a cluster-scoped resource – do not specify a namespace during creation.
+Note: `ConsoleYAMLSample` is cluster-scoped—do not specify a namespace during creation.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e175758 and c3aad39.

📒 Files selected for processing (1)
  • docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

[grammar] ~57-~57: There might be a mistake here.
Context: ...ion. Below is the field specification: | Field | Description | Required/Option...

(QB_NEW_EN)


[grammar] ~58-~58: There might be a mistake here.
Context: ...eld | Description | Required/Optional | | --------- | --------- | ----------- | ...

(QB_NEW_EN)


[grammar] ~59-~59: There might be a mistake here.
Context: ... | --------- | --------- | ----------- | | title | The title of the sample as dis...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

58-58: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🔇 Additional comments (2)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (2)

1-7: Front matter looks valid.

YAML now parses as a proper mapping with lists. Good fix.


24-26: Verify CRD apiVersion and cluster scope
Ensure the ConsoleYAMLSample CRD in your cluster uses apiVersion: console.alauda.io/v1 and is cluster-scoped.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (1)

56-64: Surround table with blank lines (MD058).

Add a blank line before the table so it renders correctly. This was flagged previously and remains unresolved.

-Field specification:
+Field specification:
+
 | Field | Description |  Required/Optional |
 | --------- | --------- | ----------- |
 | title | The title of the sample as displayed in the web UI. | Required |
 | description | A detailed description of the sample. | Required |
 | targetResource | Specifies the target resource type using apiVersion and kind. This supports both native Kubernetes resources and Custom Resource Definitions (CRDs). | Required |
 | yaml | The actual YAML template. Must conform to the schema of the target resource. | Required |
 | snippet | When set to true, only a code snippet is displayed instead of the full YAML. | Optional |
🧹 Nitpick comments (1)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (1)

11-11: Grammar tweak: singular "resource".

Use “resource” (singular) here.

-You can dynamically add YAML examples to any Kubernetes resources at any time. 
+You can dynamically add YAML examples to any Kubernetes resource at any time.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c3aad39 and 2dceab1.

📒 Files selected for processing (1)
  • docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

[grammar] ~56-~56: There might be a mistake here.
Context: ...e during creation. Field specification: | Field | Description | Required/Option...

(QB_NEW_EN)


[grammar] ~57-~57: There might be a mistake here.
Context: ...eld | Description | Required/Optional | | --------- | --------- | ----------- | ...

(QB_NEW_EN)


[grammar] ~58-~58: There might be a mistake here.
Context: ... | --------- | --------- | ----------- | | title | The title of the sample as dis...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md

57-57: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
Comment thread docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md
@zhhray zhhray merged commit c2c367e into main Sep 9, 2025
2 checks passed
@zhhray zhhray deleted the feat/add-how-to-customize-consoleyamlsamples branch September 9, 2025 08:02
changluyi pushed a commit to changluyi/knowledge that referenced this pull request Apr 23, 2026
* add how-to-customize-consoleyamlsamples

---------

Co-authored-by: huizhang <huizhang@alauda.io>
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.

1 participant