Add "fieldManager" to flag to PATCH/CREATE/UPDATE

And add a corresponding flag in kubectl (for apply), even though the
value is defaulted in kubectl with "kubectl".

The flag is required for Apply patch-type, and optional for other PATCH,
CREATE and UPDATE (in which case we fallback on the user-agent).
This commit is contained in:
Antoine Pelisse
2019-02-16 20:16:11 -08:00
parent 8bde75e63f
commit eb904d8fa8
20 changed files with 378 additions and 34 deletions

View File

@@ -406,8 +406,9 @@ func AddDryRunFlag(cmd *cobra.Command) {
}
func AddServerSideApplyFlags(cmd *cobra.Command) {
cmd.Flags().Bool("server-side", false, "If true, apply runs in the server instead of the client. This is an alpha feature and flag.")
cmd.Flags().Bool("force-conflicts", false, "If true, server-side apply will force the changes against conflicts. This is an alpha feature and flag.")
cmd.Flags().Bool("experimental-server-side", false, "If true, apply runs in the server instead of the client. This is an alpha feature and flag.")
cmd.Flags().Bool("experimental-force-conflicts", false, "If true, server-side apply will force the changes against conflicts. This is an alpha feature and flag.")
cmd.Flags().String("experimental-field-manager", "kubectl", "Name of the manager used to track field ownership. This is an alpha feature and flag.")
}
func AddIncludeUninitializedFlag(cmd *cobra.Command) {
@@ -484,11 +485,15 @@ func DumpReaderToFile(reader io.Reader, filename string) error {
}
func GetServerSideApplyFlag(cmd *cobra.Command) bool {
return GetFlagBool(cmd, "server-side")
return GetFlagBool(cmd, "experimental-server-side")
}
func GetForceConflictsFlag(cmd *cobra.Command) bool {
return GetFlagBool(cmd, "force-conflicts")
return GetFlagBool(cmd, "experimental-force-conflicts")
}
func GetFieldManagerFlag(cmd *cobra.Command) string {
return GetFlagString(cmd, "experimental-field-manager")
}
func GetDryRunFlag(cmd *cobra.Command) bool {