Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated flags #1498

Merged
merged 3 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions pkg/kn/commands/service/configuration_edit_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,6 @@ func (p *ConfigurationEditFlags) addSharedFlags(command *cobra.Command) {
p.markFlagMakesRevision(name)
}

command.Flags().IntVar(&p.MinScale, "min-scale", 0, "Minimal number of replicas.")
command.Flags().MarkHidden("min-scale")
p.markFlagMakesRevision("min-scale")

command.Flags().IntVar(&p.MaxScale, "max-scale", 0, "Maximal number of replicas.")
command.Flags().MarkHidden("max-scale")
p.markFlagMakesRevision("max-scale")

command.Flags().StringVar(&p.Scale, "scale", "",
"Set the Minimum and Maximum number of replicas. You can use this flag to set both to a single value, "+
"or set a range with min/max values, or set either min or max values without specifying the other. "+
Expand Down Expand Up @@ -241,20 +233,6 @@ func (p *ConfigurationEditFlags) Apply(
servinglib.UnsetUserImageAnnotation(template)
}

if cmd.Flags().Changed("limits-cpu") || cmd.Flags().Changed("limits-memory") {
if cmd.Flags().Changed("limit") {
return fmt.Errorf("only one of (DEPRECATED) --limits-cpu / --limits-memory and --limit can be specified")
}
fmt.Fprintf(cmd.OutOrStdout(), "\nWARNING: flags --limits-cpu / --limits-memory are deprecated and going to be removed in future release, please use --limit instead.\n\n")
}

if cmd.Flags().Changed("requests-cpu") || cmd.Flags().Changed("requests-memory") {
if cmd.Flags().Changed("request") {
return fmt.Errorf("only one of (DEPRECATED) --requests-cpu / --requests-memory and --request can be specified")
}
fmt.Fprintf(cmd.OutOrStdout(), "\nWARNING: flags --requests-cpu / --requests-memory are deprecated and going to be removed in future release, please use --request instead.\n\n")
}

// Deprecated "min-scale" in 0.19, updated to "scale-min"
if cmd.Flags().Changed("scale-min") || cmd.Flags().Changed("min-scale") {
err = servinglib.UpdateMinScale(template, p.MinScale)
Expand Down
17 changes: 5 additions & 12 deletions pkg/kn/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@ func (c *config) PluginsDir() string {

// LookupPluginsInPath returns true if plugins should be also checked in the pat
func (c *config) LookupPluginsInPath() bool {
if viper.IsSet(deprecatedKeyPluginsLookupInPath) {
return viper.GetBool(deprecatedKeyPluginsLookupInPath)
} else {
// If legacy branch is removed, switch to setting the default to viper
// See TODO comment below.
vyasgun marked this conversation as resolved.
Show resolved Hide resolved
return bootstrapDefaults.lookupPluginsInPath
}

// If legacy branch is removed, switch to setting the default to viper
// See TODO comment below.
vyasgun marked this conversation as resolved.
Show resolved Hide resolved
return bootstrapDefaults.lookupPluginsInPath

}

func (c *config) SinkMappings() []SinkMapping {
Expand Down Expand Up @@ -114,10 +112,6 @@ func BootstrapConfig() error {
if err != nil {
return err
}
err = viper.BindPFlag(deprecatedKeyPluginsLookupInPath, bootstrapFlagSet.Lookup(flagPluginsLookupInPath))
if err != nil {
return err
}

// Check if configfile exists. If not, just return
configFile := GlobalConfig.ConfigFile()
Expand All @@ -137,7 +131,6 @@ func BootstrapConfig() error {
// TODO: Re-enable when legacy handling for plugin config has been removed
// For now default handling is happening directly in the getter of GlobalConfig
// viper.SetDefault(keyPluginsDirectory, bootstrapDefaults.pluginsDir)
// viper.SetDefault(deprecatedKeyPluginsLookupInPath, bootstrapDefaults.lookupPluginsInPath)

// If a config file is found, read it in.
err = viper.ReadInConfig()
Expand Down
7 changes: 3 additions & 4 deletions pkg/kn/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ type ChannelTypeMapping struct {

// config Keys for looking up in viper
const (
keyPluginsDirectory = "plugins.directory"
deprecatedKeyPluginsLookupInPath = "plugins.path-lookup"
keySinkMappings = "eventing.sink-mappings"
keyChannelTypeMappings = "eventing.channel-type-mappings"
keyPluginsDirectory = "plugins.directory"
keySinkMappings = "eventing.sink-mappings"
keyChannelTypeMappings = "eventing.channel-type-mappings"
)

// legacy config keys, deprecated
Expand Down