Skip to content

Commit ea55fd9

Browse files
committed
Deprecate a bunch of policy commands
Push people to use native RBAC commands where reasonable equivalents exist, or where the replacement command will lead to better practices. Signed-off-by: Simo Sorce <[email protected]>
1 parent 00c6589 commit ea55fd9

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

pkg/oc/admin/policy/cani.go

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func NewCmdCanI(name, fullName string, f *clientcmd.Factory, out io.Writer) *cob
7171
os.Exit(2)
7272
}
7373
},
74+
Deprecated: fmt.Sprintf("Use oc auth can-i"),
7475
}
7576

7677
cmd.Flags().BoolVar(&o.AllNamespaces, "all-namespaces", o.AllNamespaces, "If true, check the specified action in all namespaces.")

pkg/oc/admin/policy/modify_roles.go

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func NewCmdAddRoleToGroup(name, fullName string, f *clientcmd.Factory, out io.Wr
8080
printSuccessForCommand(options.RoleName, true, "group", options.Targets, true, options.DryRun, out)
8181
}
8282
},
83+
Deprecated: fmt.Sprintf("Use oc edit rolebinding"),
8384
}
8485

8586
cmd.Flags().StringVar(&options.RoleBindingName, "rolebinding-name", "", "Name of the rolebinding to modify or create. If left empty, appends to the first rolebinding found for the given role")
@@ -113,6 +114,7 @@ func NewCmdAddRoleToUser(name, fullName string, f *clientcmd.Factory, out io.Wri
113114
printSuccessForCommand(options.RoleName, true, "user", options.Targets, true, options.DryRun, out)
114115
}
115116
},
117+
Deprecated: fmt.Sprintf("Use oc edit rolebinding"),
116118
}
117119

118120
cmd.Flags().StringVar(&options.RoleBindingName, "rolebinding-name", "", "Name of the rolebinding to modify or create. If left empty, appends to the first rolebinding found for the given role")
@@ -145,6 +147,7 @@ func NewCmdRemoveRoleFromGroup(name, fullName string, f *clientcmd.Factory, out
145147
printSuccessForCommand(options.RoleName, false, "group", options.Targets, true, options.DryRun, out)
146148
}
147149
},
150+
Deprecated: fmt.Sprintf("Use oc edit rolebinding"),
148151
}
149152

150153
cmd.Flags().StringVar(&options.RoleNamespace, "role-namespace", "", "namespace where the role is located: empty means a role defined in cluster policy")
@@ -176,6 +179,7 @@ func NewCmdRemoveRoleFromUser(name, fullName string, f *clientcmd.Factory, out i
176179
printSuccessForCommand(options.RoleName, false, "user", options.Targets, true, options.DryRun, out)
177180
}
178181
},
182+
Deprecated: fmt.Sprintf("Use oc edit rolebinding"),
179183
}
180184

181185
cmd.Flags().StringVar(&options.RoleNamespace, "role-namespace", "", "namespace where the role is located: empty means a role defined in cluster policy")
@@ -207,6 +211,7 @@ func NewCmdAddClusterRoleToGroup(name, fullName string, f *clientcmd.Factory, ou
207211
printSuccessForCommand(options.RoleName, true, "group", options.Targets, false, options.DryRun, out)
208212
}
209213
},
214+
Deprecated: fmt.Sprintf("Use oc edit clusterrolebinding"),
210215
}
211216

212217
cmd.Flags().StringVar(&options.RoleBindingName, "rolebinding-name", "", "Name of the rolebinding to modify or create. If left empty, appends to the first rolebinding found for the given role")
@@ -237,6 +242,7 @@ func NewCmdAddClusterRoleToUser(name, fullName string, f *clientcmd.Factory, out
237242
printSuccessForCommand(options.RoleName, true, "user", options.Targets, false, options.DryRun, out)
238243
}
239244
},
245+
Deprecated: fmt.Sprintf("Use oc edit clusterrolebinding"),
240246
}
241247

242248
cmd.Flags().StringVar(&options.RoleBindingName, "rolebinding-name", "", "Name of the rolebinding to modify or create. If left empty, appends to the first rolebinding found for the given role")
@@ -268,6 +274,7 @@ func NewCmdRemoveClusterRoleFromGroup(name, fullName string, f *clientcmd.Factor
268274
printSuccessForCommand(options.RoleName, false, "group", options.Targets, false, options.DryRun, out)
269275
}
270276
},
277+
Deprecated: fmt.Sprintf("Use oc edit clusterrolebinding"),
271278
}
272279

273280
kcmdutil.AddDryRunFlag(cmd)
@@ -297,6 +304,7 @@ func NewCmdRemoveClusterRoleFromUser(name, fullName string, f *clientcmd.Factory
297304
printSuccessForCommand(options.RoleName, false, "user", options.Targets, false, options.DryRun, out)
298305
}
299306
},
307+
Deprecated: fmt.Sprintf("Use oc edit clusterrolebinding"),
300308
}
301309

302310
cmd.Flags().StringSliceVarP(&saNames, "serviceaccount", "z", saNames, "service account in the current namespace to use as a user")

pkg/oc/admin/policy/reconcile_clusterrolebindings.go

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func NewCmdReconcileClusterRoleBindings(name, fullName string, f *clientcmd.Fact
104104
kcmdutil.CheckErr(err)
105105
}
106106
},
107+
Deprecated: fmt.Sprintf("Use oc auth reconcile"),
107108
}
108109

109110
cmd.Flags().BoolVar(&o.Confirmed, "confirm", o.Confirmed, "If true, specify that cluster role bindings should be modified. Defaults to false, displaying what would be replaced but not actually replacing anything.")

pkg/oc/admin/policy/reconcile_clusterroles.go

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func NewCmdReconcileClusterRoles(name, fullName string, f *clientcmd.Factory, ou
100100
kcmdutil.CheckErr(err)
101101
}
102102
},
103+
Deprecated: fmt.Sprintf("Use oc auth reconcile"),
103104
}
104105

105106
cmd.Flags().BoolVar(&o.Confirmed, "confirm", o.Confirmed, "If true, specify that cluster roles should be modified. Defaults to false, displaying what would be replaced but not actually replacing anything.")

0 commit comments

Comments
 (0)