Merge pull request #3644 from natasha41575/AllowGeneralNameChanges

allow general name and kind changes via an options field in patches
This commit is contained in:
Jeff Regan
2021-03-15 15:49:04 -07:00
committed by GitHub
17 changed files with 285 additions and 146 deletions

View File

@@ -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
}

View File

@@ -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`)
}

View File

@@ -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