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
fc4da684
Commit
fc4da684
authored
Jul 07, 2015
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing references to pre v1beta3 apis
parent
8278928b
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
60 additions
and
112 deletions
+60
-112
test-cmd.sh
hack/test-cmd.sh
+0
-15
restmapper.go
pkg/api/meta/restmapper.go
+1
-2
fuzzer.go
pkg/api/testing/fuzzer.go
+2
-1
unversioned.go
pkg/api/unversioned.go
+0
-11
client_test.go
pkg/client/client_test.go
+2
-9
endpoints_test.go
pkg/client/endpoints_test.go
+2
-2
events.go
pkg/client/events.go
+0
-3
limit_ranges_test.go
pkg/client/limit_ranges_test.go
+6
-6
nodes.go
pkg/client/nodes.go
+1
-5
nodes_test.go
pkg/client/nodes_test.go
+1
-2
persistentvolume_test.go
pkg/client/persistentvolume_test.go
+6
-6
persistentvolumeclaim_test.go
pkg/client/persistentvolumeclaim_test.go
+6
-6
pod_templates_test.go
pkg/client/pod_templates_test.go
+5
-5
pods_test.go
pkg/client/pods_test.go
+7
-7
replication_controllers_test.go
pkg/client/replication_controllers_test.go
+4
-4
resource_quotas_test.go
pkg/client/resource_quotas_test.go
+6
-6
services_test.go
pkg/client/services_test.go
+6
-6
testclient.go
pkg/client/testclient/testclient.go
+2
-1
common.go
pkg/kubelet/config/common.go
+3
-7
master.go
pkg/master/master.go
+0
-8
No files found.
hack/test-cmd.sh
View file @
fc4da684
...
...
@@ -467,7 +467,6 @@ runTests() {
### Printing pod templates works
kubectl get podtemplates
"
${
kube_flags
[@]
}
"
### Display of an object which doesn't existing in v1beta1 and v1beta2 works
[[
"
$(
kubectl get podtemplates
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
nginx
)
"
]]
### Delete nginx pod template by name
...
...
@@ -733,20 +732,6 @@ __EOF__
# Post-condition: node is schedulable
kube::test::get_object_assert
"nodes 127.0.0.1"
"{{.spec.unschedulable}}"
'<no value>'
###########
# Nodes #
###########
if
[[
"
${
version
}
"
=
"v1beta1"
]]
||
[[
"
${
version
}
"
=
"v1beta2"
]]
;
then
kube::log::status
"Testing kubectl(
${
version
}
:nodes)"
kube::test::get_object_assert nodes
"{{range.items}}{{
$id_field
}}:{{end}}"
'127.0.0.1:'
kube::test::get_object_assert nodes
'{{.kind}}'
'List'
kube::test::describe_object_assert nodes
"127.0.0.1"
"Name:"
"Conditions:"
"Addresses:"
"Capacity:"
"Pods:"
fi
#####################
# Retrieve multiple #
...
...
pkg/api/meta/restmapper.go
View file @
fc4da684
...
...
@@ -66,8 +66,7 @@ type typeMeta struct {
// can be mapped with the provided MetadataAccessor and Codec interfaces.
//
// The resource name of a Kind is defined as the lowercase,
// English-plural version of the Kind string in v1beta3 and onwards,
// and as the camelCase version of the name in v1beta1 and v1beta2.
// English-plural version of the Kind string.
// When converting from resource to Kind, the singular version of the
// resource name is also accepted for convenience.
//
...
...
pkg/api/testing/fuzzer.go
View file @
fc4da684
...
...
@@ -23,6 +23,7 @@ import (
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
...
...
@@ -202,7 +203,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
ev
.
ValueFrom
=
&
api
.
EnvVarSource
{}
ev
.
ValueFrom
.
FieldRef
=
&
api
.
ObjectFieldSelector
{}
versions
:=
[]
string
{
"v1beta1"
,
"v1beta2"
,
"v1beta3"
}
versions
:=
registered
.
RegisteredVersions
ev
.
ValueFrom
.
FieldRef
.
APIVersion
=
versions
[
c
.
Rand
.
Intn
(
len
(
versions
))]
ev
.
ValueFrom
.
FieldRef
.
FieldPath
=
c
.
RandString
()
...
...
pkg/api/unversioned.go
View file @
fc4da684
...
...
@@ -35,24 +35,13 @@ type RootPaths struct {
Paths
[]
string
`json:"paths"`
}
// preV1Beta3 returns true if the provided API version is an API introduced before v1beta3.
func
PreV1Beta3
(
version
string
)
bool
{
return
version
==
"v1beta1"
||
version
==
"v1beta2"
}
// TODO: remove me when watch is refactored
func
LabelSelectorQueryParam
(
version
string
)
string
{
if
PreV1Beta3
(
version
)
{
return
"labels"
}
return
"labelSelector"
}
// TODO: remove me when watch is refactored
func
FieldSelectorQueryParam
(
version
string
)
string
{
if
PreV1Beta3
(
version
)
{
return
"fields"
}
return
"fieldSelector"
}
...
...
pkg/client/client_test.go
View file @
fc4da684
...
...
@@ -164,15 +164,13 @@ func (c *testClient) ValidateCommon(t *testing.T, err error) {
// buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not
func
buildResourcePath
(
namespace
,
resource
string
)
string
{
if
len
(
namespace
)
>
0
{
if
!
(
testapi
.
Version
()
==
"v1beta1"
||
testapi
.
Version
()
==
"v1beta2"
)
{
return
path
.
Join
(
"namespaces"
,
namespace
,
resource
)
}
return
path
.
Join
(
"namespaces"
,
namespace
,
resource
)
}
return
resource
}
// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not
func
buildQueryValues
(
namespace
string
,
query
url
.
Values
)
url
.
Values
{
func
buildQueryValues
(
query
url
.
Values
)
url
.
Values
{
v
:=
url
.
Values
{}
if
query
!=
nil
{
for
key
,
values
:=
range
query
{
...
...
@@ -181,11 +179,6 @@ func buildQueryValues(namespace string, query url.Values) url.Values {
}
}
}
if
len
(
namespace
)
>
0
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
v
.
Set
(
"namespace"
,
namespace
)
}
}
return
v
}
...
...
pkg/client/endpoints_test.go
View file @
fc4da684
...
...
@@ -27,7 +27,7 @@ import (
func
TestListEndpoints
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"endpoints"
,
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"endpoints"
,
ns
,
""
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
EndpointsList
{
Items
:
[]
api
.
Endpoints
{
...
...
@@ -49,7 +49,7 @@ func TestListEndpoints(t *testing.T) {
func
TestGetEndpoints
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"endpoints"
,
ns
,
"endpoint-1"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"endpoints"
,
ns
,
"endpoint-1"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
Endpoints
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"endpoint-1"
}}},
}
response
,
err
:=
c
.
Setup
()
.
Endpoints
(
ns
)
.
Get
(
"endpoint-1"
)
...
...
pkg/client/events.go
View file @
fc4da684
...
...
@@ -192,8 +192,5 @@ func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, i
// Returns the appropriate field label to use for name of the involved object as per the given API version.
func
getInvolvedObjectNameFieldLabel
(
version
string
)
string
{
if
api
.
PreV1Beta3
(
version
)
{
return
"involvedObject.id"
}
return
"involvedObject.name"
}
pkg/client/limit_ranges_test.go
View file @
fc4da684
...
...
@@ -57,7 +57,7 @@ func TestLimitRangeCreate(t *testing.T) {
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
limitRange
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
limitRange
},
...
...
@@ -93,7 +93,7 @@ func TestLimitRangeGet(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
limitRange
},
...
...
@@ -117,7 +117,7 @@ func TestLimitRangeList(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
limitRangeList
},
...
...
@@ -150,7 +150,7 @@ func TestLimitRangeUpdate(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
limitRange
},
}
response
,
err
:=
c
.
Setup
()
.
LimitRanges
(
ns
)
.
Update
(
limitRange
)
...
...
@@ -180,7 +180,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
limitRange
},
}
_
,
err
:=
c
.
Setup
()
.
LimitRanges
(
ns
)
.
Update
(
limitRange
)
...
...
@@ -192,7 +192,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) {
func
TestLimitRangeDelete
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getLimitRangesResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
LimitRanges
(
ns
)
.
Delete
(
"foo"
)
...
...
pkg/client/nodes.go
View file @
fc4da684
...
...
@@ -49,12 +49,8 @@ func newNodes(c *Client) *nodes {
return
&
nodes
{
c
}
}
// resourceName returns node's URL resource name based on resource version.
// Uses "minions" as the URL resource name for v1beta1 and v1beta2.
// resourceName returns node's URL resource name.
func
(
c
*
nodes
)
resourceName
()
string
{
if
api
.
PreV1Beta3
(
c
.
r
.
APIVersion
())
{
return
"minions"
}
return
"nodes"
}
...
...
pkg/client/nodes_test.go
View file @
fc4da684
...
...
@@ -44,13 +44,12 @@ func TestListMinions(t *testing.T) {
}
func
TestListMinionsLabels
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceNone
labelSelectorQueryParamName
:=
api
.
LabelSelectorQueryParam
(
testapi
.
Version
())
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getNodesResourceName
(),
""
,
""
),
Query
:
buildQueryValues
(
ns
,
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Query
:
buildQueryValues
(
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
NodeList
{
...
...
pkg/client/persistentvolume_test.go
View file @
fc4da684
...
...
@@ -50,7 +50,7 @@ func TestPersistentVolumeCreate(t *testing.T) {
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
""
),
Query
:
buildQueryValues
(
""
,
nil
),
Query
:
buildQueryValues
(
nil
),
Body
:
pv
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
pv
},
...
...
@@ -79,7 +79,7 @@ func TestPersistentVolumeGet(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"abc"
),
Query
:
buildQueryValues
(
""
,
nil
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolume
},
...
...
@@ -101,7 +101,7 @@ func TestPersistentVolumeList(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
""
),
Query
:
buildQueryValues
(
""
,
nil
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolumeList
},
...
...
@@ -126,7 +126,7 @@ func TestPersistentVolumeUpdate(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"abc"
),
Query
:
buildQueryValues
(
""
,
nil
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolume
},
}
response
,
err
:=
c
.
Setup
()
.
PersistentVolumes
()
.
Update
(
persistentVolume
)
...
...
@@ -156,7 +156,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) {
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"abc"
)
+
"/status"
,
Query
:
buildQueryValues
(
""
,
nil
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolume
},
}
response
,
err
:=
c
.
Setup
()
.
PersistentVolumes
()
.
UpdateStatus
(
persistentVolume
)
...
...
@@ -165,7 +165,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) {
func
TestPersistentVolumeDelete
(
t
*
testing
.
T
)
{
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"foo"
),
Query
:
buildQueryValues
(
""
,
nil
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumesResoureName
(),
""
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
PersistentVolumes
()
.
Delete
(
"foo"
)
...
...
pkg/client/persistentvolumeclaim_test.go
View file @
fc4da684
...
...
@@ -54,7 +54,7 @@ func TestPersistentVolumeClaimCreate(t *testing.T) {
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
pv
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
pv
},
...
...
@@ -87,7 +87,7 @@ func TestPersistentVolumeClaimGet(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolumeClaim
},
...
...
@@ -110,7 +110,7 @@ func TestPersistentVolumeClaimList(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolumeList
},
...
...
@@ -139,7 +139,7 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolumeClaim
},
}
response
,
err
:=
c
.
Setup
()
.
PersistentVolumeClaims
(
ns
)
.
Update
(
persistentVolumeClaim
)
...
...
@@ -172,7 +172,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) {
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"abc"
)
+
"/status"
,
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
persistentVolumeClaim
},
}
response
,
err
:=
c
.
Setup
()
.
PersistentVolumeClaims
(
ns
)
.
UpdateStatus
(
persistentVolumeClaim
)
...
...
@@ -182,7 +182,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) {
func
TestPersistentVolumeClaimDelete
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPersistentVolumeClaimsResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
PersistentVolumeClaims
(
ns
)
.
Delete
(
"foo"
)
...
...
pkg/client/pod_templates_test.go
View file @
fc4da684
...
...
@@ -43,7 +43,7 @@ func TestPodTemplateCreate(t *testing.T) {
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
&
podTemplate
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
podTemplate
},
...
...
@@ -66,7 +66,7 @@ func TestPodTemplateGet(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
podTemplate
},
...
...
@@ -92,7 +92,7 @@ func TestPodTemplateList(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
podTemplateList
},
...
...
@@ -112,7 +112,7 @@ func TestPodTemplateUpdate(t *testing.T) {
Template
:
api
.
PodTemplateSpec
{},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
podTemplate
},
}
response
,
err
:=
c
.
Setup
()
.
PodTemplates
(
ns
)
.
Update
(
podTemplate
)
...
...
@@ -122,7 +122,7 @@ func TestPodTemplateUpdate(t *testing.T) {
func
TestPodTemplateDelete
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
PodTemplates
(
ns
)
.
Delete
(
"foo"
,
nil
)
...
...
pkg/client/pods_test.go
View file @
fc4da684
...
...
@@ -29,7 +29,7 @@ import (
func
TestListEmptyPods
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
PodList
{}},
}
podList
,
err
:=
c
.
Setup
()
.
Pods
(
ns
)
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
...
...
@@ -39,7 +39,7 @@ func TestListEmptyPods(t *testing.T) {
func
TestListPods
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
PodList
{
Items
:
[]
api
.
Pod
{
...
...
@@ -69,7 +69,7 @@ func TestListPodsLabels(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
ns
,
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Query
:
buildQueryValues
(
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
PodList
{
...
...
@@ -99,7 +99,7 @@ func TestListPodsLabels(t *testing.T) {
func
TestGetPod
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
Pod
{
...
...
@@ -133,7 +133,7 @@ func TestGetPodWithNoName(t *testing.T) {
func
TestDeletePod
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
Pods
(
ns
)
.
Delete
(
"foo"
,
nil
)
...
...
@@ -154,7 +154,7 @@ func TestCreatePod(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Body
:
requestPod
},
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
""
),
Query
:
buildQueryValues
(
nil
),
Body
:
requestPod
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
requestPod
,
...
...
@@ -180,7 +180,7 @@ func TestUpdatePod(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
"pods"
,
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
requestPod
},
}
receivedPod
,
err
:=
c
.
Setup
()
.
Pods
(
ns
)
.
Update
(
requestPod
)
...
...
pkg/client/replication_controllers_test.go
View file @
fc4da684
...
...
@@ -63,7 +63,7 @@ func TestListControllers(t *testing.T) {
func
TestGetController
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
ReplicationController
{
...
...
@@ -102,7 +102,7 @@ func TestUpdateController(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
ResourceVersion
:
"1"
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
ReplicationController
{
...
...
@@ -127,7 +127,7 @@ func TestUpdateController(t *testing.T) {
func
TestDeleteController
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
ReplicationControllers
(
ns
)
.
Delete
(
"foo"
)
...
...
@@ -140,7 +140,7 @@ func TestCreateController(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
""
),
Body
:
requestController
,
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getRCResourceName
(),
ns
,
""
),
Body
:
requestController
,
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
ReplicationController
{
...
...
pkg/client/resource_quotas_test.go
View file @
fc4da684
...
...
@@ -53,7 +53,7 @@ func TestResourceQuotaCreate(t *testing.T) {
Request
:
testRequest
{
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
resourceQuota
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
resourceQuota
},
...
...
@@ -85,7 +85,7 @@ func TestResourceQuotaGet(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
resourceQuota
},
...
...
@@ -109,7 +109,7 @@ func TestResourceQuotaList(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
),
Query
:
buildQueryValues
(
nil
),
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
resourceQuotaList
},
...
...
@@ -138,7 +138,7 @@ func TestResourceQuotaUpdate(t *testing.T) {
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"abc"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
resourceQuota
},
}
response
,
err
:=
c
.
Setup
()
.
ResourceQuotas
(
ns
)
.
Update
(
resourceQuota
)
...
...
@@ -168,7 +168,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"abc"
)
+
"/status"
,
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
resourceQuota
},
}
response
,
err
:=
c
.
Setup
()
.
ResourceQuotas
(
ns
)
.
UpdateStatus
(
resourceQuota
)
...
...
@@ -178,7 +178,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
func
TestResourceQuotaDelete
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getResourceQuotasResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
ResourceQuotas
(
ns
)
.
Delete
(
"foo"
)
...
...
pkg/client/services_test.go
View file @
fc4da684
...
...
@@ -31,7 +31,7 @@ func TestListServices(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
""
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
ServiceList
{
Items
:
[]
api
.
Service
{
...
...
@@ -65,7 +65,7 @@ func TestListServicesLabels(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
""
),
Query
:
buildQueryValues
(
ns
,
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Query
:
buildQueryValues
(
url
.
Values
{
labelSelectorQueryParamName
:
[]
string
{
"foo=bar,name=baz"
}})},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
ServiceList
{
Items
:
[]
api
.
Service
{
...
...
@@ -100,7 +100,7 @@ func TestGetService(t *testing.T) {
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
"1"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"service-1"
}}},
}
response
,
err
:=
c
.
Setup
()
.
Services
(
ns
)
.
Get
(
"1"
)
...
...
@@ -125,7 +125,7 @@ func TestCreateService(t *testing.T) {
Method
:
"POST"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
""
),
Body
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"service-1"
}},
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"service-1"
}}},
}
response
,
err
:=
c
.
Setup
()
.
Services
(
ns
)
.
Create
(
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"service-1"
}})
...
...
@@ -136,7 +136,7 @@ func TestUpdateService(t *testing.T) {
ns
:=
api
.
NamespaceDefault
svc
:=
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"service-1"
,
ResourceVersion
:
"1"
}}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
"service-1"
),
Body
:
svc
,
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"PUT"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
"service-1"
),
Body
:
svc
,
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
,
Body
:
svc
},
}
response
,
err
:=
c
.
Setup
()
.
Services
(
ns
)
.
Update
(
svc
)
...
...
@@ -146,7 +146,7 @@ func TestUpdateService(t *testing.T) {
func
TestDeleteService
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
"1"
),
Query
:
buildQueryValues
(
n
s
,
n
il
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
"services"
,
ns
,
"1"
),
Query
:
buildQueryValues
(
nil
)},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
Services
(
ns
)
.
Delete
(
"1"
)
...
...
pkg/client/testclient/testclient.go
View file @
fc4da684
...
...
@@ -19,6 +19,7 @@ package testclient
import
(
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
...
...
@@ -131,7 +132,7 @@ func (c *Fake) ServerVersion() (*version.Info, error) {
func
(
c
*
Fake
)
ServerAPIVersions
()
(
*
api
.
APIVersions
,
error
)
{
c
.
Actions
=
append
(
c
.
Actions
,
FakeAction
{
Action
:
"get-apiversions"
,
Value
:
nil
})
return
&
api
.
APIVersions
{
Versions
:
[]
string
{
"v1beta1"
,
"v1beta2"
}
},
nil
return
&
api
.
APIVersions
{
Versions
:
registered
.
RegisteredVersions
},
nil
}
func
(
c
*
Fake
)
ComponentStatuses
()
client
.
ComponentStatusInterface
{
...
...
pkg/kubelet/config/common.go
View file @
fc4da684
...
...
@@ -69,14 +69,10 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName string) er
func
getSelfLink
(
name
,
namespace
string
)
string
{
var
selfLink
string
if
api
.
PreV1Beta3
(
latest
.
Version
)
{
selfLink
=
fmt
.
Sprintf
(
"/api/"
+
latest
.
Version
+
"/pods/%s?namespace=%s"
,
name
,
namespace
)
}
else
{
if
len
(
namespace
)
==
0
{
namespace
=
api
.
NamespaceDefault
}
selfLink
=
fmt
.
Sprintf
(
"/api/"
+
latest
.
Version
+
"/pods/namespaces/%s/%s"
,
name
,
namespace
)
if
len
(
namespace
)
==
0
{
namespace
=
api
.
NamespaceDefault
}
selfLink
=
fmt
.
Sprintf
(
"/api/"
+
latest
.
Version
+
"/pods/namespaces/%s/%s"
,
name
,
namespace
)
return
selfLink
}
...
...
pkg/master/master.go
View file @
fc4da684
...
...
@@ -480,8 +480,6 @@ func (m *Master) init(c *Config) {
"replicationControllers"
:
controllerStorage
,
"services"
:
service
.
NewStorage
(
m
.
serviceRegistry
,
m
.
nodeRegistry
,
m
.
endpointRegistry
,
serviceClusterIPAllocator
,
serviceNodePortAllocator
,
c
.
ClusterName
),
"endpoints"
:
endpointsStorage
,
"minions"
:
nodeStorage
,
"minions/status"
:
nodeStatusStorage
,
"nodes"
:
nodeStorage
,
"nodes/status"
:
nodeStatusStorage
,
"events"
:
event
.
NewStorage
(
eventRegistry
),
...
...
@@ -748,9 +746,6 @@ func (m *Master) defaultAPIGroupVersion() *apiserver.APIGroupVersion {
func
(
m
*
Master
)
api_v1beta3
()
*
apiserver
.
APIGroupVersion
{
storage
:=
make
(
map
[
string
]
rest
.
Storage
)
for
k
,
v
:=
range
m
.
storage
{
if
k
==
"minions"
||
k
==
"minions/status"
{
continue
}
storage
[
strings
.
ToLower
(
k
)]
=
v
}
version
:=
m
.
defaultAPIGroupVersion
()
...
...
@@ -764,9 +759,6 @@ func (m *Master) api_v1beta3() *apiserver.APIGroupVersion {
func
(
m
*
Master
)
api_v1
()
*
apiserver
.
APIGroupVersion
{
storage
:=
make
(
map
[
string
]
rest
.
Storage
)
for
k
,
v
:=
range
m
.
storage
{
if
k
==
"minions"
||
k
==
"minions/status"
{
continue
}
storage
[
strings
.
ToLower
(
k
)]
=
v
}
version
:=
m
.
defaultAPIGroupVersion
()
...
...
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