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
See issue kubernetes-retired#16. To allow inclusive propagation of resources an
additional `SyncornizationMode` called 'AllowPropagate' which only enables
propagation when a selector is set is added. An 'all' selector is also addded.
Tested: e2e-testing covering secrets resource in 'AllowPropagate' mode and checking
propagation when selectors are set and unset ('select', 'treeSelect', 'none', 'all').
Unit testing is also modified to account for the new 'all' selection
Signed-off-by: mzeevi <[email protected]>
// Get types that are changed from other modes to "Propagate" mode.
130
+
// Get types that are changed from other modes to "Propagate" mode or "AllowPropagate" mode.
131
131
gvks:=v.getNewPropagateTypes(ts)
132
132
133
133
// Check if user-created objects would be overwritten by these mode changes.
134
-
forgvk:=rangegvks {
135
-
conflicts:=v.checkConflictsForGVK(gvk)
134
+
forgvk, mode:=rangegvks {
135
+
conflicts:=v.checkConflictsForGVK(gvk, mode)
136
136
iflen(conflicts) !=0 {
137
-
msg:=fmt.Sprintf("Cannot update configuration because setting type %q to 'Propagate' mode would overwrite user-created object(s):\n", gvk)
137
+
msg:=fmt.Sprintf("Cannot update configuration because setting type %q to 'Propagate' mode or 'AllowPropagate' mode would overwrite user-created object(s):\n", gvk)
138
138
msg+=strings.Join(conflicts, "\n")
139
139
msg+="\nTo fix this, please rename or remove the conflicting objects first."
fmt.Printf("Switching directly from 'Ignore' to 'Propagate' mode or 'AllowPropagate' mode could cause existing %q objects in "+
53
53
"child namespaces to be overwritten by objects from ancestor namespaces.\n", resource)
54
54
fmt.Println("If you are sure you want to proceed with this operation, use the '--force' flag.")
55
55
fmt.Println("If you are not sure and would like to see what source objects would be overwritten,"+
@@ -78,7 +78,19 @@ var setResourceCmd = &cobra.Command{
78
78
79
79
funcnewSetResourceCmd() *cobra.Command {
80
80
setResourceCmd.Flags().String("group", "", "The group of the resource; may be omitted for core resources (or explicitly set to the empty string)")
81
-
setResourceCmd.Flags().String("mode", "", "The synchronization mode: one of Propagate, Remove or Ignore")
82
-
setResourceCmd.Flags().BoolP("force", "f", false, "Allow the synchronization mode to be changed directly from Ignore to Propagate despite the dangers of doing so")
81
+
setResourceCmd.Flags().String("mode", "", "The synchronization mode: one of Propagate, Remove, Ignore and AllowPropagate")
82
+
setResourceCmd.Flags().BoolP("force", "f", false, "Allow the synchronization mode to be changed directly from Ignore to Propagate or AllowPropagate despite the dangers of doing so")
83
83
returnsetResourceCmd
84
84
}
85
+
86
+
// normalizeMode takes a user-input mode and returns
0 commit comments