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
3febdb7f
Commit
3febdb7f
authored
Oct 27, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove petset from 1.4 generated client to pass import-boss verification
parent
74dbfdca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
0 additions
and
739 deletions
+0
-739
apps_client.go
..._generated/release_1_4/typed/apps/v1alpha1/apps_client.go
+0
-5
fake_apps_client.go
.../release_1_4/typed/apps/v1alpha1/fake/fake_apps_client.go
+0
-5
fake_petset.go
...rated/release_1_4/typed/apps/v1alpha1/fake/fake_petset.go
+0
-127
petset.go
...ntset_generated/release_1_4/typed/apps/v1alpha1/petset.go
+0
-165
apps.go
pkg/client/unversioned/apps.go
+0
-55
pet_sets.go
pkg/client/unversioned/pet_sets.go
+0
-100
pet_sets_test.go
pkg/client/unversioned/pet_sets_test.go
+0
-165
BUILD
pkg/client/unversioned/testclient/BUILD
+0
-34
fake_petsets.go
pkg/client/unversioned/testclient/fake_petsets.go
+0
-83
testclient.go
pkg/client/unversioned/testclient/testclient.go
+0
-0
No files found.
pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1/apps_client.go
View file @
3febdb7f
...
...
@@ -25,7 +25,6 @@ import (
type
AppsInterface
interface
{
GetRESTClient
()
*
restclient
.
RESTClient
PetSetsGetter
}
// AppsClient is used to interact with features provided by the Apps group.
...
...
@@ -33,10 +32,6 @@ type AppsClient struct {
*
restclient
.
RESTClient
}
func
(
c
*
AppsClient
)
PetSets
(
namespace
string
)
PetSetInterface
{
return
newPetSets
(
c
,
namespace
)
}
// NewForConfig creates a new AppsClient for the given config.
func
NewForConfig
(
c
*
restclient
.
Config
)
(
*
AppsClient
,
error
)
{
config
:=
*
c
...
...
pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1/fake/fake_apps_client.go
View file @
3febdb7f
...
...
@@ -17,7 +17,6 @@ limitations under the License.
package
fake
import
(
v1alpha1
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1"
restclient
"k8s.io/kubernetes/pkg/client/restclient"
core
"k8s.io/kubernetes/pkg/client/testing/core"
)
...
...
@@ -26,10 +25,6 @@ type FakeApps struct {
*
core
.
Fake
}
func
(
c
*
FakeApps
)
PetSets
(
namespace
string
)
v1alpha1
.
PetSetInterface
{
return
&
FakePetSets
{
c
,
namespace
}
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func
(
c
*
FakeApps
)
GetRESTClient
()
*
restclient
.
RESTClient
{
...
...
pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1/fake/fake_petset.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
fake
import
(
api
"k8s.io/kubernetes/pkg/api"
unversioned
"k8s.io/kubernetes/pkg/api/unversioned"
v1alpha1
"k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
core
"k8s.io/kubernetes/pkg/client/testing/core"
labels
"k8s.io/kubernetes/pkg/labels"
watch
"k8s.io/kubernetes/pkg/watch"
)
// FakePetSets implements PetSetInterface
type
FakePetSets
struct
{
Fake
*
FakeApps
ns
string
}
var
petsetsResource
=
unversioned
.
GroupVersionResource
{
Group
:
"apps"
,
Version
:
"v1alpha1"
,
Resource
:
"petsets"
}
func
(
c
*
FakePetSets
)
Create
(
petSet
*
v1alpha1
.
PetSet
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewCreateAction
(
petsetsResource
,
c
.
ns
,
petSet
),
&
v1alpha1
.
PetSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
v1alpha1
.
PetSet
),
err
}
func
(
c
*
FakePetSets
)
Update
(
petSet
*
v1alpha1
.
PetSet
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewUpdateAction
(
petsetsResource
,
c
.
ns
,
petSet
),
&
v1alpha1
.
PetSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
v1alpha1
.
PetSet
),
err
}
func
(
c
*
FakePetSets
)
UpdateStatus
(
petSet
*
v1alpha1
.
PetSet
)
(
*
v1alpha1
.
PetSet
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewUpdateSubresourceAction
(
petsetsResource
,
"status"
,
c
.
ns
,
petSet
),
&
v1alpha1
.
PetSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
v1alpha1
.
PetSet
),
err
}
func
(
c
*
FakePetSets
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
{
_
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewDeleteAction
(
petsetsResource
,
c
.
ns
,
name
),
&
v1alpha1
.
PetSet
{})
return
err
}
func
(
c
*
FakePetSets
)
DeleteCollection
(
options
*
api
.
DeleteOptions
,
listOptions
api
.
ListOptions
)
error
{
action
:=
core
.
NewDeleteCollectionAction
(
petsetsResource
,
c
.
ns
,
listOptions
)
_
,
err
:=
c
.
Fake
.
Invokes
(
action
,
&
v1alpha1
.
PetSetList
{})
return
err
}
func
(
c
*
FakePetSets
)
Get
(
name
string
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewGetAction
(
petsetsResource
,
c
.
ns
,
name
),
&
v1alpha1
.
PetSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
v1alpha1
.
PetSet
),
err
}
func
(
c
*
FakePetSets
)
List
(
opts
api
.
ListOptions
)
(
result
*
v1alpha1
.
PetSetList
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewListAction
(
petsetsResource
,
c
.
ns
,
opts
),
&
v1alpha1
.
PetSetList
{})
if
obj
==
nil
{
return
nil
,
err
}
label
:=
opts
.
LabelSelector
if
label
==
nil
{
label
=
labels
.
Everything
()
}
list
:=
&
v1alpha1
.
PetSetList
{}
for
_
,
item
:=
range
obj
.
(
*
v1alpha1
.
PetSetList
)
.
Items
{
if
label
.
Matches
(
labels
.
Set
(
item
.
Labels
))
{
list
.
Items
=
append
(
list
.
Items
,
item
)
}
}
return
list
,
err
}
// Watch returns a watch.Interface that watches the requested petSets.
func
(
c
*
FakePetSets
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
c
.
Fake
.
InvokesWatch
(
core
.
NewWatchAction
(
petsetsResource
,
c
.
ns
,
opts
))
}
// Patch applies the patch and returns the patched petSet.
func
(
c
*
FakePetSets
)
Patch
(
name
string
,
pt
api
.
PatchType
,
data
[]
byte
,
subresources
...
string
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewPatchSubresourceAction
(
petsetsResource
,
c
.
ns
,
name
,
data
,
subresources
...
),
&
v1alpha1
.
PetSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
v1alpha1
.
PetSet
),
err
}
pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1/petset.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
import
(
api
"k8s.io/kubernetes/pkg/api"
v1alpha1
"k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
watch
"k8s.io/kubernetes/pkg/watch"
)
// PetSetsGetter has a method to return a PetSetInterface.
// A group's client should implement this interface.
type
PetSetsGetter
interface
{
PetSets
(
namespace
string
)
PetSetInterface
}
// PetSetInterface has methods to work with PetSet resources.
type
PetSetInterface
interface
{
Create
(
*
v1alpha1
.
PetSet
)
(
*
v1alpha1
.
PetSet
,
error
)
Update
(
*
v1alpha1
.
PetSet
)
(
*
v1alpha1
.
PetSet
,
error
)
UpdateStatus
(
*
v1alpha1
.
PetSet
)
(
*
v1alpha1
.
PetSet
,
error
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
DeleteCollection
(
options
*
api
.
DeleteOptions
,
listOptions
api
.
ListOptions
)
error
Get
(
name
string
)
(
*
v1alpha1
.
PetSet
,
error
)
List
(
opts
api
.
ListOptions
)
(
*
v1alpha1
.
PetSetList
,
error
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
Patch
(
name
string
,
pt
api
.
PatchType
,
data
[]
byte
,
subresources
...
string
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
PetSetExpansion
}
// petSets implements PetSetInterface
type
petSets
struct
{
client
*
AppsClient
ns
string
}
// newPetSets returns a PetSets
func
newPetSets
(
c
*
AppsClient
,
namespace
string
)
*
petSets
{
return
&
petSets
{
client
:
c
,
ns
:
namespace
,
}
}
// Create takes the representation of a petSet and creates it. Returns the server's representation of the petSet, and an error, if there is any.
func
(
c
*
petSets
)
Create
(
petSet
*
v1alpha1
.
PetSet
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
result
=
&
v1alpha1
.
PetSet
{}
err
=
c
.
client
.
Post
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
Body
(
petSet
)
.
Do
()
.
Into
(
result
)
return
}
// Update takes the representation of a petSet and updates it. Returns the server's representation of the petSet, and an error, if there is any.
func
(
c
*
petSets
)
Update
(
petSet
*
v1alpha1
.
PetSet
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
result
=
&
v1alpha1
.
PetSet
{}
err
=
c
.
client
.
Put
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
Name
(
petSet
.
Name
)
.
Body
(
petSet
)
.
Do
()
.
Into
(
result
)
return
}
func
(
c
*
petSets
)
UpdateStatus
(
petSet
*
v1alpha1
.
PetSet
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
result
=
&
v1alpha1
.
PetSet
{}
err
=
c
.
client
.
Put
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
Name
(
petSet
.
Name
)
.
SubResource
(
"status"
)
.
Body
(
petSet
)
.
Do
()
.
Into
(
result
)
return
}
// Delete takes name of the petSet and deletes it. Returns an error if one occurs.
func
(
c
*
petSets
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
{
return
c
.
client
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
Name
(
name
)
.
Body
(
options
)
.
Do
()
.
Error
()
}
// DeleteCollection deletes a collection of objects.
func
(
c
*
petSets
)
DeleteCollection
(
options
*
api
.
DeleteOptions
,
listOptions
api
.
ListOptions
)
error
{
return
c
.
client
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
VersionedParams
(
&
listOptions
,
api
.
ParameterCodec
)
.
Body
(
options
)
.
Do
()
.
Error
()
}
// Get takes name of the petSet, and returns the corresponding petSet object, and an error if there is any.
func
(
c
*
petSets
)
Get
(
name
string
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
result
=
&
v1alpha1
.
PetSet
{}
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
Name
(
name
)
.
Do
()
.
Into
(
result
)
return
}
// List takes label and field selectors, and returns the list of PetSets that match those selectors.
func
(
c
*
petSets
)
List
(
opts
api
.
ListOptions
)
(
result
*
v1alpha1
.
PetSetList
,
err
error
)
{
result
=
&
v1alpha1
.
PetSetList
{}
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
VersionedParams
(
&
opts
,
api
.
ParameterCodec
)
.
Do
()
.
Into
(
result
)
return
}
// Watch returns a watch.Interface that watches the requested petSets.
func
(
c
*
petSets
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
c
.
client
.
Get
()
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
VersionedParams
(
&
opts
,
api
.
ParameterCodec
)
.
Watch
()
}
// Patch applies the patch and returns the patched petSet.
func
(
c
*
petSets
)
Patch
(
name
string
,
pt
api
.
PatchType
,
data
[]
byte
,
subresources
...
string
)
(
result
*
v1alpha1
.
PetSet
,
err
error
)
{
result
=
&
v1alpha1
.
PetSet
{}
err
=
c
.
client
.
Patch
(
pt
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"petsets"
)
.
SubResource
(
subresources
...
)
.
Name
(
name
)
.
Body
(
data
)
.
Do
()
.
Into
(
result
)
return
}
pkg/client/unversioned/apps.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
unversioned
import
(
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/client/restclient"
)
type
AppsInterface
interface
{
StatefulSetNamespacer
}
// AppsClient is used to interact with Kubernetes batch features.
type
AppsClient
struct
{
*
restclient
.
RESTClient
}
func
(
c
*
AppsClient
)
StatefulSets
(
namespace
string
)
StatefulSetInterface
{
return
newStatefulSet
(
c
,
namespace
)
}
func
NewApps
(
c
*
restclient
.
Config
)
(
*
AppsClient
,
error
)
{
config
:=
*
c
if
err
:=
setGroupDefaults
(
apps
.
GroupName
,
&
config
);
err
!=
nil
{
return
nil
,
err
}
client
,
err
:=
restclient
.
RESTClientFor
(
&
config
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
AppsClient
{
client
},
nil
}
func
NewAppsOrDie
(
c
*
restclient
.
Config
)
*
AppsClient
{
client
,
err
:=
NewApps
(
c
)
if
err
!=
nil
{
panic
(
err
)
}
return
client
}
pkg/client/unversioned/pet_sets.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
unversioned
import
(
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/watch"
)
// StatefulSetNamespacer has methods to work with StatefulSet resources in a namespace
type
StatefulSetNamespacer
interface
{
StatefulSets
(
namespace
string
)
StatefulSetInterface
}
// StatefulSetInterface exposes methods to work on StatefulSet resources.
type
StatefulSetInterface
interface
{
List
(
opts
api
.
ListOptions
)
(
*
apps
.
StatefulSetList
,
error
)
Get
(
name
string
)
(
*
apps
.
StatefulSet
,
error
)
Create
(
statefulSet
*
apps
.
StatefulSet
)
(
*
apps
.
StatefulSet
,
error
)
Update
(
statefulSet
*
apps
.
StatefulSet
)
(
*
apps
.
StatefulSet
,
error
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
UpdateStatus
(
statefulSet
*
apps
.
StatefulSet
)
(
*
apps
.
StatefulSet
,
error
)
}
// statefulSet implements StatefulSetNamespacer interface
type
statefulSet
struct
{
r
*
AppsClient
ns
string
}
// newStatefulSet returns a statefulSet
func
newStatefulSet
(
c
*
AppsClient
,
namespace
string
)
*
statefulSet
{
return
&
statefulSet
{
c
,
namespace
}
}
// List returns a list of statefulSet that match the label and field selectors.
func
(
c
*
statefulSet
)
List
(
opts
api
.
ListOptions
)
(
result
*
apps
.
StatefulSetList
,
err
error
)
{
result
=
&
apps
.
StatefulSetList
{}
err
=
c
.
r
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
VersionedParams
(
&
opts
,
api
.
ParameterCodec
)
.
Do
()
.
Into
(
result
)
return
}
// Get returns information about a particular statefulSet.
func
(
c
*
statefulSet
)
Get
(
name
string
)
(
result
*
apps
.
StatefulSet
,
err
error
)
{
result
=
&
apps
.
StatefulSet
{}
err
=
c
.
r
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
Name
(
name
)
.
Do
()
.
Into
(
result
)
return
}
// Create creates a new statefulSet.
func
(
c
*
statefulSet
)
Create
(
statefulSet
*
apps
.
StatefulSet
)
(
result
*
apps
.
StatefulSet
,
err
error
)
{
result
=
&
apps
.
StatefulSet
{}
err
=
c
.
r
.
Post
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
Body
(
statefulSet
)
.
Do
()
.
Into
(
result
)
return
}
// Update updates an existing statefulSet.
func
(
c
*
statefulSet
)
Update
(
statefulSet
*
apps
.
StatefulSet
)
(
result
*
apps
.
StatefulSet
,
err
error
)
{
result
=
&
apps
.
StatefulSet
{}
err
=
c
.
r
.
Put
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
Name
(
statefulSet
.
Name
)
.
Body
(
statefulSet
)
.
Do
()
.
Into
(
result
)
return
}
// Delete deletes a statefulSet, returns error if one occurs.
func
(
c
*
statefulSet
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
(
err
error
)
{
return
c
.
r
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
Name
(
name
)
.
Body
(
options
)
.
Do
()
.
Error
()
}
// Watch returns a watch.Interface that watches the requested statefulSet.
func
(
c
*
statefulSet
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
c
.
r
.
Get
()
.
Prefix
(
"watch"
)
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
VersionedParams
(
&
opts
,
api
.
ParameterCodec
)
.
Watch
()
}
// UpdateStatus takes the name of the statefulSet and the new status. Returns the server's representation of the statefulSet, and an error, if it occurs.
func
(
c
*
statefulSet
)
UpdateStatus
(
statefulSet
*
apps
.
StatefulSet
)
(
result
*
apps
.
StatefulSet
,
err
error
)
{
result
=
&
apps
.
StatefulSet
{}
err
=
c
.
r
.
Put
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"statefulsets"
)
.
Name
(
statefulSet
.
Name
)
.
SubResource
(
"status"
)
.
Body
(
statefulSet
)
.
Do
()
.
Into
(
result
)
return
}
pkg/client/unversioned/pet_sets_test.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
unversioned_test
import
(
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/client/unversioned/testclient/simple"
)
func
getStatefulSetResourceName
()
string
{
return
"statefulsets"
}
func
TestListStatefulSets
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceAll
c
:=
&
simple
.
Client
{
Request
:
simple
.
Request
{
Method
:
"GET"
,
Path
:
testapi
.
Apps
.
ResourcePath
(
getStatefulSetResourceName
(),
ns
,
""
),
},
Response
:
simple
.
Response
{
StatusCode
:
200
,
Body
:
&
apps
.
StatefulSetList
{
Items
:
[]
apps
.
StatefulSet
{
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"name"
:
"baz"
,
},
},
Spec
:
apps
.
StatefulSetSpec
{
Replicas
:
2
,
Template
:
api
.
PodTemplateSpec
{},
},
},
},
},
},
}
receivedRSList
,
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
List
(
api
.
ListOptions
{})
c
.
Validate
(
t
,
receivedRSList
,
err
)
}
func
TestGetStatefulSet
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
simple
.
Client
{
Request
:
simple
.
Request
{
Method
:
"GET"
,
Path
:
testapi
.
Apps
.
ResourcePath
(
getStatefulSetResourceName
(),
ns
,
"foo"
),
Query
:
simple
.
BuildQueryValues
(
nil
)},
Response
:
simple
.
Response
{
StatusCode
:
200
,
Body
:
&
apps
.
StatefulSet
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"name"
:
"baz"
,
},
},
Spec
:
apps
.
StatefulSetSpec
{
Replicas
:
2
,
Template
:
api
.
PodTemplateSpec
{},
},
},
},
}
receivedRS
,
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
Get
(
"foo"
)
c
.
Validate
(
t
,
receivedRS
,
err
)
}
func
TestGetStatefulSetWithNoName
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
simple
.
Client
{
Error
:
true
}
receivedPod
,
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
Get
(
""
)
if
(
err
!=
nil
)
&&
(
err
.
Error
()
!=
simple
.
NameRequiredError
)
{
t
.
Errorf
(
"Expected error: %v, but got %v"
,
simple
.
NameRequiredError
,
err
)
}
c
.
Validate
(
t
,
receivedPod
,
err
)
}
func
TestUpdateStatefulSet
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
requestRS
:=
&
apps
.
StatefulSet
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
ResourceVersion
:
"1"
},
}
c
:=
&
simple
.
Client
{
Request
:
simple
.
Request
{
Method
:
"PUT"
,
Path
:
testapi
.
Apps
.
ResourcePath
(
getStatefulSetResourceName
(),
ns
,
"foo"
),
Query
:
simple
.
BuildQueryValues
(
nil
)},
Response
:
simple
.
Response
{
StatusCode
:
200
,
Body
:
&
apps
.
StatefulSet
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"name"
:
"baz"
,
},
},
Spec
:
apps
.
StatefulSetSpec
{
Replicas
:
2
,
Template
:
api
.
PodTemplateSpec
{},
},
},
},
}
receivedRS
,
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
Update
(
requestRS
)
c
.
Validate
(
t
,
receivedRS
,
err
)
}
func
TestDeleteStatefulSet
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
simple
.
Client
{
Request
:
simple
.
Request
{
Method
:
"DELETE"
,
Path
:
testapi
.
Apps
.
ResourcePath
(
getStatefulSetResourceName
(),
ns
,
"foo"
),
Query
:
simple
.
BuildQueryValues
(
nil
)},
Response
:
simple
.
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
Delete
(
"foo"
,
nil
)
c
.
Validate
(
t
,
nil
,
err
)
}
func
TestCreateStatefulSet
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
requestRS
:=
&
apps
.
StatefulSet
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
}
c
:=
&
simple
.
Client
{
Request
:
simple
.
Request
{
Method
:
"POST"
,
Path
:
testapi
.
Apps
.
ResourcePath
(
getStatefulSetResourceName
(),
ns
,
""
),
Body
:
requestRS
,
Query
:
simple
.
BuildQueryValues
(
nil
)},
Response
:
simple
.
Response
{
StatusCode
:
200
,
Body
:
&
apps
.
StatefulSet
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"name"
:
"baz"
,
},
},
Spec
:
apps
.
StatefulSetSpec
{
Replicas
:
2
,
Template
:
api
.
PodTemplateSpec
{},
},
},
},
}
receivedRS
,
err
:=
c
.
Setup
(
t
)
.
Apps
()
.
StatefulSets
(
ns
)
.
Create
(
requestRS
)
c
.
Validate
(
t
,
receivedRS
,
err
)
}
// TODO: Test Status actions.
pkg/client/unversioned/testclient/BUILD
deleted
100644 → 0
View file @
74dbfdca
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = [
"fake_petsets.go",
"testclient.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/client/typed/discovery:go_default_library",
"//pkg/client/unversioned:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/version:go_default_library",
"//pkg/watch:go_default_library",
"//vendor:github.com/emicklei/go-restful/swagger",
],
)
pkg/client/unversioned/testclient/fake_petsets.go
deleted
100644 → 0
View file @
74dbfdca
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
testclient
import
(
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/watch"
)
// FakeStatefulSets implements StatefulSetsInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the method you want to test easier.
type
FakeStatefulSets
struct
{
Fake
*
FakeApps
Namespace
string
}
func
(
c
*
FakeStatefulSets
)
Get
(
name
string
)
(
*
apps
.
StatefulSet
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
NewGetAction
(
"statefulsets"
,
c
.
Namespace
,
name
),
&
apps
.
StatefulSet
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
apps
.
StatefulSet
),
err
}
func
(
c
*
FakeStatefulSets
)
List
(
opts
api
.
ListOptions
)
(
*
apps
.
StatefulSetList
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
NewListAction
(
"statefulsets"
,
c
.
Namespace
,
opts
),
&
apps
.
StatefulSetList
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
apps
.
StatefulSetList
),
err
}
func
(
c
*
FakeStatefulSets
)
Create
(
rs
*
apps
.
StatefulSet
)
(
*
apps
.
StatefulSet
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
NewCreateAction
(
"statefulsets"
,
c
.
Namespace
,
rs
),
rs
)
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
apps
.
StatefulSet
),
err
}
func
(
c
*
FakeStatefulSets
)
Update
(
rs
*
apps
.
StatefulSet
)
(
*
apps
.
StatefulSet
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
NewUpdateAction
(
"statefulsets"
,
c
.
Namespace
,
rs
),
rs
)
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
apps
.
StatefulSet
),
err
}
func
(
c
*
FakeStatefulSets
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
{
_
,
err
:=
c
.
Fake
.
Invokes
(
NewDeleteAction
(
"statefulsets"
,
c
.
Namespace
,
name
),
&
apps
.
StatefulSet
{})
return
err
}
func
(
c
*
FakeStatefulSets
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
c
.
Fake
.
InvokesWatch
(
NewWatchAction
(
"statefulsets"
,
c
.
Namespace
,
opts
))
}
func
(
c
*
FakeStatefulSets
)
UpdateStatus
(
rs
*
apps
.
StatefulSet
)
(
result
*
apps
.
StatefulSet
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
NewUpdateSubresourceAction
(
"statefulsets"
,
"status"
,
c
.
Namespace
,
rs
),
rs
)
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
apps
.
StatefulSet
),
err
}
pkg/client/unversioned/testclient/testclient.go
deleted
100644 → 0
View file @
74dbfdca
This diff is collapsed.
Click to expand it.
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