Skip to content

Commit 74cc4cd

Browse files
committed
Release v2.0.0-alpha.2
- 支持通过定义 CLBNodeBinding 实现从 CLB 端口池中为 Node 端口映射,并将映射结果写入 Node 注解。 - 支持通过定义 Node 注解自动生成 CLBNodeBinding,可结合节点池的 Annotation 配置,为存量和增量节点自动配置注解。
1 parent ff25ad7 commit 74cc4cd

31 files changed

+1377
-896
lines changed

CHANGELOG.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# 版本说明
22

3-
## v2.0.0-alpha.1 (2025-03-15)
3+
## v2.0.0-alpha.2 (2025-03-27)
44

5-
- 支持了一套全新的 API,抢先体验参考 [使用 CLB 端口池为 Pod 映射公网地址](./docs/clb-port-pool.md)
5+
- 支持通过定义 CLBNodeBinding 实现从 CLB 端口池中为 Node 端口映射,并将映射结果写入 Node 注解。
6+
- 支持通过定义 Node 注解自动生成 CLBNodeBinding,可结合节点池的 Annotation 配置,为存量和增量节点自动配置注解。
7+
8+
## v2.0.0-alpha.1 (2025-03-25)
9+
10+
- 支持 CLBPortPool 定义 CLB 端口池,用于分配端口映射,支持端口段用单个监听器映射多个端口。
11+
- 支持通过定义 CLBPodBinding 实现从 CLB 端口池中为 Pod 端口映射,并将映射结果写入 Pod 注解。
12+
- 支持通过定义 Pod 注解自动生成 CLBPodBinding,可结合任意工作负载类型使用,实现自动映射。
13+
- 抢先体验参考 [使用 CLB 端口池为 Pod 映射公网地址](./docs/clb-port-pool.md)
614

715
## v1.1.2 (2024-11-4)
816

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Image URL to use all building/pushing image targets
2-
IMG ?= imroc/tke-extend-network-controller:2.0.0-alpha.1
2+
IMG ?= imroc/tke-extend-network-controller:2.0.0-alpha.2
33
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
44
ENVTEST_K8S_VERSION = 1.30.0
55

PROJECT

+6
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ resources:
7171
webhooks:
7272
validation: true
7373
webhookVersion: v1
74+
- controller: true
75+
core: true
76+
group: core
77+
kind: Node
78+
path: k8s.io/api/core/v1
79+
version: v1
7480
version: "3"

api/v1alpha1/clbbinding_types.go

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package v1alpha1
2+
3+
// PortEntry 定义单个端口的绑定配置
4+
type PortEntry struct {
5+
// 应用监听的端口号
6+
Port uint16 `json:"port"`
7+
// 端口使用的协议
8+
// +kubebuilder:validation:Enum=TCP;UDP;TCPUDP
9+
Protocol string `json:"protocol"`
10+
// 使用的端口池列表
11+
Pools []string `json:"pools"`
12+
// 是否跨端口池分配相同端口号
13+
// +optional
14+
UseSamePortAcrossPools *bool `json:"useSamePortAcrossPools,omitempty"`
15+
}
16+
17+
type CLBBindingState string
18+
19+
const (
20+
CLBBindingStatePending CLBBindingState = "Pending"
21+
CLBBindingStateBound CLBBindingState = "Bound"
22+
CLBBindingStateWaitForPod CLBBindingState = "WaitForPod"
23+
CLBBindingStateWaitForNode CLBBindingState = "WaitForNode"
24+
CLBBindingStateWaitForLB CLBBindingState = "WaitForLB"
25+
CLBBindingStateDisabled CLBBindingState = "Disabled"
26+
CLBBindingStateFailed CLBBindingState = "Failed"
27+
CLBBindingStateDeleting CLBBindingState = "Deleting"
28+
)
29+
30+
// CLBBindingStatus defines the observed state of CLBPodBinding.
31+
type CLBBindingStatus struct {
32+
// 绑定状态
33+
State CLBBindingState `json:"state"`
34+
// 状态信息
35+
Message string `json:"message,omitempty"`
36+
// 端口绑定详情
37+
PortBindings []PortBindingStatus `json:"portBindings,omitempty"`
38+
}
39+
40+
// PortBindingStatus 描述单个端口的实际绑定情况
41+
type PortBindingStatus struct {
42+
// 应用端口
43+
Port uint16 `json:"port"`
44+
// 协议类型
45+
Protocol string `json:"protocol"`
46+
// 使用的端口池
47+
Pool string `json:"pool"`
48+
// 地域信息
49+
Region string `json:"region"`
50+
// 负载均衡器ID
51+
LoadbalancerId string `json:"loadbalancerId"`
52+
// 负载均衡器端口
53+
LoadbalancerPort uint16 `json:"loadbalancerPort"`
54+
// 负载均衡器端口段结束端口(当使用端口段时)
55+
// +optional
56+
LoadbalancerEndPort *uint16 `json:"loadbalancerEndPort,omitempty"`
57+
// 监听器ID
58+
ListenerId string `json:"listenerId"`
59+
}
60+
61+
// CLBBindingSpec defines the desired state of CLBPodBinding.
62+
type CLBBindingSpec struct {
63+
// 网络隔离
64+
// +optional
65+
Disabled *bool `json:"disabled,omitempty"`
66+
// 需要绑定的端口配置列表
67+
Ports []PortEntry `json:"ports"`
68+
}

api/v1alpha1/clbnodebinding_types.go

+3-12
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,18 @@ type CLBNodeBindingSpec struct {
3232
Ports []PortEntry `json:"ports"`
3333
}
3434

35-
// CLBNodeBindingStatus defines the observed state of CLBNodeBinding.
36-
type CLBNodeBindingStatus struct {
37-
// 绑定状态
38-
State CLBBindingState `json:"state"`
39-
// 状态信息
40-
Message string `json:"message,omitempty"`
41-
// 端口绑定详情
42-
PortBindings []PortBindingStatus `json:"portBindings,omitempty"`
43-
}
44-
4535
// +kubebuilder:object:root=true
4636
// +kubebuilder:subresource:status
4737
// +kubebuilder:resource:scope=Cluster,shortName=cnb
38+
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="State"
4839

4940
// CLBNodeBinding is the Schema for the clbnodebindings API.
5041
type CLBNodeBinding struct {
5142
metav1.TypeMeta `json:",inline"`
5243
metav1.ObjectMeta `json:"metadata,omitempty"`
5344

54-
Spec CLBNodeBindingSpec `json:"spec,omitempty"`
55-
Status CLBNodeBindingStatus `json:"status,omitempty"`
45+
Spec CLBBindingSpec `json:"spec,omitempty"`
46+
Status CLBBindingStatus `json:"status,omitempty"`
5647
}
5748

5849
// +kubebuilder:object:root=true

api/v1alpha1/clbpodbinding_types.go

+2-72
Original file line numberDiff line numberDiff line change
@@ -20,76 +20,6 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25-
26-
// CLBPodBindingSpec defines the desired state of CLBPodBinding.
27-
type CLBPodBindingSpec struct {
28-
// 网络隔离
29-
// +optional
30-
Disabled *bool `json:"disabled,omitempty"`
31-
// 需要绑定的端口配置列表
32-
Ports []PortEntry `json:"ports"`
33-
}
34-
35-
// PortEntry 定义单个端口的绑定配置
36-
type PortEntry struct {
37-
// 应用监听的端口号
38-
Port uint16 `json:"port"`
39-
// 端口使用的协议
40-
// +kubebuilder:validation:Enum=TCP;UDP;TCPUDP
41-
Protocol string `json:"protocol"`
42-
// 使用的端口池列表
43-
Pools []string `json:"pools"`
44-
// 是否跨端口池分配相同端口号
45-
// +optional
46-
UseSamePortAcrossPools *bool `json:"useSamePortAcrossPools,omitempty"`
47-
}
48-
49-
type CLBBindingState string
50-
51-
const (
52-
CLBBindingStatePending CLBBindingState = "Pending"
53-
CLBBindingStateBound CLBBindingState = "Bound"
54-
CLBBindingStateWaitForPod CLBBindingState = "WaitForPod"
55-
CLBBindingStateWaitForNode CLBBindingState = "WaitForNode"
56-
CLBBindingStateWaitForLB CLBBindingState = "WaitForLB"
57-
CLBBindingStateDisabled CLBBindingState = "Disabled"
58-
CLBBindingStateFailed CLBBindingState = "Failed"
59-
CLBBindingStateDeleting CLBBindingState = "Deleting"
60-
)
61-
62-
// CLBPodBindingStatus defines the observed state of CLBPodBinding.
63-
type CLBPodBindingStatus struct {
64-
// 绑定状态
65-
State CLBBindingState `json:"state"`
66-
// 状态信息
67-
Message string `json:"message,omitempty"`
68-
// 端口绑定详情
69-
PortBindings []PortBindingStatus `json:"portBindings,omitempty"`
70-
}
71-
72-
// PortBindingStatus 描述单个端口的实际绑定情况
73-
type PortBindingStatus struct {
74-
// 应用端口
75-
Port uint16 `json:"port"`
76-
// 协议类型
77-
Protocol string `json:"protocol"`
78-
// 使用的端口池
79-
Pool string `json:"pool"`
80-
// 地域信息
81-
Region string `json:"region"`
82-
// 负载均衡器ID
83-
LoadbalancerId string `json:"loadbalancerId"`
84-
// 负载均衡器端口
85-
LoadbalancerPort uint16 `json:"loadbalancerPort"`
86-
// 负载均衡器端口段结束端口(当使用端口段时)
87-
// +optional
88-
LoadbalancerEndPort *uint16 `json:"loadbalancerEndPort,omitempty"`
89-
// 监听器ID
90-
ListenerId string `json:"listenerId"`
91-
}
92-
9323
// +kubebuilder:object:root=true
9424
// +kubebuilder:subresource:status
9525
// +kubebuilder:resource:shortName=cpb
@@ -100,8 +30,8 @@ type CLBPodBinding struct {
10030
metav1.TypeMeta `json:",inline"`
10131
metav1.ObjectMeta `json:"metadata,omitempty"`
10232

103-
Spec CLBPodBindingSpec `json:"spec,omitempty"`
104-
Status CLBPodBindingStatus `json:"status,omitempty"`
33+
Spec CLBBindingSpec `json:"spec,omitempty"`
34+
Status CLBBindingStatus `json:"status,omitempty"`
10535
}
10636

10737
// +kubebuilder:object:root=true

api/v1alpha1/zz_generated.deepcopy.go

+49-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/tke-extend-network-controller/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 2.0.0-alpha.1
21+
version: 2.0.0-alpha.2
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
2525
# follow Semantic Versioning. They should reflect the version the application is using.
2626
# It is recommended to use it with quotes.
27-
appVersion: 2.0.0-alpha.1
27+
appVersion: 2.0.0-alpha.2

charts/tke-extend-network-controller/templates/networking.cloud.tencent.com_clbpodbindings.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
metadata:
4545
type: object
4646
spec:
47-
description: CLBPodBindingSpec defines the desired state of CLBPodBinding.
47+
description: CLBBindingSpec defines the desired state of CLBPodBinding.
4848
properties:
4949
disabled:
5050
description: 网络隔离

0 commit comments

Comments
 (0)