mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-18 13:22:17 +00:00
Merge pull request #3644 from natasha41575/AllowGeneralNameChanges
allow general name and kind changes via an options field in patches
This commit is contained in:
@@ -22,9 +22,8 @@ var theArgs struct {
|
||||
var theFlags struct {
|
||||
outputPath string
|
||||
enable struct {
|
||||
resourceIdChanges bool
|
||||
plugins bool
|
||||
managedByLabel bool
|
||||
plugins bool
|
||||
managedByLabel bool
|
||||
}
|
||||
loadRestrictor string
|
||||
reorderOutput string
|
||||
@@ -104,7 +103,6 @@ func NewCmdBuild(
|
||||
AddFlagEnablePlugins(cmd.Flags())
|
||||
AddFlagReorderOutput(cmd.Flags())
|
||||
AddFlagEnableManagedbyLabel(cmd.Flags())
|
||||
AddFlagAllowResourceIdChanges(cmd.Flags())
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -140,6 +138,5 @@ func HonorKustomizeFlags(kOpts *krusty.Options) *krusty.Options {
|
||||
kOpts.PluginConfig = c
|
||||
}
|
||||
kOpts.AddManagedbyLabel = isManagedByLabelEnabled()
|
||||
kOpts.AllowResourceIdChanges = theFlags.enable.resourceIdChanges
|
||||
return kOpts
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func AddFlagAllowResourceIdChanges(set *pflag.FlagSet) {
|
||||
set.BoolVar(
|
||||
&theFlags.enable.resourceIdChanges,
|
||||
"allow-id-changes",
|
||||
false,
|
||||
`enable changes to a resourceId`)
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func (o *removePatchOptions) RunRemovePatch(fSys filesys.FileSystem) error {
|
||||
}
|
||||
}
|
||||
if len(patches) == len(m.Patches) {
|
||||
log.Printf("patch %s doesn't exist in kustomization file", o.Patch)
|
||||
log.Printf("patch %s doesn't exist in kustomization file", o.Patch.Patch)
|
||||
return nil
|
||||
}
|
||||
m.Patches = patches
|
||||
|
||||
Reference in New Issue
Block a user