Skip to content

Commit 9c66a13

Browse files
authored
Merge pull request kubernetes#2731 from jiahuif/kep-2436/wildcard-default-value
KEP-2436: wildcard and default value
2 parents 97999c2 + 51fddca commit 9c66a13

File tree

1 file changed

+20
-38
lines changed
  • keps/sig-cloud-provider/2436-controller-manager-leader-migration

1 file changed

+20
-38
lines changed

keps/sig-cloud-provider/2436-controller-manager-leader-migration/README.md

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,17 @@ type ControllerLeaderConfiguration struct {
178178

179179
// Component is the name of the component in which the controller will be running.
180180
// E.g. kube-controller-manager, cloud-controller-manager, etc
181+
// Or '*' meaning the controller can be run under any component that participates the migration
181182
Component string `json:"component"`
182183
}
183184

184185
```
185186

186187
#### Default LeaderMigrationConfiguration
187188

188-
The `staging/controller-manager` package will provide `kube-controller-manager` and `cloud-controller-manager`
189-
each a default `LeaderMigrationConfiguration` that represents the situation where the controller manager is running with
190-
default assignments of controllers and lock type selection.
189+
The `staging/controller-manager` package will provide a default `LeaderMigrationConfiguration` which has the
190+
`component` filed of all controllers that need migrating set to `*`, indicating the controllers can be run under
191+
either party of the migration.
191192

192193
Please refer to [an workthough](#example-walkthrough-of-controller-migration-with-default-configuration)
193194
of an example cloud controllers migration from KCM to CCM that use the default configuration.
@@ -204,7 +205,7 @@ Migration is enabled. Second, `--leader-migration-config` is an optional flag th
204205
the `LeaderMigrationConfiguration` type serialized in yaml.
205206

206207
If `--enable-leader-migration` is `true` but `--leader-migration-config` flag is empty or not set, the
207-
default `LeaderMigrationConfiguration` for corresponding controller manager will be used.
208+
default `LeaderMigrationConfiguration` will be used.
208209

209210
If `--enable-leader-migration` is not set or set to `false`, but `--leader-migration-config` is set and not empty, the
210211
controller manager will print an error at `FATAL` level and exit immediately. Additionally,
@@ -230,22 +231,20 @@ yet deployed.
230231

231232
##### Enable Leader Migration on Components
232233

233-
The provided default configuration will be equivalent to the following:
234+
The default LeaderMigrationConfiguration can be represented as follows:
234235

235236
```yaml
236237
kind: LeaderMigrationConfiguration
237238
apiVersion: controllermanager.config.k8s.io/v1alpha1
238239
leaderName: cloud-provider-extraction-migration
239240
resourceLock: leases
240241
controllerLeaders:
241-
- name: route-controller
242-
component: kube-controller-manager
243-
- name: service-controller
244-
component: kube-controller-manager
245-
- name: cloud-node-controller
246-
component: kube-controller-manager
247-
- name: cloud-nodelifecycle-controller
248-
component: kube-controller-manager
242+
- name: route
243+
component: *
244+
- name: service
245+
component: *
246+
- name: cloud-node-lifecycle
247+
component: *
249248
```
250249
251250
First, within 1.21 control plane, update the `kube-controller-manager` to set `--enable-leader-migration`
@@ -262,36 +261,19 @@ Upgrade each node of the control plane to 1.22 with the following updates:
262261
- CCM deployed with `--enable-leader-migration`
263262
- CCM has its `--cloud-provider` set to the correct cloud provider
264263

265-
After upgrade, CCM will run `route-controller`, `service-controller`, `cloud-node-controller`,
266-
and `cloud-nodelifecycle-controller`. The Leader Migration support will ensure CCM cleanly take out these controllers
267-
during the control plane upgrade.
264+
Starting from version 1.22, a proper default that represents the most recent migration will be provided.
265+
`*` in the `component` field indicates that the controllers can be run under either `kube-controller-manager` or `cloud-controller-manager`. Because the migration happens between
266+
the 1.21 `kube-controller-manager` with built-in cloud provider and 1.22 `cloud-controller-manager`, the controllers
267+
can run under either controller manager, which is exactly as described in the default configuration.
268268

269-
As a reference, the provided default configuration in version 1.22 should have the `component` field of all affected
270-
controllers changed to `cloud-controller-manager`. The resulting default configuration should be equivalent to the
271-
following:
272-
273-
```yaml
274-
kind: LeaderMigrationConfiguration
275-
apiVersion: controllermanager.config.k8s.io/v1alpha1
276-
leaderName: cloud-provider-extraction-migration
277-
resourceLock: leases
278-
controllerLeaders:
279-
- name: route-controller
280-
component: cloud-controller-manager
281-
- name: service-controller
282-
component: cloud-controller-manager
283-
- name: cloud-node-controller
284-
component: cloud-controller-manager
285-
- name: cloud-nodelifecycle-controller
286-
component: cloud-controller-manager
287-
```
288-
289-
Please take note on how component names across both versions differs for each controller.
269+
During the upgrade, either KCM or CCM may hold the migration lease and thus run migrated controllers.
270+
However, at any moment, there is one and only one of them running the migrated controllers.
271+
After upgrade, only CCM will run the `route`, `service`, `cloud-node-lifecycle` controllers.
290272

291273
##### Disable Leader Migration
292274

293275
Once all nodes in the control plane are upgraded to 1.22, disable leader migration on the `cloud-controller-manager` by
294-
unsetting the `--enable-migration-config` flag.
276+
unsetting the `--enable-leader-migration` flag.
295277

296278
### Risks and Mitigations
297279

0 commit comments

Comments
 (0)