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
940c7fbb
Commit
940c7fbb
authored
Dec 01, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17823 from wojtek-t/use_versioned_params
Auto commit by PR queue bot
parents
329567ec
cdded4f0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
45 additions
and
48 deletions
+45
-48
conversion.go
pkg/api/conversion.go
+28
-2
register.go
pkg/apis/extensions/register.go
+4
-0
register.go
pkg/apis/extensions/v1beta1/register.go
+4
-0
listwatch.go
pkg/client/cache/listwatch.go
+2
-3
listwatch_test.go
pkg/client/cache/listwatch_test.go
+1
-1
daemon_sets.go
pkg/client/unversioned/daemon_sets.go
+2
-2
deployment.go
pkg/client/unversioned/deployment.go
+1
-2
helper.go
pkg/client/unversioned/helper.go
+0
-9
horizontalpodautoscaler.go
pkg/client/unversioned/horizontalpodautoscaler.go
+1
-2
ingress.go
pkg/client/unversioned/ingress.go
+1
-2
jobs.go
pkg/client/unversioned/jobs.go
+1
-2
request.go
pkg/client/unversioned/request.go
+0
-13
request_test.go
pkg/client/unversioned/request_test.go
+0
-10
No files found.
pkg/api/conversion.go
View file @
940c7fbb
...
@@ -32,8 +32,12 @@ var Codec = runtime.CodecFor(Scheme, "")
...
@@ -32,8 +32,12 @@ var Codec = runtime.CodecFor(Scheme, "")
func
init
()
{
func
init
()
{
Scheme
.
AddDefaultingFuncs
(
Scheme
.
AddDefaultingFuncs
(
func
(
obj
*
unversioned
.
ListOptions
)
{
func
(
obj
*
unversioned
.
ListOptions
)
{
obj
.
LabelSelector
=
unversioned
.
LabelSelector
{
labels
.
Everything
()}
if
obj
.
LabelSelector
.
Selector
==
nil
{
obj
.
FieldSelector
=
unversioned
.
FieldSelector
{
fields
.
Everything
()}
obj
.
LabelSelector
=
unversioned
.
LabelSelector
{
labels
.
Everything
()}
}
if
obj
.
FieldSelector
.
Selector
==
nil
{
obj
.
FieldSelector
=
unversioned
.
FieldSelector
{
fields
.
Everything
()}
}
},
},
// TODO: see about moving this into v1/defaults.go
// TODO: see about moving this into v1/defaults.go
func
(
obj
*
PodExecOptions
)
{
func
(
obj
*
PodExecOptions
)
{
...
@@ -135,6 +139,28 @@ func init() {
...
@@ -135,6 +139,28 @@ func init() {
*
out
=
in
.
Selector
.
String
()
*
out
=
in
.
Selector
.
String
()
return
nil
return
nil
},
},
func
(
in
*
unversioned
.
LabelSelector
,
out
*
unversioned
.
LabelSelector
,
s
conversion
.
Scope
)
error
{
if
in
.
Selector
==
nil
{
return
nil
}
selector
,
err
:=
labels
.
Parse
(
in
.
Selector
.
String
())
if
err
!=
nil
{
return
err
}
out
.
Selector
=
selector
return
nil
},
func
(
in
*
unversioned
.
FieldSelector
,
out
*
unversioned
.
FieldSelector
,
s
conversion
.
Scope
)
error
{
if
in
.
Selector
==
nil
{
return
nil
}
selector
,
err
:=
fields
.
ParseSelector
(
in
.
Selector
.
String
())
if
err
!=
nil
{
return
err
}
out
.
Selector
=
selector
return
nil
},
func
(
in
*
resource
.
Quantity
,
out
*
resource
.
Quantity
,
s
conversion
.
Scope
)
error
{
func
(
in
*
resource
.
Quantity
,
out
*
resource
.
Quantity
,
s
conversion
.
Scope
)
error
{
// Cannot deep copy these, because inf.Dec has unexported fields.
// Cannot deep copy these, because inf.Dec has unexported fields.
*
out
=
*
in
.
Copy
()
*
out
=
*
in
.
Copy
()
...
...
pkg/apis/extensions/register.go
View file @
940c7fbb
...
@@ -57,6 +57,10 @@ func addKnownTypes() {
...
@@ -57,6 +57,10 @@ func addKnownTypes() {
&
Ingress
{},
&
Ingress
{},
&
IngressList
{},
&
IngressList
{},
)
)
// Register Unversioned types
// TODO this should not be done here
api
.
Scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
unversioned
.
ListOptions
{})
}
}
func
(
*
ClusterAutoscaler
)
IsAnAPIObject
()
{}
func
(
*
ClusterAutoscaler
)
IsAnAPIObject
()
{}
...
...
pkg/apis/extensions/v1beta1/register.go
View file @
940c7fbb
...
@@ -55,6 +55,10 @@ func addKnownTypes() {
...
@@ -55,6 +55,10 @@ func addKnownTypes() {
&
Ingress
{},
&
Ingress
{},
&
IngressList
{},
&
IngressList
{},
)
)
// Register Unversioned types
// TODO this should not be done here
api
.
Scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
unversioned
.
ListOptions
{})
}
}
func
(
*
ClusterAutoscaler
)
IsAnAPIObject
()
{}
func
(
*
ClusterAutoscaler
)
IsAnAPIObject
()
{}
...
...
pkg/client/cache/listwatch.go
View file @
940c7fbb
...
@@ -19,6 +19,7 @@ package cache
...
@@ -19,6 +19,7 @@ package cache
import
(
import
(
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
...
@@ -60,9 +61,7 @@ func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSe
...
@@ -60,9 +61,7 @@ func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSe
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
namespace
)
.
Namespace
(
namespace
)
.
Resource
(
resource
)
.
Resource
(
resource
)
.
// TODO: Use VersionedParams once this is supported for non v1 API.
VersionedParams
(
&
options
,
api
.
Scheme
)
.
Param
(
"resourceVersion"
,
options
.
ResourceVersion
)
.
TimeoutSeconds
(
timeoutFromListOptions
(
options
))
.
FieldsSelectorParam
(
fieldSelector
)
.
FieldsSelectorParam
(
fieldSelector
)
.
Watch
()
Watch
()
}
}
...
...
pkg/client/cache/listwatch_test.go
View file @
940c7fbb
...
@@ -117,7 +117,7 @@ func TestListWatchesCanWatch(t *testing.T) {
...
@@ -117,7 +117,7 @@ func TestListWatchesCanWatch(t *testing.T) {
{
{
location
:
buildLocation
(
location
:
buildLocation
(
testapi
.
Default
.
ResourcePathWithPrefix
(
"watch"
,
"nodes"
,
api
.
NamespaceAll
,
""
),
testapi
.
Default
.
ResourcePathWithPrefix
(
"watch"
,
"nodes"
,
api
.
NamespaceAll
,
""
),
buildQueryValues
(
url
.
Values
{
"resourceVersion"
:
[]
string
{
""
}
})),
buildQueryValues
(
url
.
Values
{})),
rv
:
""
,
rv
:
""
,
resource
:
"nodes"
,
resource
:
"nodes"
,
namespace
:
api
.
NamespaceAll
,
namespace
:
api
.
NamespaceAll
,
...
...
pkg/client/unversioned/daemon_sets.go
View file @
940c7fbb
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
unversioned
package
unversioned
import
(
import
(
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
...
@@ -97,8 +98,7 @@ func (c *daemonSets) Watch(label labels.Selector, field fields.Selector, opts un
...
@@ -97,8 +98,7 @@ func (c *daemonSets) Watch(label labels.Selector, field fields.Selector, opts un
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"daemonsets"
)
.
Resource
(
"daemonsets"
)
.
Param
(
"resourceVersion"
,
opts
.
ResourceVersion
)
.
VersionedParams
(
&
opts
,
api
.
Scheme
)
.
TimeoutSeconds
(
TimeoutFromListOptions
(
opts
))
.
LabelsSelectorParam
(
label
)
.
LabelsSelectorParam
(
label
)
.
FieldsSelectorParam
(
field
)
.
FieldsSelectorParam
(
field
)
.
Watch
()
Watch
()
...
...
pkg/client/unversioned/deployment.go
View file @
940c7fbb
...
@@ -107,8 +107,7 @@ func (c *deployments) Watch(label labels.Selector, field fields.Selector, opts u
...
@@ -107,8 +107,7 @@ func (c *deployments) Watch(label labels.Selector, field fields.Selector, opts u
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"deployments"
)
.
Resource
(
"deployments"
)
.
Param
(
"resourceVersion"
,
opts
.
ResourceVersion
)
.
VersionedParams
(
&
opts
,
api
.
Scheme
)
.
TimeoutSeconds
(
TimeoutFromListOptions
(
opts
))
.
LabelsSelectorParam
(
label
)
.
LabelsSelectorParam
(
label
)
.
FieldsSelectorParam
(
field
)
.
FieldsSelectorParam
(
field
)
.
Watch
()
Watch
()
...
...
pkg/client/unversioned/helper.go
View file @
940c7fbb
...
@@ -568,12 +568,3 @@ func DefaultKubernetesUserAgent() string {
...
@@ -568,12 +568,3 @@ func DefaultKubernetesUserAgent() string {
version
=
seg
[
0
]
version
=
seg
[
0
]
return
fmt
.
Sprintf
(
"%s/%s (%s/%s) kubernetes/%s"
,
path
.
Base
(
os
.
Args
[
0
]),
version
,
gruntime
.
GOOS
,
gruntime
.
GOARCH
,
commit
)
return
fmt
.
Sprintf
(
"%s/%s (%s/%s) kubernetes/%s"
,
path
.
Base
(
os
.
Args
[
0
]),
version
,
gruntime
.
GOOS
,
gruntime
.
GOARCH
,
commit
)
}
}
// TimeoutFromListOptions returns timeout to be set via TimeoutSeconds() method
// based on given options.
func
TimeoutFromListOptions
(
options
unversioned
.
ListOptions
)
time
.
Duration
{
if
options
.
TimeoutSeconds
!=
nil
{
return
time
.
Duration
(
*
options
.
TimeoutSeconds
)
*
time
.
Second
}
return
0
}
pkg/client/unversioned/horizontalpodautoscaler.go
View file @
940c7fbb
...
@@ -109,8 +109,7 @@ func (c *horizontalPodAutoscalers) Watch(label labels.Selector, field fields.Sel
...
@@ -109,8 +109,7 @@ func (c *horizontalPodAutoscalers) Watch(label labels.Selector, field fields.Sel
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"horizontalPodAutoscalers"
)
.
Resource
(
"horizontalPodAutoscalers"
)
.
Param
(
"resourceVersion"
,
opts
.
ResourceVersion
)
.
VersionedParams
(
&
opts
,
api
.
Scheme
)
.
TimeoutSeconds
(
TimeoutFromListOptions
(
opts
))
.
LabelsSelectorParam
(
label
)
.
LabelsSelectorParam
(
label
)
.
FieldsSelectorParam
(
field
)
.
FieldsSelectorParam
(
field
)
.
Watch
()
Watch
()
...
...
pkg/client/unversioned/ingress.go
View file @
940c7fbb
...
@@ -99,8 +99,7 @@ func (c *ingress) Watch(label labels.Selector, field fields.Selector, opts unver
...
@@ -99,8 +99,7 @@ func (c *ingress) Watch(label labels.Selector, field fields.Selector, opts unver
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"ingresses"
)
.
Resource
(
"ingresses"
)
.
Param
(
"resourceVersion"
,
opts
.
ResourceVersion
)
.
VersionedParams
(
&
opts
,
api
.
Scheme
)
.
TimeoutSeconds
(
TimeoutFromListOptions
(
opts
))
.
LabelsSelectorParam
(
label
)
.
LabelsSelectorParam
(
label
)
.
FieldsSelectorParam
(
field
)
.
FieldsSelectorParam
(
field
)
.
Watch
()
Watch
()
...
...
pkg/client/unversioned/jobs.go
View file @
940c7fbb
...
@@ -103,8 +103,7 @@ func (c *jobs) Watch(label labels.Selector, field fields.Selector, opts unversio
...
@@ -103,8 +103,7 @@ func (c *jobs) Watch(label labels.Selector, field fields.Selector, opts unversio
Prefix
(
"watch"
)
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"jobs"
)
.
Resource
(
"jobs"
)
.
Param
(
"resourceVersion"
,
opts
.
ResourceVersion
)
.
VersionedParams
(
&
opts
,
api
.
Scheme
)
.
TimeoutSeconds
(
TimeoutFromListOptions
(
opts
))
.
LabelsSelectorParam
(
label
)
.
LabelsSelectorParam
(
label
)
.
FieldsSelectorParam
(
field
)
.
FieldsSelectorParam
(
field
)
.
Watch
()
Watch
()
...
...
pkg/client/unversioned/request.go
View file @
940c7fbb
...
@@ -498,19 +498,6 @@ func (r *Request) Timeout(d time.Duration) *Request {
...
@@ -498,19 +498,6 @@ func (r *Request) Timeout(d time.Duration) *Request {
return
r
return
r
}
}
// Timeout makes the request use the given duration as a timeout. Sets the "timeoutSeconds"
// parameter.
func
(
r
*
Request
)
TimeoutSeconds
(
d
time
.
Duration
)
*
Request
{
if
r
.
err
!=
nil
{
return
r
}
if
d
!=
0
{
timeout
:=
int64
(
d
.
Seconds
())
r
.
Param
(
"timeoutSeconds"
,
strconv
.
FormatInt
(
timeout
,
10
))
}
return
r
}
// Body makes the request use obj as the body. Optional.
// Body makes the request use obj as the body. Optional.
// If obj is a string, try to read a file of that name.
// If obj is a string, try to read a file of that name.
// If obj is a []byte, send it directly.
// If obj is a []byte, send it directly.
...
...
pkg/client/unversioned/request_test.go
View file @
940c7fbb
...
@@ -176,16 +176,6 @@ func TestRequestParam(t *testing.T) {
...
@@ -176,16 +176,6 @@ func TestRequestParam(t *testing.T) {
}
}
}
}
func
TestTimeoutSeconds
(
t
*
testing
.
T
)
{
r
:=
&
Request
{}
r
.
TimeoutSeconds
(
time
.
Duration
(
5
*
time
.
Second
))
if
!
reflect
.
DeepEqual
(
r
.
params
,
url
.
Values
{
"timeoutSeconds"
:
[]
string
{
"5"
},
})
{
t
.
Errorf
(
"invalid timeoutSeconds parameter: %#v"
,
r
)
}
}
func
TestRequestVersionedParams
(
t
*
testing
.
T
)
{
func
TestRequestVersionedParams
(
t
*
testing
.
T
)
{
r
:=
(
&
Request
{
apiVersion
:
"v1"
})
.
Param
(
"foo"
,
"a"
)
r
:=
(
&
Request
{
apiVersion
:
"v1"
})
.
Param
(
"foo"
,
"a"
)
if
!
reflect
.
DeepEqual
(
r
.
params
,
url
.
Values
{
"foo"
:
[]
string
{
"a"
}})
{
if
!
reflect
.
DeepEqual
(
r
.
params
,
url
.
Values
{
"foo"
:
[]
string
{
"a"
}})
{
...
...
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