From e175758ec432e6d9d8c4efac00b3843b8e8e1a84 Mon Sep 17 00:00:00 2001 From: huizhang Date: Fri, 29 Aug 2025 15:15:00 +0800 Subject: [PATCH 1/3] add how-to-customize-consoleyamlsamples --- ...ow_To_Customize_Samples_for_Web_Console.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md diff --git a/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md new file mode 100644 index 00000000..69b2343c --- /dev/null +++ b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md @@ -0,0 +1,67 @@ +--- +products + - Alauda Container Platform +kind + - Solution +--- + +# How to Customize Samples for Web Console + +You can dynamically add YAML examples to any Kubernetes resources at any time. + +## Rerequisites + +- You must have cluster administrator privileges. +- The resource you want to add a sample for must already exist in the cluster. + +## Resolution + +Creating a YAML example for the `Deployment` resource. + +Create a `ConsoleYAMLSample` object. +```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: | + apiVersion: apps/v1 + kind: Deployment + metadata: + name: nginx-deploy + spec: + replicas: 2 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.25 +``` + +Note​​: ConsoleYAMLSample is a cluster-scoped resource – do not specify a namespace during creation. + + +Below is the 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 | + + +This resource allows users to seamlessly integrate custom YAML examples directly into the Alauda web console, improving usability and accelerating development workflows. + From c3aad39a5eb0a82aca229ed34d8d356dddf3572f Mon Sep 17 00:00:00 2001 From: huizhang Date: Fri, 29 Aug 2025 15:45:42 +0800 Subject: [PATCH 2/3] add how-to-customize-consoleyamlsamples --- .../solutions/How_To_Customize_Samples_for_Web_Console.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md index 69b2343c..caa5e165 100644 --- a/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md +++ b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md @@ -1,7 +1,8 @@ --- -products +id: KB250500032 +products: - Alauda Container Platform -kind +kind: - Solution --- @@ -55,7 +56,7 @@ Note​​: ConsoleYAMLSample is a cluster-scoped resource – do not specify a Below is the 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 | @@ -64,4 +65,3 @@ Below is the field specification: This resource allows users to seamlessly integrate custom YAML examples directly into the Alauda web console, improving usability and accelerating development workflows. - From 2dceab1a3bf66c07fd75afabc4895b616dbdfef2 Mon Sep 17 00:00:00 2001 From: huizhang Date: Fri, 29 Aug 2025 16:04:36 +0800 Subject: [PATCH 3/3] fix code review --- .../How_To_Customize_Samples_for_Web_Console.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md index caa5e165..9d762262 100644 --- a/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md +++ b/docs/en/solutions/How_To_Customize_Samples_for_Web_Console.md @@ -10,16 +10,16 @@ kind: You can dynamically add YAML examples to any Kubernetes resources at any time. -## Rerequisites +## Prerequisites - You must have cluster administrator privileges. -- The resource you want to add a sample for must already exist in the cluster. +- Target for `Custom Resources`, ensure the CRD (apiVersion/kind) is already installed in the cluster. ## Resolution -Creating a YAML example for the `Deployment` resource. +1). Create a YAML example for the `Deployment` resource by defining a `ConsoleYAMLSample` object. -Create a `ConsoleYAMLSample` object. +2). Apply the object to the cluster: ```yaml apiVersion: console.alauda.io/v1 kind: ConsoleYAMLSample @@ -53,8 +53,7 @@ spec: Note​​: ConsoleYAMLSample is a cluster-scoped resource – do not specify a namespace during creation. - -Below is the field specification: +Field specification: | Field | Description | Required/Optional | | --------- | --------- | ----------- | | title | The title of the sample as displayed in the web UI. | Required | @@ -63,5 +62,4 @@ Below is the field specification: | 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 | - This resource allows users to seamlessly integrate custom YAML examples directly into the Alauda web console, improving usability and accelerating development workflows.