Skip to content

Commit e6d6bde

Browse files
committed
update API
1 parent 03fd33c commit e6d6bde

File tree

6 files changed

+110
-56
lines changed

6 files changed

+110
-56
lines changed

apis/apps/v1/types.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,27 @@ type ComponentNetwork struct {
257257
// +optional
258258
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`
259259

260-
// Specifies the host ports of the pod.
261-
// It's valid if and only if the `hostNetwork` is enabled.
260+
// HostPorts specifies the mapping of container ports to host ports.
261+
// The behavior varies based on the HostNetwork setting:
262262
//
263-
// If any host ports are specified, the default host-port manager provided by KB will be ignored.
264-
// Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
265-
// Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
263+
// 1. When HostNetwork is enabled:
264+
// Allows customization of host ports.
265+
// - Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
266+
// - Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
267+
// They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
268+
// (Note: Automatic allocation is supported ONLY for kbagent ports).
266269
//
267-
// !!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
270+
// 2. When HostNetwork is disabled:
271+
// Allows optional mapping from container ports to host ports.
272+
// - Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
273+
// - Any specified container ports not present in the runtime definition will be ignored.
268274
//
269275
// +optional
270276
HostPorts []HostPort `json:"hostPorts,omitempty"`
271277
}
272278

273279
type HostPort struct {
274-
// The name of the host port.
280+
// The name of the container port.
275281
//
276282
// +kubebuilder:validation:Required
277283
Name string `json:"name"`

config/crd/bases/apps.kubeblocks.io_clusters.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,20 +2776,26 @@ spec:
27762776
type: boolean
27772777
hostPorts:
27782778
description: |-
2779-
Specifies the host ports of the pod.
2780-
It's valid if and only if the `hostNetwork` is enabled.
2779+
HostPorts specifies the mapping of container ports to host ports.
2780+
The behavior varies based on the HostNetwork setting:
27812781

27822782

2783-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
2784-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
2785-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
2783+
1. When HostNetwork is enabled:
2784+
Allows customization of host ports.
2785+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
2786+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
2787+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
2788+
(Note: Automatic allocation is supported ONLY for kbagent ports).
27862789

27872790

2788-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
2791+
2. When HostNetwork is disabled:
2792+
Allows optional mapping from container ports to host ports.
2793+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
2794+
- Any specified container ports not present in the runtime definition will be ignored.
27892795
items:
27902796
properties:
27912797
name:
2792-
description: The name of the host port.
2798+
description: The name of the container port.
27932799
type: string
27942800
port:
27952801
description: The port number of the host port.
@@ -14054,20 +14060,26 @@ spec:
1405414060
type: boolean
1405514061
hostPorts:
1405614062
description: |-
14057-
Specifies the host ports of the pod.
14058-
It's valid if and only if the `hostNetwork` is enabled.
14063+
HostPorts specifies the mapping of container ports to host ports.
14064+
The behavior varies based on the HostNetwork setting:
1405914065

1406014066

14061-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
14062-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
14063-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
14067+
1. When HostNetwork is enabled:
14068+
Allows customization of host ports.
14069+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
14070+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
14071+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
14072+
(Note: Automatic allocation is supported ONLY for kbagent ports).
1406414073

1406514074

14066-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
14075+
2. When HostNetwork is disabled:
14076+
Allows optional mapping from container ports to host ports.
14077+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
14078+
- Any specified container ports not present in the runtime definition will be ignored.
1406714079
items:
1406814080
properties:
1406914081
name:
14070-
description: The name of the host port.
14082+
description: The name of the container port.
1407114083
type: string
1407214084
port:
1407314085
description: The port number of the host port.

config/crd/bases/apps.kubeblocks.io_components.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,20 +2555,26 @@ spec:
25552555
type: boolean
25562556
hostPorts:
25572557
description: |-
2558-
Specifies the host ports of the pod.
2559-
It's valid if and only if the `hostNetwork` is enabled.
2558+
HostPorts specifies the mapping of container ports to host ports.
2559+
The behavior varies based on the HostNetwork setting:
25602560

25612561

2562-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
2563-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
2564-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
2562+
1. When HostNetwork is enabled:
2563+
Allows customization of host ports.
2564+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
2565+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
2566+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
2567+
(Note: Automatic allocation is supported ONLY for kbagent ports).
25652568

25662569

2567-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
2570+
2. When HostNetwork is disabled:
2571+
Allows optional mapping from container ports to host ports.
2572+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
2573+
- Any specified container ports not present in the runtime definition will be ignored.
25682574
items:
25692575
properties:
25702576
name:
2571-
description: The name of the host port.
2577+
description: The name of the container port.
25722578
type: string
25732579
port:
25742580
description: The port number of the host port.

deploy/helm/crds/apps.kubeblocks.io_clusters.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,20 +2776,26 @@ spec:
27762776
type: boolean
27772777
hostPorts:
27782778
description: |-
2779-
Specifies the host ports of the pod.
2780-
It's valid if and only if the `hostNetwork` is enabled.
2779+
HostPorts specifies the mapping of container ports to host ports.
2780+
The behavior varies based on the HostNetwork setting:
27812781

27822782

2783-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
2784-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
2785-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
2783+
1. When HostNetwork is enabled:
2784+
Allows customization of host ports.
2785+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
2786+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
2787+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
2788+
(Note: Automatic allocation is supported ONLY for kbagent ports).
27862789

27872790

2788-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
2791+
2. When HostNetwork is disabled:
2792+
Allows optional mapping from container ports to host ports.
2793+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
2794+
- Any specified container ports not present in the runtime definition will be ignored.
27892795
items:
27902796
properties:
27912797
name:
2792-
description: The name of the host port.
2798+
description: The name of the container port.
27932799
type: string
27942800
port:
27952801
description: The port number of the host port.
@@ -14054,20 +14060,26 @@ spec:
1405414060
type: boolean
1405514061
hostPorts:
1405614062
description: |-
14057-
Specifies the host ports of the pod.
14058-
It's valid if and only if the `hostNetwork` is enabled.
14063+
HostPorts specifies the mapping of container ports to host ports.
14064+
The behavior varies based on the HostNetwork setting:
1405914065

1406014066

14061-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
14062-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
14063-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
14067+
1. When HostNetwork is enabled:
14068+
Allows customization of host ports.
14069+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
14070+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
14071+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
14072+
(Note: Automatic allocation is supported ONLY for kbagent ports).
1406414073

1406514074

14066-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
14075+
2. When HostNetwork is disabled:
14076+
Allows optional mapping from container ports to host ports.
14077+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
14078+
- Any specified container ports not present in the runtime definition will be ignored.
1406714079
items:
1406814080
properties:
1406914081
name:
14070-
description: The name of the host port.
14082+
description: The name of the container port.
1407114083
type: string
1407214084
port:
1407314085
description: The port number of the host port.

deploy/helm/crds/apps.kubeblocks.io_components.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,20 +2555,26 @@ spec:
25552555
type: boolean
25562556
hostPorts:
25572557
description: |-
2558-
Specifies the host ports of the pod.
2559-
It's valid if and only if the `hostNetwork` is enabled.
2558+
HostPorts specifies the mapping of container ports to host ports.
2559+
The behavior varies based on the HostNetwork setting:
25602560

25612561

2562-
If any host ports are specified, the default host-port manager provided by KB will be ignored.
2563-
Therefore, it is the user's responsibility to specify all container ports that need to be bound to host ports.
2564-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.
2562+
1. When HostNetwork is enabled:
2563+
Allows customization of host ports.
2564+
- Mandatory: All container ports defined in `cmpd.spec.hostNetwork` MUST be mapped to a host port here.
2565+
- Sidecar (kbagent): The "http" and "streaming" ports for kbagent also require host binding.
2566+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
2567+
(Note: Automatic allocation is supported ONLY for kbagent ports).
25652568

25662569

2567-
!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: 'http', 'streaming'.
2570+
2. When HostNetwork is disabled:
2571+
Allows optional mapping from container ports to host ports.
2572+
- Mappings are restricted to ports defined in `cmpd.spec.runtime.containers.ports`.
2573+
- Any specified container ports not present in the runtime definition will be ignored.
25682574
items:
25692575
properties:
25702576
name:
2571-
description: The name of the host port.
2577+
description: The name of the container port.
25722578
type: string
25732579
port:
25742580
description: The port number of the host port.

docs/developer_docs/api-reference/cluster.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6167,12 +6167,24 @@ Kubernetes core/v1.PodDNSConfig
61676167
</td>
61686168
<td>
61696169
<em>(Optional)</em>
6170-
<p>Specifies the host ports of the pod.
6171-
It&rsquo;s valid if and only if the <code>hostNetwork</code> is enabled.</p>
6172-
<p>If any host ports are specified, the default host-port manager provided by KB will be ignored.
6173-
Therefore, it is the user&rsquo;s responsibility to specify all container ports that need to be bound to host ports.
6174-
Check @cmpd.spec.hostNetwork to obtain all container ports that need to be bound.</p>
6175-
<p>!!!!! When you specify the host ports, you must specify two additional ports for the kbagent sidecar of KB: &lsquo;http&rsquo;, &lsquo;streaming&rsquo;.</p>
6170+
<p>HostPorts specifies the mapping of container ports to host ports.
6171+
The behavior varies based on the HostNetwork setting:</p>
6172+
<ol>
6173+
<li><p>When HostNetwork is enabled:
6174+
Allows customization of host ports.</p>
6175+
<ul>
6176+
<li>Mandatory: All container ports defined in <code>cmpd.spec.hostNetwork</code> MUST be mapped to a host port here.</li>
6177+
<li>Sidecar (kbagent): The &ldquo;http&rdquo; and &ldquo;streaming&rdquo; ports for kbagent also require host binding.
6178+
They can be explicitly defined here, or automatically allocated by enabling the host-port manager.
6179+
(Note: Automatic allocation is supported ONLY for kbagent ports).</li>
6180+
</ul></li>
6181+
<li><p>When HostNetwork is disabled:
6182+
Allows optional mapping from container ports to host ports.</p>
6183+
<ul>
6184+
<li>Mappings are restricted to ports defined in <code>cmpd.spec.runtime.containers.ports</code>.</li>
6185+
<li>Any specified container ports not present in the runtime definition will be ignored.</li>
6186+
</ul></li>
6187+
</ol>
61766188
</td>
61776189
</tr>
61786190
</tbody>
@@ -8472,7 +8484,7 @@ string
84728484
</em>
84738485
</td>
84748486
<td>
8475-
<p>The name of the host port.</p>
8487+
<p>The name of the container port.</p>
84768488
</td>
84778489
</tr>
84788490
<tr>

0 commit comments

Comments
 (0)