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
Copy file name to clipboardExpand all lines: keps/sig-network/1880-multiple-service-cidrs/README.md
+22-65Lines changed: 22 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,8 @@ Implement a new allocation logic for Services IPs that:
135
135
services.spec.IPFamily and services.spec.IPFamilyPolicy, a simple webhook or an admission plugin
136
136
can set this fields to the desired default, so the allocation logic doesn't have to handle it.
137
137
- Removing the apiserver flags that define the service IP CIDRs, though that may be possible in the future.
138
+
- Any admin or cluster wide process related to Services, like automating the default Service CIDR range, though,
139
+
this KEP will implment the behaviours and primitives necessaries to perform those kind of operations automatically.
138
140
139
141
## Proposal
140
142
@@ -162,6 +164,8 @@ different and collide with other APIs, like Gateway APIs, we are adding the foll
162
164
163
165
The new allocator logic can be used by other APIs, like Gateway API.
164
166
167
+
The new well defined behaviors and objects implemented will allow future developments to perform admin and cluster wide operations on the Service ranges.
168
+
165
169
### User Stories
166
170
167
171
#### Story 1
@@ -279,12 +283,7 @@ and Services.
279
283
In order to be completely backwards compatible, the bootstrap process will remain the same, the
280
284
difference is that instead of creating a bitmap based on the flags, it will create a new
281
285
ServiceCIDR object from the flags (flags configuration removal is out of scope of this KEP)
282
-
...
283
-
284
-
```
285
-
<<[UNRESOLVED bootstrap>>
286
-
Option 1:
287
-
... with a special well-known name `kubernetes`.
286
+
with a special well-known name `kubernetes`.
288
287
289
288
The new bootstrap process will be:
290
289
@@ -309,68 +308,25 @@ All the apiservers will be synchronized on the ServiceCIDR and default Service c
309
308
Changes on the configuration imply manual removal of the ServiceCIDR and default Service, automatically
310
309
the rest of the apiservers will race and the winner will set the configuration of the cluster.
311
310
312
-
Pros:
313
-
- Simple to implement
314
-
- Align with current behavior of kubernetes.default, though this can be a Con as well, since this
315
-
the existing behavior was unexpected
316
-
Cons:
317
-
- Requires manual intervention
318
-
319
-
Option 2:
320
-
... with a special label `networking.kubernetes.io/service-cidr-from-flags` set to `"true"`.
321
-
322
-
It now has to handle the possibility of multiple ServiceCIDR with the special label, and
323
-
also updating the configuration, per example, from single-stack to dual-stack.
324
-
325
-
The new bootstrap process will be:
311
+
This behavior align with current behavior of kubernetes.default, that it makes it consistent and easier to think
312
+
about, allowing future developments to use it to implement more complex operations at the admin cluster level.
326
313
327
-
```
328
-
at startup:
329
-
read_flags
330
-
if invalid flags
331
-
exit
332
-
run default-service-ip-range controller
333
-
run kubernetes.default service loop (it uses the first ip from the subnet defined in the flags)
334
-
run service-repair loop (reconcile services, ipaddresses)
335
-
run apiserver
336
-
337
-
controller:
338
-
watch all ServiceCIDR objects labelled from-flags
339
-
ignore being-deleted ranges
340
-
wait for first sync
341
-
342
-
controller on_event:
343
-
if no default range matching exactly my flags
344
-
log
345
-
create a ServiceCIDR from my flags
346
-
generateName: "from-flags-"
347
-
from-flags label: "true"
348
-
else if multiple
349
-
log
350
-
if multiple ranges match exactly my flags (or a single-family subset of)
351
-
log
352
-
delete all subsets, leaving the largest set that exactly matches on at least on family
353
-
endif
354
-
endif
355
-
if kubernetes.default does not exist
356
-
create it
357
-
```
314
+
#### The special "default" ServiceCIDR
358
315
359
-
Pros:
360
-
- Automatically handles conflicts, no admin operation required
361
-
Cons:
362
-
- Complex to implement
316
+
The `kubernetes.default` Service is expected to be covered by a valid range. Each apiserver
317
+
ensure that a ServiceCIDR object exists to cover its own flag-defined ranges. If someone were to force-delete
318
+
the ServiceCIDR covering `kubernetes.default` it would be treated the same as before, any apiserver will try
319
+
to recreate the Service from its configured default Service CIDR flag-defined range.
363
320
364
-
<<[/UNRESOLVED]>>
365
-
```
366
-
367
-
#### The special "default" ServiceCIDR
321
+
This well-known an establish behavior can allow administrators to replace the `kubernetes.default` by a
322
+
series of operations:
323
+
1. Initial state: 2 kube-apiservers with default ServiceCIDR 10.0.0.0/24
324
+
2. Apiservers will create the `kubernetes.default` Service with ClusterIP 10.0.0.1.
325
+
3. Upgrade kube-apiservers and replace the service-cidr flag to 192.168.0.0/24
326
+
4. Delete the ServiceCIDRs objects and the `kubernetes.default` Service.
327
+
5. The kube-apiserver will recreate the `kubernetes.default` with IP 192.168.0.1.
368
328
369
-
The `kubernetes.default` Service is expected to be covered by a valid range. Each apiserver will
370
-
ensure that a ServiceCIDR object exists to cover its own flag-defined ranges, so this should
371
-
be true in normal cases. If someone were to force-delete the ServiceCIDR covering `kubernetes.default` it
372
-
would be treated the same as any Service in the repair loop, which will generate warnings about
373
-
orphaned Service IPs.
329
+
Note this can also be used to switch the IP family of the cluster.
374
330
375
331
#### Service IP Allocation
376
332
@@ -481,7 +437,8 @@ deletion can take some time, one allocator can successfully allocate an IP addre
481
437
inside of the old Service CIDR).
482
438
483
439
There is one controller that will periodically check that the 1-on-1 relation between IPAddresses and Services is
484
-
correct, and will start sending events to warn the user that it has to fix/recreate the corresponding Service.
440
+
correct, and will start sending events to warn the user that it has to fix/recreate the corresponding Service,
0 commit comments