k3s/pkg/kubectl/cmd/set/set.go

51 lines
1.4 KiB
Go
Raw Normal View History

2016-05-11 00:24:05 +00:00
/*
Copyright 2016 The Kubernetes Authors.
2016-05-11 00:24:05 +00:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package set
import (
"io"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
2016-05-11 00:24:05 +00:00
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/util/i18n"
2016-05-11 00:24:05 +00:00
)
var (
set_long = templates.LongDesc(`
Configure application resources
These commands help you make changes to existing application resources.`)
2016-05-11 00:24:05 +00:00
)
func NewCmdSet(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
2016-05-11 00:24:05 +00:00
cmd := &cobra.Command{
Use: "set SUBCOMMAND",
Short: i18n.T("Set specific features on objects"),
Long: set_long,
Run: cmdutil.DefaultSubCommandRun(err),
2016-05-11 00:24:05 +00:00
}
2016-05-11 00:26:39 +00:00
// add subcommands
cmd.AddCommand(NewCmdImage(f, out, err))
Add 'kubectl set limit' Add a way to set resource limits/requests on running pods Ref: https://github.com/kubernetes/kubernetes/issues/21648 I squashed the commits to make rebasing easier Change log: - fixed a typo that caused the command to be run with kubectl set set instead of the correct kubectl set limit - added a ResourcesWithPodTemplates to pkg/kubectl/cmd/util/factory.go instead of hardcoding these resources move there description all in one place - Fixing some of the flow control in kubectl set limit - update the help info - changed the name of ResourcesWithPodTemplates to ResourcesWithPodSpecs to more accuratly describe what it is doing and changed the variable names to lower case to conform to go's variable naming convention - changing the name of the command from 'set limit' to 'set resources' - Adding the new file pkg/kubectl/cmd/set/set_resources.go - changes to the test cases to reflect the change from 'kubectl set limit' to 'kubectl set resources' - comment removed - adding the man page to the git repository attempting to fix Jenkins tests - adding the user guide - fixed a few typos - typo in hack/cmd-test.sh - implamenting suggestions for command help text - adding the dry-run flag - removing the "remove" option in favor of zeroing out request/limits in order to remove them - changed limits/requests to requests/limit - changing ResourcesWithPodSpec - updated generated docs and removed whitespace - change priint on success message from "resource limits/requests updated" to "resource requirements updated" - minor rebasing issues - 'hack/test-cmd.sh' now passes - cmdutil.PrintSuccess added another argument - fixing mungedocs failure - removed whitespace from hack/make-rules/test-cmd.sh and an erroneous entry from pkg/cloudprovider/providers/openstack/MAINTAINERS.md - fixed typo in Short: field of the cobra command - rebased - Creating a new factory in the ResourcesWithPodSpecs() so that the testing will pass - changing ResourcesWithPodSpecs, it doesn't need to be a method of factory
2016-06-10 21:25:56 +00:00
cmd.AddCommand(NewCmdResources(f, out, err))
2016-11-14 11:53:27 +00:00
cmd.AddCommand(NewCmdSelector(f, out))
cmd.AddCommand(NewCmdSubject(f, out, err))
cmd.AddCommand(NewCmdServiceAccount(f, out, err))
2016-05-11 00:24:05 +00:00
return cmd
}