Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3bc8b09e
Commit
3bc8b09e
authored
May 22, 2018
by
Guoliang Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move SuggestedPodTemplateResources from factory to set_resources
parent
bebc5c1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
22 deletions
+2
-22
set_resources.go
pkg/kubectl/cmd/set/set_resources.go
+2
-8
factory.go
pkg/kubectl/cmd/util/factory.go
+0
-4
factory_client_access.go
pkg/kubectl/cmd/util/factory_client_access.go
+0
-10
No files found.
pkg/kubectl/cmd/set/set_resources.go
View file @
3bc8b09e
...
@@ -18,11 +18,10 @@ package set
...
@@ -18,11 +18,10 @@ package set
import
(
import
(
"fmt"
"fmt"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/golang/glog"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
...
@@ -108,16 +107,11 @@ func NewResourcesOptions(streams genericclioptions.IOStreams) *SetResourcesOptio
...
@@ -108,16 +107,11 @@ func NewResourcesOptions(streams genericclioptions.IOStreams) *SetResourcesOptio
func
NewCmdResources
(
f
cmdutil
.
Factory
,
streams
genericclioptions
.
IOStreams
)
*
cobra
.
Command
{
func
NewCmdResources
(
f
cmdutil
.
Factory
,
streams
genericclioptions
.
IOStreams
)
*
cobra
.
Command
{
o
:=
NewResourcesOptions
(
streams
)
o
:=
NewResourcesOptions
(
streams
)
resourceTypesWithPodTemplate
:=
[]
string
{}
for
_
,
resource
:=
range
f
.
SuggestedPodTemplateResources
()
{
resourceTypesWithPodTemplate
=
append
(
resourceTypesWithPodTemplate
,
resource
.
Resource
)
}
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]"
,
Use
:
"resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]"
,
DisableFlagsInUseLine
:
true
,
DisableFlagsInUseLine
:
true
,
Short
:
i18n
.
T
(
"Update resource requests/limits on objects with pod templates"
),
Short
:
i18n
.
T
(
"Update resource requests/limits on objects with pod templates"
),
Long
:
fmt
.
Sprintf
(
resources_long
,
strings
.
Join
(
resourceTypesWithPodTemplate
,
",
"
)),
Long
:
fmt
.
Sprintf
(
resources_long
,
cmdutil
.
SuggestApiResources
(
"kubectl
"
)),
Example
:
resources_example
,
Example
:
resources_example
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
cmdutil
.
CheckErr
(
o
.
Complete
(
f
,
cmd
,
args
))
cmdutil
.
CheckErr
(
o
.
Complete
(
f
,
cmd
,
args
))
...
...
pkg/kubectl/cmd/util/factory.go
View file @
3bc8b09e
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"strings"
"strings"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes"
restclient
"k8s.io/client-go/rest"
restclient
"k8s.io/client-go/rest"
...
@@ -75,9 +74,6 @@ type ClientAccessFactory interface {
...
@@ -75,9 +74,6 @@ type ClientAccessFactory interface {
// and which implements the common patterns for CLI interactions with generic resources.
// and which implements the common patterns for CLI interactions with generic resources.
NewBuilder
()
*
resource
.
Builder
NewBuilder
()
*
resource
.
Builder
// SuggestedPodTemplateResources returns a list of resource types that declare a pod template
SuggestedPodTemplateResources
()
[]
schema
.
GroupResource
// Returns the default namespace to use in cases where no
// Returns the default namespace to use in cases where no
// other namespace is specified and whether the namespace was
// other namespace is specified and whether the namespace was
// overridden.
// overridden.
...
...
pkg/kubectl/cmd/util/factory_client_access.go
View file @
3bc8b09e
...
@@ -116,16 +116,6 @@ func (f *ring0Factory) RESTClient() (*restclient.RESTClient, error) {
...
@@ -116,16 +116,6 @@ func (f *ring0Factory) RESTClient() (*restclient.RESTClient, error) {
return
restclient
.
RESTClientFor
(
clientConfig
)
return
restclient
.
RESTClientFor
(
clientConfig
)
}
}
func
(
f
*
ring0Factory
)
SuggestedPodTemplateResources
()
[]
schema
.
GroupResource
{
return
[]
schema
.
GroupResource
{
{
Resource
:
"replicationcontroller"
},
{
Resource
:
"deployment"
},
{
Resource
:
"daemonset"
},
{
Resource
:
"job"
},
{
Resource
:
"replicaset"
},
}
}
func
(
f
*
ring0Factory
)
DefaultNamespace
()
(
string
,
bool
,
error
)
{
func
(
f
*
ring0Factory
)
DefaultNamespace
()
(
string
,
bool
,
error
)
{
return
f
.
clientGetter
.
ToRawKubeConfigLoader
()
.
Namespace
()
return
f
.
clientGetter
.
ToRawKubeConfigLoader
()
.
Namespace
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment