You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// "" means to use the current mechanism of matching label <cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>.
39
-
// "LabelSelector" means to use the LabelSelector to select target managedClusters
40
-
// "ExclusiveLabel" means to use a particular cluster label. It is guaranteed that clustersets with same label key are exclusive with each others
41
-
// +optional
42
-
SelectorTypeSelectorType`json:"selectorType"`
43
-
44
-
// ExclusiveLabel defines one label which clusterset could use to select target managedClusters. In this way, we will:
45
-
// 1. Guarantee clustersets with same label key are exclusive
46
-
// 2. Enable additional permission check when cluster joining/leaving a clusterset (the label key should start with the reserved prefix "cluster.open-cluster-management.io/" and "info.open-cluster-management.io/");
Currently, When I want to create a managedClusterSet, I only should have `create` permission to the managedClusterSet.
69
-
In the managedCluster part, label `cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>` means the cluster is in a managedClusterSet.
70
-
If I want to add the label `cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>` to a managedCluster, I must have `create` permission for subresource `managedclustersets/join`.
71
-
If I want to add/update other labels, I just need to have `update` permission to the managedCluster resource.
59
+
Actually, what we discuss about RBAC is `who can add/remove a managedCluster to/from a managedClusterSet.`
60
+
Currently, if a managedCluster which have label `cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>` means the cluster is in a managedClusterSet.
61
+
And If I want to add a managedCluster to a managedClusterSet, I must have `create` permission for subresource `managedclustersets/join` with resource name `<ManagedClusterSet Name>`.
72
62
73
-
In this proposal, managedClusterSet could use any labels to select managedClusters. And if I add a label for a managedCluster, it may lead to the managedCluster added to a managedClusterSet. So we need to rethink about the rbac control of managedClusterSet
63
+
In this proposal, managedClusterSet could use two ways to select target clusters, `ExclusiveClusterSetLabel` and `LabelSelector`.
64
+
1. ExclusiveClusterSetLabel
65
+
In this selector, managedClusterSet select target clusters using label `cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>`. And the RBAC model will not change. If I want to add a managedCluster to a managedClusterSet, I must have `create` permission for subresource `managedclustersets/join` with resource name `<ManagedClusterSet Name>`.
66
+
67
+
2. LabelSelector
68
+
With the `LabelSelector`, any labels may be used to select target clusters. And we will not have external RBAC control for this kind of clustersets.
74
69
75
70
We will use the following questions to consider the RBAC control.
76
71
@@ -81,7 +76,7 @@ c. Create a managedClusterSet which has the same capacity(like: all clusters ena
81
76
d. Create a managedClusterSet for each squad for resource group purposes.
82
77
83
78
#### Who can create a managedClusterSet
84
-
Same as the current way, Anyone who has `create` permission to `managedclustersets` could create managedClusterSet.
79
+
Same as the current way, Anyone who has `create` permission to `managedclustersets` could create managedClusterSet.
85
80
But generally, Cluster admin should not give this permission to others. So only cluster admin could create the managedClusterSet.
86
81
87
82
#### What kinds of roles exist related to managedClusterSets and managedClusters
@@ -115,7 +110,7 @@ Currently, the controller/agent may add labels like: `region: apac`, `cloud: Ama
115
110
3. Non Cluster admin users
116
111
Currently, non cluster admin users may also `add/update` some managedClusters labels.
117
112
118
-
#### Add restrictions for adding/updating/deleting labels to managedClusters
113
+
#### [Not Implement]Add restrictions for adding/updating/deleting labels to managedClusters
119
114
In this proposal, managedClusterSet could use any labels to select managedClusters. And the new added labels may lead to this managedClusters added to a managedClusterSet.
120
115
121
116
But for some managedClusterSet(like: Disaster Recovery ManagedClusterSet[a], Resource Group ManagedClusterSet[d]), we do not want any users to add their managedClusters to these managedClusterSets.
@@ -174,8 +169,7 @@ Same as the current way, anyone who has `managedclustersets/bind` permission cou
174
169
### Example1: As cluster admin, I want to create a managedClusterSet which includes all clusters in the apac region. Then I can apply certain configurations to all clusters in apac.
175
170
1. For each cluster, there should be an agent running on the managedCluster. The agent should have the following permissions:
176
171
- `update`permission to its related managedCluster
177
-
- `create`permission to subresource `managedclusters/label` with resourceName `info.open-cluster-management.io/region:*`
178
-
2. For each cluster in the apac region, related agents should add a label: `info.open-cluster-management.io/region:apac`to these managedClusters.
172
+
2. For each cluster in the apac region, related agents should add a label: `region:apac`to these managedClusters.
179
173
3. As cluster admin, I could create a managedClusterSet to select all managedClusters in `apac` region
### Example2: As a DEV team member, I want to use a managedClusterSet to select clusters based on the middleware enabled on these clusters, so I could run special applications in these clusters.
194
188
1. For each cluster, there should be an agent running on the managedCluster. The agent should have the following permissions:
195
189
- `update`permission to its related managedCluster
196
-
- `create`permission to subresource `managedclusters/label` with resourceName `info.open-cluster-management.io/middlewareEnabled:true`
197
-
2. For each cluster which enables the middleware, related agents should add a label: `info.open-cluster-management.io/middlewareEnabled:true`to these managedClusters.
190
+
2. For each cluster which enables the middleware, related agents should add a label: `middlewareEnabled:true`to these managedClusters.
198
191
3. Cluster admin create a managedClusterSet `middlewareenabledset`
3. As a DEV/QA team member, I can `create` a managedCluster, and add label `cluster.open-cluster-management.io/clusterset:devset/qaset` to the managedCluster.
308
-
4. As a DEV/QA team member, I could `bind` the managedClusterSet `devset/qaset` to my namespace and run applications in the managedClusterSet.
293
+
3. As a DEV/QA team member, I can `create` a managedCluster, and add label `cluster.open-cluster-management.io/clusterset:dev/qa` to the managedCluster.
294
+
4. As a DEV/QA team member, I could `bind` the managedClusterSet `dev/qa` to my namespace and run applications in the managedClusterSet.
309
295
310
296
## Test Plan
311
297
- Unit tests will cover the functionality of the controllers.
@@ -315,86 +301,10 @@ rules:
315
301
- Create/update/delete managedClusters labels
316
302
- Update managedClusterSet spec `clusterSelector` field
317
303
318
-
## Migration
319
-
Currently, managedClusterSet has three consumers: [placement](https://github.com/open-cluster-management-io/placement), [multicloud-operators-foundation](https://github.com/stolostron/multicloud-operators-foundation), [submariner-addon](https://github.com/stolostron/submariner-addon)
320
-
321
-
- `multicloud-operators-foundation`uses managedClusterSet for resource group purposes. And it should only care about the exclusive managedClusterSet.
322
-
- `submariner-addon`uses managedClusterSet to group clusters based on the networks. And in different managedClusterSet, the clusters should be exclusive.
323
-
- `placement`select all managedClusters in each managedClusterSet.
324
-
325
-
So we could finish the migration by four steps, and step 1 and step 2 will be finished in OCM 0.7.0. and step 3 and step 4 will be finished in OCM 0.8.0
326
-
327
-
1. [Implement in OCM 0.7.0]Update the managedClusterSet API which only includes an exclusive way to select target managedClusters.
328
-
329
-
```go
330
-
type ManagedClusterSetSpec struct {
331
-
// Selector represents a selector of ManagedClusters by labels and names.
// "" means to use the current mechanism of matching label <cluster.open-cluster-management.io/clusterset:<ManagedClusterSet Name>.
337
-
// (future) "LabelSelector" means to use the LabelSelector to select target managedClusters
338
-
// "ExclusiveLabel" means to use a particular cluster label. It is guaranteed that clustersets with same label key are exclusive with each others
339
-
// +optional
340
-
SelectorType SelectorType `json:"selectorType"`
341
-
342
-
// ExclusiveLabel defines one label which clusterset could use to select target managedClusters. In this way, we will:
343
-
// 1. Guarantee clustersets with same label key are exclusive
344
-
// 2. Enable additional permission check when cluster joining/leaving a clusterset (the label key should start with the reserved prefix "cluster.open-cluster-management.io/" and "info.open-cluster-management.io/");
//Key is "cluster.open-cluster-management.io/clusterset" by default and can only be cluster.open-cluster-management.io/
357
-
Key string `json:"key"`
358
-
//Value can only be empty or the name of the clusterset.
359
-
Value string `json:"value"`
360
-
}
361
-
```
362
-
363
-
-`LabelSelector` will not be included
364
-
-`ExclusiveLabel.Key` must be `cluster.open-cluster-management.io/clusterset` and `ExclusiveLabel.Value` must be `ManagedClusterset Name`
365
-
- Both `managedclusterset/join` and `managedclusters/label` permission will be supported
366
-
367
-
2.[Implement in OCM 0.7.0]`multicloud-operators-foundation`, `submariner-addon`, `placement` change the code to integrate with new managedClusterSet api
368
-
369
-
a. `multicloud-operators-foundation` uses managedClusterSet for resource group purpose. So it should only watch the following managedClusterSets:
370
-
-`spec.ClusterSelector.SelectorType` is `ExclusiveLabel` and the `ExclusiveLabel.Key` must be `cluster.open-cluster-management.io/clusterset`
371
-
-`spec.ClusterSelector.SelectorType` is ""
372
-
373
-
b. `multicloud-operators-foundation` gives the users `join` permission to a managedClusterSet if the user has "admin" permission to the managedClusterSet. So the `join` permission should be changed with the following rule:
c. `submariner-addon` uses managedClusterSet group clusters based on the network. And in different managedClusterSet, the clusters should be exclusive. So it should only watch the following managedClusterSet:
382
-
- `spec.ClusterSelector.SelectorType`is `ExclusiveLabel` and the `ExclusiveLabel.Key` must be `cluster.open-cluster-management.io/clusterset`, the `ExclusiveLabel.Value` must be managedClusterSet name.
383
-
- `spec.ClusterSelector.SelectorType`is ""
384
-
385
-
d. `placement` using new `ClusterSelector` to select target clusters.
386
-
387
-
3. [Implement in OCM 0.8.0] Update full managedClusterSet api and RBAC
388
-
- Include `LabelSelector`
389
-
- Take off the restriction for “ExclusiveLabel.Key” and “ExclusiveLabel.Value”
390
-
- Deprecate `managedclusterset/join` permission
391
-
392
-
4. [Implement in OCM 0.8.0] `placement` uses the new managedClusterSet api to select managedClusters for each managedClusterSet.
393
-
394
304
## Upgrade / Downgrade Strategy
395
305
The new api is compatible with the previous version. So there is no external work needed when upgrading
396
306
397
307
## Graduation Criteria
398
308
### v1beta1
399
309
1. The new APIs is reviewed and accepted;
400
-
2. Implementation is completed to support the RBAC;
0 commit comments