cmd.Flags().StringVarP(&o.Selector,"selector","l",o.Selector,"Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
cmd.Flags().StringVarP(&o.Selector,"selector","l",o.Selector,"Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
cmd.Flags().BoolVar(&o.All,"all",o.All,"Select all resources in the namespace of the specified resource types.")
cmd.Flags().BoolVar(&o.All,"all",o.All,"Select all resources in the namespace of the specified resource types.")
cmd.Flags().StringArrayVar(&o.PruneWhitelist,"prune-whitelist",o.PruneWhitelist,"Overwrite the default whitelist with <group/version/kind> for --prune")
cmd.Flags().StringArrayVar(&o.PruneWhitelist,"prune-whitelist",o.PruneWhitelist,"Overwrite the default whitelist with <group/version/kind> for --prune")
cmd.Flags().BoolVar(&o.OpenApiPatch,"openapi-patch",o.OpenApiPatch,"If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types.")
cmd.Flags().BoolVar(&o.OpenAPIPatch,"openapi-patch",o.OpenAPIPatch,"If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types.")
cmd.Flags().BoolVar(&o.ServerDryRun,"server-dry-run",o.ServerDryRun,"If true, request will be sent to server with dry-run flag, which means the modifications won't be persisted. This is an alpha feature and flag.")
cmd.Flags().BoolVar(&o.ServerDryRun,"server-dry-run",o.ServerDryRun,"If true, request will be sent to server with dry-run flag, which means the modifications won't be persisted. This is an alpha feature and flag.")
returnfmt.Errorf("cannot set --all and --selector at the same time")
returnfmt.Errorf("cannot set --all and --selector at the same time")
}
}
ifprune&&!all&&selector==""{
ifprune&&!all&&selector==""{
returnfmt.Errorf("all resources selected for prune without explicitly passing --all. To prune all resources, pass the --all flag. If you did not mean to prune all resources, specify a label selector.")
returnfmt.Errorf("all resources selected for prune without explicitly passing --all. To prune all resources, pass the --all flag. If you did not mean to prune all resources, specify a label selector")
err=fmt.Errorf("An error occurred force-replacing the existing object with the newly provided one:\n\n%v.\n\nAdditionally, an error occurred attempting to restore the original object:\n\n%v\n",err,recreateErr)
err=fmt.Errorf("An error occurred force-replacing the existing object with the newly provided one:\n\n%v.\n\nAdditionally, an error occurred attempting to restore the original object:\n\n%v",err,recreateErr)
statusErr:=kubeerr.NewConflict(schema.GroupResource{Group:"",Resource:"rc"},"test-rc",fmt.Errorf("the object has been modified. Please apply at first."))
statusErr:=kubeerr.NewConflict(schema.GroupResource{Group:"",Resource:"rc"},"test-rc",fmt.Errorf("the object has been modified. Please apply at first"))
statusErr:=kubeerr.NewConflict(schema.GroupResource{Group:"",Resource:"rc"},"test-rc",fmt.Errorf("the object has been modified. Please apply at first."))
statusErr:=kubeerr.NewConflict(schema.GroupResource{Group:"",Resource:"rc"},"test-rc",fmt.Errorf("the object has been modified. Please apply at first"))
cmd.Flags().Int32Var(&o.Min,"min",-1,"The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.")
cmd.Flags().Int32Var(&o.Min,"min",-1,"The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.")
cmd.Flags().Int32Var(&o.Max,"max",-1,"The upper limit for the number of pods that can be set by the autoscaler. Required.")
cmd.Flags().Int32Var(&o.Max,"max",-1,"The upper limit for the number of pods that can be set by the autoscaler. Required.")
cmd.MarkFlagRequired("max")
cmd.MarkFlagRequired("max")
cmd.Flags().Int32Var(&o.CpuPercent,"cpu-percent",-1,fmt.Sprintf("The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used."))
cmd.Flags().Int32Var(&o.CPUPercent,"cpu-percent",-1,fmt.Sprintf("The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used."))
cmd.Flags().StringVar(&o.Name,"name","",i18n.T("The name for the newly created object. If not specified, the name of the input resource will be used."))
cmd.Flags().StringVar(&o.Name,"name","",i18n.T("The name for the newly created object. If not specified, the name of the input resource will be used."))
cmdutil.AddDryRunFlag(cmd)
cmdutil.AddDryRunFlag(cmd)
cmdutil.AddFilenameOptionFlags(cmd,o.FilenameOptions,"identifying the resource to autoscale.")
cmdutil.AddFilenameOptionFlags(cmd,o.FilenameOptions,"identifying the resource to autoscale.")
Specifying a name that already exists will merge new fields on top of existing values.
Specifying a name that already exists will merge new fields on top of existing values.
...
@@ -72,7 +72,7 @@ var (
...
@@ -72,7 +72,7 @@ var (
Bearer token and basic auth are mutually exclusive.`),clientcmd.FlagCertFile,clientcmd.FlagKeyFile,clientcmd.FlagBearerToken,clientcmd.FlagUsername,clientcmd.FlagPassword)
Bearer token and basic auth are mutually exclusive.`),clientcmd.FlagCertFile,clientcmd.FlagKeyFile,clientcmd.FlagBearerToken,clientcmd.FlagUsername,clientcmd.FlagPassword)
create_authinfo_example=templates.Examples(`
createAuthInfoExample=templates.Examples(`
# Set only the "client-key" field on the "cluster-admin"
# Set only the "client-key" field on the "cluster-admin"
Use:fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]",clientcmd.FlagAPIServer,clientcmd.FlagCAFile,clientcmd.FlagInsecure),
Use:fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]",clientcmd.FlagAPIServer,clientcmd.FlagCAFile,clientcmd.FlagInsecure),
DisableFlagsInUseLine:true,
DisableFlagsInUseLine:true,
Short:i18n.T("Sets a cluster entry in kubeconfig"),
Short:i18n.T("Sets a cluster entry in kubeconfig"),
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wish to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.`)
PROPERTY_VALUE is the new value you wish to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.`)
// NewCmdConfigSet returns a Command instance for 'config set' sub command
Short:i18n.T("Drain node in preparation for maintenance"),
Short:i18n.T("Drain node in preparation for maintenance"),
Long:drain_long,
Long:drainLong,
Example:drain_example,
Example:drainExample,
Run:func(cmd*cobra.Command,args[]string){
Run:func(cmd*cobra.Command,args[]string){
cmdutil.CheckErr(options.Complete(f,cmd,args))
cmdutil.CheckErr(o.Complete(f,cmd,args))
cmdutil.CheckErr(options.RunDrain())
cmdutil.CheckErr(o.RunDrain())
},
},
}
}
cmd.Flags().BoolVar(&options.Force,"force",options.Force,"Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet.")
cmd.Flags().BoolVar(&o.Force,"force",o.Force,"Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet.")
cmd.Flags().BoolVar(&options.DeleteLocalData,"delete-local-data",options.DeleteLocalData,"Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).")
cmd.Flags().BoolVar(&o.DeleteLocalData,"delete-local-data",o.DeleteLocalData,"Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).")
cmd.Flags().IntVar(&options.GracePeriodSeconds,"grace-period",options.GracePeriodSeconds,"Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.")
cmd.Flags().IntVar(&o.GracePeriodSeconds,"grace-period",o.GracePeriodSeconds,"Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.")
cmd.Flags().DurationVar(&options.Timeout,"timeout",options.Timeout,"The length of time to wait before giving up, zero means infinite")
cmd.Flags().DurationVar(&o.Timeout,"timeout",o.Timeout,"The length of time to wait before giving up, zero means infinite")
cmd.Flags().StringVarP(&options.Selector,"selector","l",options.Selector,"Selector (label query) to filter on")
cmd.Flags().StringVarP(&o.Selector,"selector","l",o.Selector,"Selector (label query) to filter on")
cmd.Flags().StringVarP(&options.PodSelector,"pod-selector","",options.PodSelector,"Label selector to filter pods on the node")
cmd.Flags().StringVarP(&o.PodSelector,"pod-selector","",o.PodSelector,"Label selector to filter pods on the node")
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.
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.
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
Possible resources include (case insensitive): %s.`)
Possible resources include (case insensitive): %s.`)
resources_example=templates.Examples(`
resourcesExample=templates.Examples(`
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
# 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
kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
...
@@ -59,7 +59,7 @@ var (
...
@@ -59,7 +59,7 @@ var (
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml`)
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml`)
)
)
// ResourcesOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of
// SetResourcesOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of