Skip to content

Commit 83591ad

Browse files
committed
Update API shape
Signed-off-by: Jian Qiu <[email protected]>
1 parent 123ffd3 commit 83591ad

File tree

1 file changed

+111
-7
lines changed
  • enhancements/sig-architecture/149-moving-cluster-proxy-to-core

1 file changed

+111
-7
lines changed

enhancements/sig-architecture/149-moving-cluster-proxy-to-core/README.md

Lines changed: 111 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,32 +92,135 @@ of the targeted cluster.
9292

9393
#### Integration with ClusterProfile API
9494

95+
When this feature enabled, we should be able to provide a tool to build kubeconfig and connect to the targeted cluster
96+
based on clusterInventory API using https://github.com/kubernetes-sigs/cluster-inventory-api/blob/main/pkg/credentials/config.go:
97+
98+
- Build a binary or script that could provide credential for the cluster via ManagedServiceAccount or impersonation
99+
- Update clusterProfile status in the registration controller using proxy endpoint.
100+
95101
#### Installation
96102

97103
To enable the feature, the user needs to enable the feature gate in `ClusterManager` and `Klusterlet` API.
98-
In addition, A new proxyConfig field should be added in `ClusterManager` API:
104+
In addition, A new `GRPCConfiguration` field should be added in `ClusterManager` API:
99105

100106
```go
101-
type ProxyConfig struct {
102-
// EndpointExposure represents the configuration for endpoint exposure.
103-
// +optional
104-
EndpointExposure *GRPCEndpointExposure `json:"endpointExposure,omitempty"`
107+
type GRPCConfiguration struct {
108+
// ImagePullSpec is the image for grpc server
109+
ImagePullSpec string `json:"imagePullSpec,omitempty"`
110+
111+
// featureGates represents the features enabled for grpc server
112+
FeatureGates []FeatureGate `json:"featureGates,omitempty"`
113+
114+
// endpointsExposure represents the configuration for grpc endpoint exposure.
115+
// +optional
116+
EndpointsExposure []EndpointExposure `json:"endpointsExposure"`
117+
}
118+
119+
type EndpointExposure struct {
120+
// type is the type of the endpoint, could be agentToServer or user.
121+
Type string `json:"type"`
122+
123+
// protocol is the protocol used for the endpoint, could be http or grpc.
124+
Protocol string `json:"protocol"`
125+
126+
GRPC *EndpointExposure `json:"grpcEndpointExposure"`
127+
128+
HTTP *EndpointExposure `json:"httpEndpointExposure"`
129+
}
130+
131+
type EndpointExposure struct {
132+
Endpoint string `json:"endpoint,omitempty"`
133+
CABundle []byte `json:"caBundle,omitempty"`
105134
}
106135
```
107136

137+
The following are examples of `ClusterManager` on how to install grpc proxy.
138+
Example of using proxy with csr registration and proxy would look like:
139+
140+
```yaml
141+
spec:
142+
grpcConfiguration:
143+
imagePullSpec: <grpc image>
144+
featureGates:
145+
- feature: ClusterProxy
146+
mode: Enabled
147+
endpointsExposure:
148+
- type: user
149+
potocol: HTTP
150+
httpEndpointExposure:
151+
endpoint: https://<external http server>
152+
- type: agentToServer
153+
protocol: GRPC
154+
grpcEndpointExposure:
155+
endpoint: grpc://<external grpc address>
156+
```
157+
158+
Example of grpc registration with proxy enabled:
159+
160+
```yaml
161+
spec:
162+
registrationConfiguration:
163+
registrationDrivers:
164+
- authType: csr
165+
- authType: grpc
166+
grpcConfiguration:
167+
imagePullSpec: <grpc image>
168+
featureGates:
169+
- feature: ClusterProxy
170+
mode: Enabled
171+
endpointsExposure:
172+
- type: user
173+
potocol: HTTP
174+
httpEndpointExposure:
175+
endpoint: https://<external http server>
176+
- type: agentToServer
177+
protocol: GRPC
178+
grpcEndpointExposure:
179+
endpoint: grpc://<external grpc address>
180+
```
181+
182+
Example of grpc registraion with proxy disabled:
183+
184+
```yaml
185+
spec:
186+
registrationConfiguration:
187+
registrationDrivers:
188+
- authType: csr
189+
- authType: grpc
190+
grpcConfiguration:
191+
imagePullSpec: <grpc image>
192+
endpointsExposure:
193+
- type: agentToServer
194+
protocol: GRPC
195+
grpcEndpointExposure:
196+
endpoint: grpc://<external grpc address>
197+
```
198+
108199
The proxyConfig field will also be added onto `Klusterlet` API:
109200

110201
```go
111202
type ProxyConfig struct {
112-
Endpoint string `json:"endpoint,omitempty"`
113-
CABundle []byte `json:"caBundle,omitempty"`
203+
GRPC *EndpointExposure `json:"grpcEndpoint"`
114204

115205
// Authentications defines how the agent authenticates with the cluster.
116206
// By default it is userToken, but it could also be impersonation or both.
117207
Authentications []string `json:"authentications,omitempty"`
118208
}
119209
```
120210

211+
An example of enabling proxy on klusterlet will be:
212+
213+
```yaml
214+
spec:
215+
proxyConfig:
216+
grpcEndpoint:
217+
endpoint: <grpc://server address>
218+
caBundle: <base64 encoded ca>
219+
authentications:
220+
- userToken
221+
- impersonation
222+
```
223+
121224
### Test Plan
122225
123226
**Note:** *Section not required until targeted at a release.*
@@ -136,6 +239,7 @@ Consider the following in developing a test plan for this enhancement:
136239
**Beta:**
137240
- At least two consumers are using or migrating from cluster-proxy addon to this feature
138241
- clusteradm is updated to adopt this feature
242+
- Integrate with cluster-inventory API.
139243
- End-to-end tests ensure all use cases of existing cluster-proxy addon are covered
140244
141245
**GA (Graduate):**

0 commit comments

Comments
 (0)