Commit c325d88
authored
K8SPSMDB-780: Unsafe improvements (#1504)
* K8SPSMDB-780: Unsafe flags
These changes attempt to fix the overloaded `allowUnsafeConfigurations`
flag.
In previous implementation, `allowUnsafeConfigurations` wasn't just
allow unsafe configuration but make everything unsafe by disabling TLS,
allowing backups in unhealthy clusters, etc... without user's explicit
intent.
With these changes, we decouple those things from the unsafe flag and
remove all implicit behaviors. We introduce a new section called
`unsafeFlags`:
```
unsafeFlags:
tls: false
replsetSize: false
mongosSize: false
terminationGracePeriod: false
backupIfUnhealthy: false
```
Starting from `v1.16.0`, `allowUnsafeConfigurations` is deprecated and
won't have any affect.
**TLS Mode**
This decoupling required a special attention to the TLS configuration.
Before these changes only way to disable TLS is setting
`allowUnsafeConfigurations` to true. Now, we introduce a new field:
```
spec:
tls:
mode: disabled
```
This field accepts the following values: `disabled`, `allowTLS`,
`preferTLS` and `requireTLS`.
If user sets mode to `disabled`, the operator will throw an error: `TLS
must be enabled. Set spec.unsafeFlags.tls to true to disable this
check.`
Since the use of TLS flags and reconciling TLS secrets depends on
`tls.mode` field, we need to block users to set `net.tls.mode` in custom
MongoDB configuration. If user sets a custom configuration like:
```
spec:
replsets:
- name: rs0
size: 3
configuration: |
net:
tls:
mode: allowTLS
```
the operator will throw an error: `tlsMode must be set using spec.tls.mode`.
* fix tests
* fix tests
* fix tests
* fix tests
* fix tests
* fix pvc-resize
* fix custom-replset-name
* address review comments
* fix cluster deletion
* comment unsafe flags1 parent 5bc28b1 commit c325d88
File tree
195 files changed
+980
-486
lines changed- build
- config/crd/bases
- deploy
- e2e-tests
- arbiter
- compare
- conf
- custom-replset-name/conf
- data-at-rest-encryption/compare
- data-sharded/conf
- default-cr/compare
- demand-backup-eks-credentials/compare
- demand-backup-physical-sharded/compare
- demand-backup-physical/compare
- demand-backup-sharded/compare
- demand-backup/compare
- expose-sharded/compare
- init-deploy
- compare
- conf
- limits/compare
- liveness/compare
- monitoring-2-0
- compare
- conf
- non-voting/compare
- one-pod
- compare
- conf
- pitr-physical/compare
- pitr-sharded/compare
- pitr/compare
- pvc-resize/compare
- recover-no-primary/conf
- rs-shard-migration/compare
- scaling
- scheduled-backup/compare
- security-context/compare
- service-per-pod/compare
- serviceless-external-nodes/conf
- smart-update
- compare
- conf
- split-horizon/conf
- storage/compare
- upgrade-consistency-sharded-tls/compare
- upgrade-consistency/compare
- version-service
- compare
- conf
- pkg
- apis/psmdb/v1
- controller/perconaservermongodb
- testdata/reconcile-statefulset
- psmdb
- backup
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
195 files changed
+980
-486
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | 325 | | |
339 | 326 | | |
340 | 327 | | |
| |||
396 | 383 | | |
397 | 384 | | |
398 | 385 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
410 | 397 | | |
411 | 398 | | |
412 | 399 | | |
| |||
422 | 409 | | |
423 | 410 | | |
424 | 411 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
443 | 417 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
451 | 422 | | |
452 | 423 | | |
453 | | - | |
| 424 | + | |
454 | 425 | | |
455 | 426 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
462 | 430 | | |
463 | 431 | | |
464 | 432 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
477 | 447 | | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
482 | 455 | | |
483 | 456 | | |
484 | 457 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
490 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
491 | 465 | | |
492 | 466 | | |
493 | 467 | | |
494 | 468 | | |
| 469 | + | |
495 | 470 | | |
496 | 471 | | |
497 | 472 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17309 | 17309 | | |
17310 | 17310 | | |
17311 | 17311 | | |
| 17312 | + | |
| 17313 | + | |
17312 | 17314 | | |
17313 | 17315 | | |
17314 | 17316 | | |
| 17317 | + | |
| 17318 | + | |
| 17319 | + | |
| 17320 | + | |
| 17321 | + | |
| 17322 | + | |
| 17323 | + | |
| 17324 | + | |
| 17325 | + | |
| 17326 | + | |
| 17327 | + | |
| 17328 | + | |
| 17329 | + | |
17315 | 17330 | | |
17316 | 17331 | | |
17317 | 17332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17982 | 17982 | | |
17983 | 17983 | | |
17984 | 17984 | | |
| 17985 | + | |
| 17986 | + | |
17985 | 17987 | | |
17986 | 17988 | | |
17987 | 17989 | | |
| 17990 | + | |
| 17991 | + | |
| 17992 | + | |
| 17993 | + | |
| 17994 | + | |
| 17995 | + | |
| 17996 | + | |
| 17997 | + | |
| 17998 | + | |
| 17999 | + | |
| 18000 | + | |
| 18001 | + | |
| 18002 | + | |
17988 | 18003 | | |
17989 | 18004 | | |
17990 | 18005 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17982 | 17982 | | |
17983 | 17983 | | |
17984 | 17984 | | |
| 17985 | + | |
| 17986 | + | |
17985 | 17987 | | |
17986 | 17988 | | |
17987 | 17989 | | |
| 17990 | + | |
| 17991 | + | |
| 17992 | + | |
| 17993 | + | |
| 17994 | + | |
| 17995 | + | |
| 17996 | + | |
| 17997 | + | |
| 17998 | + | |
| 17999 | + | |
| 18000 | + | |
| 18001 | + | |
| 18002 | + | |
17988 | 18003 | | |
17989 | 18004 | | |
17990 | 18005 | | |
| |||
0 commit comments