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
c9268e1f
Commit
c9268e1f
authored
Sep 09, 2015
by
kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose: Avoid selector resolution if a selector is not needed
parent
d3b1e468
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
expose.go
pkg/kubectl/cmd/expose.go
+11
-7
No files found.
pkg/kubectl/cmd/expose.go
View file @
c9268e1f
...
@@ -129,14 +129,18 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str
...
@@ -129,14 +129,18 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str
names
:=
generator
.
ParamNames
()
names
:=
generator
.
ParamNames
()
params
:=
kubectl
.
MakeParams
(
cmd
,
names
)
params
:=
kubectl
.
MakeParams
(
cmd
,
names
)
params
[
"default-name"
]
=
info
.
Name
params
[
"default-name"
]
=
info
.
Name
if
s
,
found
:=
params
[
"selector"
];
!
found
||
kubectl
.
IsZero
(
s
)
||
cmdutil
.
GetFlagInt
(
cmd
,
"port"
)
<
1
{
if
kubectl
.
IsZero
(
s
)
{
// For objects that need a pod selector, derive it from the exposed object in case a user
s
,
err
:=
f
.
PodSelectorForObject
(
inputObject
)
// didn't explicitly specify one via --selector
if
err
!=
nil
{
if
s
,
found
:=
params
[
"selector"
];
found
&&
kubectl
.
IsZero
(
s
)
{
return
cmdutil
.
UsageError
(
cmd
,
fmt
.
Sprintf
(
"couldn't find selectors via --selector flag or introspection: %s"
,
err
)
)
s
,
err
:=
f
.
PodSelectorForObject
(
inputObject
)
}
if
err
!=
nil
{
params
[
"selector"
]
=
s
return
cmdutil
.
UsageError
(
cmd
,
fmt
.
Sprintf
(
"couldn't find selectors via --selector flag or introspection: %s"
,
err
))
}
}
params
[
"selector"
]
=
s
}
if
cmdutil
.
GetFlagInt
(
cmd
,
"port"
)
<
1
{
noPorts
:=
true
noPorts
:=
true
for
_
,
param
:=
range
names
{
for
_
,
param
:=
range
names
{
if
param
.
Name
==
"port"
{
if
param
.
Name
==
"port"
{
...
...
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