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: docs/design/admin_control_over_spec.md
+67-50Lines changed: 67 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,37 +2,47 @@
2
2
3
3
## Abstract
4
4
5
-
Non Admin Controller (NAC) restricts the usage of OADP operator with NonAdminBackupsand NonAdminRestores.
6
-
Admin users may want to further restrict this by restricting NonAdminBackup/NonAdminRestore spec fields values.
5
+
Non Admin Controller (NAC) restricts the usage of OADP operator with NonAdminBackups, NonAdminRestores and NonAdminBackupStorageLocations.
6
+
Admin users may want to further restrict this by restricting NonAdminBackup/NonAdminRestore/NonAdminBackupStorageLocation spec fields values.
7
7
8
8
## Background
9
9
10
-
Non Admin Controller (NAC) adds the ability to admin users restrict the use of OADP operator for non admin users, by only allowing them to create backup/restores from their namespaces with NonAdminBackups/NonAdminRestores.
10
+
Non Admin Controller (NAC) adds the ability to admin users restrict the use of OADP operator for non admin users, by only allowing them to
11
+
create backup/restore/backupstoragelocation objects from their namespaces with NonAdminBackups/NonAdminRestores/NonAdminBackupStorageLocations.
11
12
Admin users may want to further restrict non admin users operations, like forcing a specific time to live (TTL) for NonAdminBackups associated Velero Backups.
12
-
This design enables admin users to set custom default values for NonAdminBackup/NonAdminRestore spec fields, which can not be overridden by non-admin users.
13
+
This design enables admin users to set custom default values for NonAdminBackup/NonAdminRestore/NonAdminBackupStorageLocation spec fields,
14
+
which can not be overridden by non-admin users.
13
15
14
16
## Goals
15
17
16
18
Enable admin users to
17
19
- set custom default values for NonAdminBackup spec.backupSpec fields, which can not be overridden
18
20
- set custom default values for NonAdminRestore spec.restoreSpec fields, which can not be overridden
21
+
- set custom default values for NonAdminBackupStorageLocation spec.backupStorageLocationSpec fields, which can not be overridden
19
22
20
23
Also
21
24
- Show custom default values validation errors in NAC object statuses and in NAC logs
22
25
23
26
## Non Goals
24
27
25
-
- Show NonAdminBackup spec.backupSpec fields/NonAdminRestore spec.restoreSpec fields custom default values to non admin users
26
-
- Prevent non admin users to create NonAdminBackup/NonAdminRestore with overridden defaults
28
+
- Show the custom default values to non admin users in NonAdminBackup/NonAdminRestore/NonAdminBackupStorageLocation spec fields
29
+
- Prevent non admin users to create NonAdminBackup/NonAdminRestore/NonAdminBackupStorageLocation with overridden defaults
27
30
- Allow admin users to set second level defaults (for example, NonAdminBackup `spec.backupSpec.labelSelector` can have a custom default value, but not just `spec.backupSpec.labelSelector.matchLabels`)
28
31
- Check if there are on-going NAC operations prior to recreating NAC Pod
29
-
- Allow admin users to enforce falsy values (like empty maps or empty lists) for NonAdminBackup spec.backupSpec fields/NonAdminRestore spec.restoreSpec fields
32
+
- Allow admin users to enforce falsy values (like empty maps or empty lists) for NonAdminBackup spec.backupSpec fields/NonAdminRestore spec.restoreSpec fields/NonAdminBackupStorageLocation spec.backupStorageLocationSpec fields
30
33
31
34
## High-Level Design
32
35
33
-
A field will be added to OADP DPA object. With it, admin users will be able to select which NonAdminBackup `spec.backupSpec` fields have custom default (and enforced) values. NAC will respect the set values. If a NonAdminBackup is created with fields overriding any enforced values, it will fail validation prior to creating an associated Velero Backup.
36
+
New fields will be added to the OADP DPA object, allowing admin users to define custom default and enforced values for specific fields in NonAdminBackup, NonAdminRestore, and NonAdminBackupStorageLocation specifications. The NAC will enforce these values accordingly.
34
37
35
-
Another field will be added to OADP DPA object. With it, admin users will be able to select which NonAdminRestore `spec.restoreSpec` fields have custom default (and enforced) values. NAC will respect the set values. If a NonAdminRestore is created with fields overriding any enforced values, it will fail validation prior to creating an associated Velero Restore.
38
+
-**NonAdminBackup:**
39
+
Admin users can specify which `spec.backupSpec` fields have custom default and enforced values. If a NonAdminBackup is created with values that override enforced settings, it will fail validation before creating an associated Velero Backup.
40
+
41
+
-**NonAdminRestore:**
42
+
Admin users can define enforced and default values for `spec.restoreSpec` fields. Any NonAdminRestore that attempts to override enforced values will fail validation before creating an associated Velero Restore.
43
+
44
+
-**NonAdminBackupStorageLocation:**
45
+
Admin users can set enforced and default values for `spec.backupStorageLocationSpec` fields, except for spec.backupStorageLocationSpec.default, which is not included in the enforcement BSL Spec. If a NonAdminBackupStorageLocation attempts to override enforced values, it will fail validation before creating an associated Velero BackupStorageLocation.
36
46
37
47
If admin user changes any enforced field value, NAC Pod is recreated to always be up to date with admin user enforcements.
38
48
@@ -42,7 +52,16 @@ If admin user changes any enforced field value, NAC Pod is recreated to always b
42
52
43
53
Field `spec.nonAdmin.enforceBackupSpec`, of the same type as the Velero Backup Spec, will be added to OADP DPA object.
44
54
45
-
With it, admin users will be able to select which NonAdminBackup `spec.backupSpec` fields have custom default (and enforced) values.
55
+
Field `spec.nonAdmin.enforceRestoreSpec`, of the same type as the Velero Restore Spec, will be added to OADP DPA object.
56
+
57
+
Field `spec.nonAdmin.enforceBSLSpec`, which mirrors the Velero BackupStorageLocation Spec, will be introduced in the
58
+
OADP DPA object with the following exceptions:
59
+
60
+
- Fields marked as `required` in the Velero BSL Spec are treated as `optional` in the enforcement BSL Spec.
61
+
This allows admin users to enforce specific fields without requiring others.
62
+
- The `default` field is excluded from the enforcement BSL Spec, because it can not be enforced.
63
+
64
+
With the above fields, admin users will be able to select for example which NonAdminBackup `spec.backupSpec` fields have custom default (and enforced) values.
46
65
47
66
To avoid mistakes, not all fields will be able to be enforced, like `IncludedNamespaces`, that could break NAC usage.
48
67
@@ -65,8 +84,6 @@ spec:
65
84
enable: true
66
85
enforceBackupSpecs:
67
86
snapshotVolumes: false
68
-
unsupportedOverrides:
69
-
tech-preview-ack: 'true'
70
87
```
71
88
72
89
That means, that the 2 following NonAdminBackup will be accepted by NAC validation
Store previous `EnforceBackupSpec` and `EnforceRestoreSpec` value, so when admin user changes it, Deployment is also changed to trigger a Pod recreation
147
+
Add `EnforceBSLSpec` struct to OADP DPA `NonAdmin` struct
if !enforcedField.IsZero() && currentField.IsZero() {
266
+
currentField.Set(enforcedField)
267
+
}
268
+
}
269
+
```
270
+
254
271
For more details, check https://github.com/openshift/oadp-operator/pull/1584, https://github.com/migtools/oadp-non-admin/pull/110, https://github.com/openshift/oadp-operator/pull/1600 and https://github.com/migtools/oadp-non-admin/pull/122.
0 commit comments