Skip to content

Commit

Permalink
docs: fix format bugs (#8579)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle-0808 authored Dec 4, 2024
1 parent 48b3638 commit 7c4cdd4
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,42 @@ The following variables are injected by KubeBlocks into each pod.

| Name | Description |
| :--- | :---------- |
| KB_POD_NAME | K8s Pod Name |
| KB_NAMESPACE | K8s Pod Namespace |
| KB_SA_NAME | KubeBlocks Service Account Name |
| KB_NODENAME | K8s Node Name |
| KB_HOSTIP | K8s Host IP address |
| KB_PODIP | K8s Pod IP address |
| KB_PODIPS | K8s Pod IP addresses |
| KB_POD_UID | POD UID (`pod.metadata.uid`) |
| KB_CLUSTER_NAME | KubeBlocks Cluster API object name |
| KB_COMP_NAME | Running pod's KubeBlocks Cluster API object's `.spec.components.name` |
| KB_CLUSTER_COMP_NAME | Running pod's KubeBlocks Cluster API object's `<.metadata.name>-<.spec.components.name>` |
| KB_REPLICA_COUNT | Running pod's component's replica |
| KB_CLUSTER_UID | Running pods' KubeBlocks Cluster API object's `metadata.uid` |
| KB_CLUSTER_UID_POSTFIX_8 | Last eight digits of KB_CLUSTER_UID |
| KB_{ordinal}_HOSTNAME | Running pod's hostname, where `{ordinal}` is the ordinal of pod. <br /> N/A if workloadType=Stateless. |
| KB_POD_FQDN | Running pod's fully qualified domain name (FQDN). <br /> N/A if workloadType=Stateless. |
| `KB_POD_NAME` | K8s Pod Name |
| `KB_NAMESPACE` | K8s Pod Namespace |
| `KB_SA_NAME` | KubeBlocks Service Account Name |
| `KB_NODENAME` | K8s Node Name |
| `KB_HOSTIP` | K8s Host IP address |
| `KB_PODIP` | K8s Pod IP address |
| `KB_PODIPS` | K8s Pod IP addresses |
| `KB_POD_UID` | POD UID (`pod.metadata.uid`) |
| `KB_CLUSTER_NAME` | KubeBlocks Cluster API object name |
| `KB_COMP_NAME` | Running pod's KubeBlocks Cluster API object's `.spec.components.name` |
| `KB_CLUSTER_COMP_NAME` | Running pod's KubeBlocks Cluster API object's `<.metadata.name>-<.spec.components.name>` |
| `KB_REPLICA_COUNT` | Running pod's component's replica |
| `KB_CLUSTER_UID` | Running pods' KubeBlocks Cluster API object's `metadata.uid` |
| `KB_CLUSTER_UID_POSTFIX_8` | Last eight digits of KB_CLUSTER_UID |
| `KB_{ordinal}_HOSTNAME` | Running pod's hostname, where `{ordinal}` is the ordinal of pod. <br /> N/A if workloadType=Stateless. |
| `KB_POD_FQDN` | Running pod's fully qualified domain name (FQDN). <br /> N/A if workloadType=Stateless. |

## Built-in Place-holders

### ComponentValueFrom API

| Name | Description |
| :--- | :---------- |
| POD_ORDINAL | Pod ordinal |
| POD_FQDN | Pod FQDN (fully qualified domain name) |
| POD_NAME | Pod Name |
| `POD_ORDINAL` | Pod ordinal |
| `POD_FQDN` | Pod FQDN (fully qualified domain name) |
| `POD_NAME` | Pod Name |

### ConnectionCredential API

| Name | Description |
| :--- | :---------- |
| UUID | Generate a random UUID v4 string. |
| UUID_B64 | Generate a random UUID v4 BASE64 encoded string. |
| UUID_STR_B64 | Generate a random UUID v4 string then BASE64 encoded. |
| UUID_HEX | Generate a random UUID v4 HEX representation. |
| HEADLESS_SVC_FQDN | Headless service FQDN placeholder, value pattern - `$(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc`, where 1ST_COMP_NAME is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute. |
| SVC_FQDN | Service FQDN placeholder, value pattern - `$(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc`, where 1ST_COMP_NAME is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute. |
| SVC_PORT_{PORT_NAME} | A ServicePort's port value with specified port name, i.e, a servicePort JSON struct: <br /> `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}`, and "$(SVC_PORT_mysql)" in the connection credential value is 3306. |
| RANDOM_PASSWD | Random 8 characters |
| `UUID` | Generate a random UUID v4 string. |
| `UUID_B64` | Generate a random UUID v4 BASE64 encoded string. |
| `UUID_STR_B64` | Generate a random UUID v4 string then BASE64 encoded. |
| `UUID_HEX` | Generate a random UUID v4 HEX representation. |
| `HEADLESS_SVC_FQDN` | Headless service FQDN placeholder, value pattern - `$(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc`, where `1ST_COMP_NAME` is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute. |
| `SVC_FQDN` | Service FQDN placeholder, value pattern - `$(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc`, where 1ST_COMP_NAME is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute. |
| `SVC_PORT_{PORT_NAME}` | A ServicePort's port value with specified port name, i.e, a servicePort JSON struct: <br /> `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}`, and `"$(SVC_PORT_mysql)"` in the connection credential value is 3306. |
| `RANDOM_PASSWD` | Random 8 characters |
8 changes: 4 additions & 4 deletions docs/developer_docs/integration/multi-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ Case 2: Nebula-Graphd needs to configure the DNS of all PODs of Nebula-Metad.
:::note

KubeBlocks provides three built-in variables as placeholders and they will be replaced with specific values when the cluster is created:
- ${POD_ORDINAL}, which is the ordinal number of the Pod.
- ${POD_NAME}, which is the name of the Pod, formatted as `{clusterName}-{componentName}-{podOrdinal}`.
- ${POD_FQDN}, which is the Fully Qualified Domain Name (FQDN) of the Pod.
- `${POD_ORDINAL}`, which is the ordinal number of the Pod.
- `${POD_NAME}`, which is the name of the Pod, formatted as `{clusterName}-{componentName}-{podOrdinal}`.
- `${POD_FQDN}`, which is the Fully Qualified Domain Name (FQDN) of the Pod.

In KubeBlocks, each stateful component has a Headless Service named `headlessServiceName = {clusterName}-{componentName}-headless` by default.

Expand All @@ -196,7 +196,7 @@ Therefore, the format of the Pod FQDN of each stateful component is:

Case 3: Nebula-Console needs to obtain a service port name of Nebula-Graphd.

When defining `nebula-console` , add the following configurations (as `componentDefRef` shows):
When defining `nebula-console`, add the following configurations (as `componentDefRef` shows):

```yaml
- name: nebula-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ In the production environment, it is normal to connect a database with CLI and S
- Scenario 3: Client3 and the database are in different VPCs, such as other VPCs or the public network. To connect client3 and the database, see [Expose VPC Public Address](#scenario-3-connect-database-with-clients-in-other-vpcs-or-public-networks).

See the figure below to get a clear image of the network location.

![Example](./../../img/connect_database_in_a_production_environment.png)

## Scenario 1. Connect database in the same Kubernetes cluster

You can connect with the database ClusterIP or domain name.

<Tabs>

<TabItem value="kbcli" label="kbcli" default>

To check the database endpoint, use `kbcli cluster describe ${cluster-name}`.
Expand Down Expand Up @@ -57,6 +59,7 @@ TIME TYPE REASON OBJECT MESSAGE
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

To check the database endpoint, use `kubectl get service <cluster-name>-<component-name>`.
Expand All @@ -66,6 +69,7 @@ kubectl get service mycluster-mysql
```

</TabItem>

</Tabs>

## Scenario 2. Client outside the Kubernetes cluster but in the same VPC as the Kubernetes cluster
Expand All @@ -79,13 +83,15 @@ The following command creates a LoadBalancer instance for the database instance,
:::

<Tabs>

<TabItem value="kbcli" label="kbcli" default>

```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=true
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

This example uses a MySQL cluster to demonstrate how to expose a VPC address on Alibaba Cloud.
Expand All @@ -111,6 +117,7 @@ spec:
```
</TabItem>
</Tabs>
To disable the LoadBalancer instance, execute the following command.
Expand All @@ -122,13 +129,15 @@ Once disabled, the instance is not accessible.
:::
<Tabs>
<TabItem value="kbcli" label="kbcli" default>
```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=false
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

```yaml
Expand All @@ -152,6 +161,7 @@ spec:
```
</TabItem>
</Tabs>
## Scenario 3. Connect database with clients in other VPCs or public networks
Expand All @@ -165,13 +175,15 @@ The following command creates a LoadBalancer instance for the database instance,
:::
<Tabs>
<TabItem value="kbcli" label="kbcli" default>
```bash
kbcli cluster expose ${cluster-name} --type internet --enable=true
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

The example uses MySQL to demonstrate how to expose the public address on Alibaba Cloud.
Expand All @@ -197,18 +209,21 @@ spec:
```
</TabItem>
</Tabs>
To disable the LoadBalancer instance, execute the following command.
<Tabs>
<TabItem value="kbcli" label="kbcli" default>
```bash
kbcli cluster expose ${cluster-name} --type internet --enable=false
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

```yaml
Expand All @@ -232,6 +247,7 @@ spec:
```
</TabItem>
</Tabs>
:::note
Expand Down
3 changes: 3 additions & 0 deletions docs/user_docs/installation/install-addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sidebar_position: 4
sidebar_label: Install Addons
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Install Addons

With the release of KubeBlocks v0.8.0, Addons are decoupled from KubeBlocks and some Addons are not installed by default. If you want to use these Addons, install Addons first by index. Or if you uninstalled some Addons, you can follow the steps in this tutorial to install them again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,42 @@ sidebar_label: 环境变量和占位符

| 名称 | 说明 |
| :--- | :---------- |
| KB_POD_NAME | K8s Pod 名称 |
| KB_NAMESPACE | K8s Pod 命名空间 |
| KB_SA_NAME | KubeBlocks 服务账号名称 |
| KB_NODENAME | K8s 节点名称 |
| KB_HOSTIP | K8s 主机 IP 地址 |
| KB_PODIP | K8s Pod IP 地址 |
| KB_PODIPS | K8s Pod IP 地址 |
| KB_POD_UID | POD UID (`pod.metadata.uid`) |
| KB_CLUSTER_NAME | KubeBlocks 集群 API 对象名称 |
| KB_COMP_NAME | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `.spec.components.name`|
| KB_CLUSTER_COMP_NAME | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `<.metadata.name>-<.spec.components.name>`|
| KB_REPLICA_COUNT | 运行中 Pod 的组件副本数 |
| KB_CLUSTER_UID | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `metadata.uid`|
| KB_CLUSTER_UID_POSTFIX_8 | KB_CLUSTER_UID 的最后八位数字 |
| KB_{ordinal}_HOSTNAME | 运行中 Pod 的主机名,其中 `{ordinal}` 是 Pod 的序号。<br />如果工作负载类型为无状态(Stateless),则不适用。 |
| KB_POD_FQDN | 运行中 Pod 的完全限定域名(FQDN)。<br />如果工作负载类型为无状态(Stateless),则不适用。|
| `KB_POD_NAME` | K8s Pod 名称 |
| `KB_NAMESPACE` | K8s Pod 命名空间 |
| `KB_SA_NAME` | KubeBlocks 服务账号名称 |
| `KB_NODENAME` | K8s 节点名称 |
| `KB_HOSTIP` | K8s 主机 IP 地址 |
| `KB_PODIP` | K8s Pod IP 地址 |
| `KB_PODIPS` | K8s Pod IP 地址 |
| `KB_POD_UID` | POD UID (`pod.metadata.uid`) |
| `KB_CLUSTER_NAME` | KubeBlocks 集群 API 对象名称 |
| `KB_COMP_NAME` | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `.spec.components.name`|
| `KB_CLUSTER_COMP_NAME` | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `<.metadata.name>-<.spec.components.name>`|
| `KB_REPLICA_COUNT` | 运行中 Pod 的组件副本数 |
| `KB_CLUSTER_UID` | 运行中 Pod 的 KubeBlocks 集群 API 对象的 `metadata.uid`|
| `KB_CLUSTER_UID_POSTFIX_8` | `KB_CLUSTER_UID` 的最后八位数字 |
| `KB_{ordinal}_HOSTNAME` | 运行中 Pod 的主机名,其中 `{ordinal}` 是 Pod 的序号。<br />如果工作负载类型为无状态(Stateless),则不适用。 |
| `KB_POD_FQDN` | 运行中 Pod 的完全限定域名(FQDN)。<br />如果工作负载类型为无状态(Stateless),则不适用。|

## 占位符

### ComponentValueFrom API

| 名称 | 说明 |
| :--- | :---------- |
| POD_ORDINAL | Pod 的序号 |
| POD_FQDN | Pod 的完全限定域名(FQDN) |
| POD_NAME | Pod 的名称 |
| `POD_ORDINAL` | Pod 的序号 |
| `POD_FQDN` | Pod 的完全限定域名(FQDN) |
| `POD_NAME` | Pod 的名称 |

### ConnectionCredential API

| 名称 | 说明 |
| :--- | :---------- |
| UUID | 生成一个随机的 UUID v4 字符串 |
| UUID_B64 | 生成一个随机的 UUID v4 BASE64 编码的字符串 |
| UUID_STR_B64 | 生成一个随机的 UUID v4 字符串,然后进行 BASE64 编码 |
| UUID_HEX | 生成一个随机的 UUID v4 的 HEX 表示 |
| HEADLESS_SVC_FQDN | 无头服务的 FQDN 占位符。值为 `- $(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc`,其中 1ST_COMP_NAME 是提供 `ClusterDefinition.spec.componentDefs[].service` 属性的第一个组件。|
| SVC_FQDN | 服务的 FQDN 占位符。值为 `- $(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc`,其中 1ST_COMP_NAME 是提供 `ClusterDefinition.spec.componentDefs[].service` 属性的第一个组件。 |
| SVC_PORT_{PORT_NAME} | 具有指定端口名称的 ServicePort 的端口值。例如,在一个 servicePort 的 JSON struct:<br /> `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}` 中,连接凭证值中的 "$(SVC_PORT_mysql)" 为 3306。 |
| RANDOM_PASSWD | 随机生成的 8 个字符 |
| `UUID` | 生成一个随机的 UUID v4 字符串 |
| `UUID_B64` | 生成一个随机的 UUID v4 BASE64 编码的字符串 |
| `UUID_STR_B64` | 生成一个随机的 UUID v4 字符串,然后进行 BASE64 编码 |
| `UUID_HEX` | 生成一个随机的 UUID v4 的 HEX 表示 |
| `HEADLESS_SVC_FQDN` | 无头服务的 FQDN 占位符。值为 `- $(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc`,其中 1ST_COMP_NAME 是提供 `ClusterDefinition.spec.componentDefs[].service` 属性的第一个组件。|
| `SVC_FQDN` | 服务的 FQDN 占位符。值为 `- $(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc`,其中 1ST_COMP_NAME 是提供 `ClusterDefinition.spec.componentDefs[].service` 属性的第一个组件。 |
| `SVC_PORT_{PORT_NAME}` | 具有指定端口名称的 ServicePort 的端口值。例如,在一个 servicePort 的 JSON struct:<br /> `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}` 中,连接凭证值中的 `"$(SVC_PORT_mysql)"` 为 3306。 |
| `RANDOM_PASSWD` | 随机生成的 8 个字符 |
8 changes: 4 additions & 4 deletions i18n/zh-cn/developer-docs/integration/multi-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ spec:

KuBeBlocks 提供了三个内置变量作为 place-holder,在集群创建时会被替换为具体的值:

- ${POD_ORDINAL},即 Pod 的序数;
- ${POD_NAME},即 Pod 的名称,格式为 `{clusterName}-{componentName}-{podOrdinal}`;
- ${POD_FQDN},即 Pod 的 Full Qualified Domain Name(FQDN)。
- `${POD_ORDINAL}`,即 Pod 的序数;
- `${POD_NAME}`,即 Pod 的名称,格式为 `{clusterName}-{componentName}-{podOrdinal}`;
- `${POD_FQDN}`,即 Pod 的 Full Qualified Domain Name(FQDN)。

在 KubeBlocks 中,每一个有状态的组件默认都会有一个 Headless Service,名为:
`headlessServiceName = {clusterName}-{componentName}-headless`
Expand Down Expand Up @@ -226,7 +226,7 @@ KuBeBlocks 提供了三个内置变量作为 place-holder,在集群创建时
KubeBlocks 在解析这里的 JSONPath 时,会默认注册两个 root objects:

- **componentDef**:即被引用的componentDef 对象。
- **components**- :即创建的 Cluster 中,被引用的 componentDef 对应的所有组件。
- **components**:即创建的 Cluster 中,被引用的 componentDef 对应的所有组件。

因此,在 `fieldPath` 中可以用 `$.componentDef.service.ports[?(@.name == "thrift")].port` 表示获取该组件定义的 service 中名为 `thrift` 的端口号。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ spec:
preConditionDeadlineSeconds: 0
type: Expose
```
```
</TabItem>
Expand Down
3 changes: 3 additions & 0 deletions i18n/zh-cn/user-docs/installation/install-addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sidebar_position: 4
sidebar_label: 安装引擎
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 安装引擎

KubeBlocks v0.8.0 发布后,数据库引擎插件(Addon)与 KubeBlocks 解耦,KubeBlocks 默认安装了部分引擎,如需体验其它引擎,需通过索引安装。如果您卸载了部分引擎,也可通过本文步骤,重新安装。
Expand Down

0 comments on commit 7c4cdd4

Please sign in to comment.