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

291 lines
10 KiB
Go
Raw Normal View History

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
/*
Copyright 2016 The Kubernetes Authors.
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 (
"fmt"
"github.com/golang/glog"
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
"github.com/spf13/cobra"
2018-05-21 19:27:11 +00:00
"k8s.io/api/core/v1"
2017-01-11 14:09:48 +00:00
"k8s.io/apimachinery/pkg/runtime"
2017-01-16 20:13:59 +00:00
"k8s.io/apimachinery/pkg/types"
2017-01-11 14:09:48 +00:00
utilerrors "k8s.io/apimachinery/pkg/util/errors"
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
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
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
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
2018-04-19 12:32:15 +00:00
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
2018-05-02 19:15:47 +00:00
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/printers"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl/polymorphichelpers"
"k8s.io/kubernetes/pkg/kubectl/scheme"
2017-07-07 04:04:11 +00:00
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
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
)
var (
resources_long = templates.LongDesc(`
Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
2016-12-05 02:58:56 +00:00
Possible resources include (case insensitive): %s.`)
resources_example = templates.Examples(`
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
# Set the resource request and limits for all containers in nginx
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
# Remove the resource requests for resources on containers in nginx
kubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
# Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml`)
)
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
// ResourcesOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of
// referencing the cmd.Flags
2018-04-19 12:32:15 +00:00
type SetResourcesOptions struct {
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
resource.FilenameOptions
2018-05-02 19:15:47 +00:00
PrintFlags *genericclioptions.PrintFlags
2018-04-19 12:32:15 +00:00
RecordFlags *genericclioptions.RecordFlags
2018-04-04 20:23:33 +00:00
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
Infos []*resource.Info
Selector string
ContainerSelector string
Output string
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
All bool
Local bool
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
2018-04-04 20:23:33 +00:00
DryRun bool
PrintObj printers.ResourcePrinterFunc
2018-04-19 12:32:15 +00:00
Recorder genericclioptions.Recorder
2018-04-04 20:23:33 +00:00
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
Limits string
Requests string
ResourceRequirements v1.ResourceRequirements
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
UpdatePodSpecForObject polymorphichelpers.UpdatePodSpecForObjectFunc
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
Resources []string
2018-04-25 12:32:08 +00:00
genericclioptions.IOStreams
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
}
// NewResourcesOptions returns a ResourcesOptions indicating all containers in the selected
// pod templates are selected by default.
2018-04-25 12:32:08 +00:00
func NewResourcesOptions(streams genericclioptions.IOStreams) *SetResourcesOptions {
2018-04-19 12:32:15 +00:00
return &SetResourcesOptions{
2018-05-02 19:15:47 +00:00
PrintFlags: genericclioptions.NewPrintFlags("resource requirements updated").WithTypeSetter(scheme.Scheme),
2018-04-19 12:32:15 +00:00
RecordFlags: genericclioptions.NewRecordFlags(),
Recorder: genericclioptions.NoopRecorder{},
2018-04-04 20:23:33 +00:00
ContainerSelector: "*",
2018-04-25 12:32:08 +00:00
IOStreams: streams,
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
}
}
2018-04-25 12:32:08 +00:00
func NewCmdResources(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
o := NewResourcesOptions(streams)
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 := &cobra.Command{
Use: "resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]",
DisableFlagsInUseLine: true,
Short: i18n.T("Update resource requests/limits on objects with pod templates"),
Long: fmt.Sprintf(resources_long, cmdutil.SuggestApiResources("kubectl")),
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
Example: resources_example,
Run: func(cmd *cobra.Command, args []string) {
2018-04-19 12:32:15 +00:00
cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate())
cmdutil.CheckErr(o.Run())
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
},
}
2018-04-19 12:32:15 +00:00
o.PrintFlags.AddFlags(cmd)
o.RecordFlags.AddFlags(cmd)
2018-04-04 20:23:33 +00:00
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
//usage := "Filename, directory, or URL to a file identifying the resource to get from the server"
//kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
usage := "identifying the resource to get from a server."
2018-04-19 12:32:15 +00:00
cmdutil.AddFilenameOptionFlags(cmd, &o.FilenameOptions, usage)
cmd.Flags().BoolVar(&o.All, "all", o.All, "Select all resources, including uninitialized ones, in the namespace of the specified resource types")
cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on, not including uninitialized ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
cmd.Flags().StringVarP(&o.ContainerSelector, "containers", "c", o.ContainerSelector, "The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards")
cmd.Flags().BoolVar(&o.Local, "local", o.Local, "If true, set resources will NOT contact api-server but run locally.")
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
cmdutil.AddDryRunFlag(cmd)
cmdutil.AddIncludeUninitializedFlag(cmd)
2018-04-19 12:32:15 +00:00
cmd.Flags().StringVar(&o.Limits, "limits", o.Limits, "The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.")
cmd.Flags().StringVar(&o.Requests, "requests", o.Requests, "The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.")
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
return cmd
}
2018-04-19 12:32:15 +00:00
func (o *SetResourcesOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
var err error
2018-05-21 19:27:11 +00:00
o.RecordFlags.Complete(cmd)
2018-04-19 12:32:15 +00:00
o.Recorder, err = o.RecordFlags.ToRecorder()
if err != nil {
return err
}
o.UpdatePodSpecForObject = polymorphichelpers.UpdatePodSpecForObjectFn
o.Output = cmdutil.GetFlagString(cmd, "output")
2018-04-19 14:41:17 +00:00
o.DryRun = cmdutil.GetDryRunFlag(cmd)
2018-04-04 20:23:33 +00:00
if o.DryRun {
o.PrintFlags.Complete("%s (dry run)")
}
2018-04-04 20:23:33 +00:00
printer, err := o.PrintFlags.ToPrinter()
if err != nil {
return err
}
o.PrintObj = printer.PrintObj
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
cmdNamespace, enforceNamespace, err := f.ToRawKubeConfigLoader().Namespace()
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
if err != nil {
return err
}
includeUninitialized := cmdutil.ShouldIncludeUninitialized(cmd, false)
builder := f.NewBuilder().
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
LocalParam(o.Local).
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
ContinueOnError().
NamespaceParam(cmdNamespace).DefaultNamespace().
FilenameParam(enforceNamespace, &o.FilenameOptions).
IncludeUninitialized(includeUninitialized).
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
Flatten()
if !o.Local {
builder.LabelSelectorParam(o.Selector).
ResourceTypeOrNameArgs(o.All, args...).
Latest()
} else {
// if a --local flag was provided, and a resource was specified in the form
// <resource>/<name>, fail immediately as --local cannot query the api server
// for the specified resource.
// TODO: this should be in the builder - if someone specifies tuples, fail when
// local is true
if len(args) > 0 {
return resource.LocalResourceError
}
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
}
o.Infos, err = builder.Do().Infos()
if err != nil {
return err
}
return nil
}
2018-04-19 12:32:15 +00:00
func (o *SetResourcesOptions) Validate() error {
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
var err error
if o.All && len(o.Selector) > 0 {
return fmt.Errorf("cannot set --all and --selector at the same time")
}
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
if len(o.Limits) == 0 && len(o.Requests) == 0 {
return fmt.Errorf("you must specify an update to requests or limits (in the form of --requests/--limits)")
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
}
o.ResourceRequirements, err = kubectl.HandleResourceRequirementsV1(map[string]string{"limits": o.Limits, "requests": o.Requests})
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
if err != nil {
return err
}
return nil
}
2018-04-19 12:32:15 +00:00
func (o *SetResourcesOptions) Run() error {
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
allErrs := []error{}
patches := CalculatePatches(o.Infos, scheme.DefaultJSONEncoder(), func(obj runtime.Object) ([]byte, error) {
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
transformed := false
_, err := o.UpdatePodSpecForObject(obj, func(spec *v1.PodSpec) error {
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
containers, _ := selectContainers(spec.Containers, o.ContainerSelector)
if len(containers) != 0 {
for i := range containers {
if len(o.Limits) != 0 && len(containers[i].Resources.Limits) == 0 {
containers[i].Resources.Limits = make(v1.ResourceList)
}
for key, value := range o.ResourceRequirements.Limits {
containers[i].Resources.Limits[key] = value
}
if len(o.Requests) != 0 && len(containers[i].Resources.Requests) == 0 {
containers[i].Resources.Requests = make(v1.ResourceList)
}
for key, value := range o.ResourceRequirements.Requests {
containers[i].Resources.Requests[key] = value
}
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
transformed = true
}
} else {
allErrs = append(allErrs, fmt.Errorf("error: unable to find container named %s", o.ContainerSelector))
}
return nil
})
2018-04-19 12:32:15 +00:00
if err != nil {
return nil, err
2016-11-14 11:53:27 +00:00
}
2018-04-19 12:32:15 +00:00
if !transformed {
return nil, nil
}
// record this change (for rollout history)
if err := o.Recorder.Record(obj); err != nil {
2018-04-19 12:32:15 +00:00
glog.V(4).Infof("error recording current command: %v", err)
}
return runtime.Encode(scheme.DefaultJSONEncoder(), obj)
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
})
for _, patch := range patches {
info := patch.Info
if patch.Err != nil {
allErrs = append(allErrs, fmt.Errorf("error: %s/%s %v\n", info.Mapping.Resource, info.Name, patch.Err))
continue
}
//no changes
if string(patch.Patch) == "{}" || len(patch.Patch) == 0 {
allErrs = append(allErrs, fmt.Errorf("info: %s %q was not changed\n", info.Mapping.Resource, info.Name))
continue
}
2018-04-04 20:23:33 +00:00
if o.Local || o.DryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
allErrs = append(allErrs, err)
}
continue
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
}
actual, err := resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, types.StrategicMergePatchType, patch.Patch)
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
if err != nil {
allErrs = append(allErrs, fmt.Errorf("failed to patch limit update to pod template %v\n", err))
continue
}
if err := o.PrintObj(actual, o.Out); err != nil {
allErrs = append(allErrs, 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
}
return utilerrors.NewAggregate(allErrs)
}