generated files

This commit is contained in:
Jordan Liggitt
2018-10-19 12:41:03 -04:00
parent 1f000bf321
commit 572dfe6cb7
66 changed files with 1852 additions and 2468 deletions

View File

@@ -10,14 +10,16 @@ go_library(
srcs = [
"apps_client.go",
"controllerrevision.go",
"daemonset.go",
"deployment.go",
"doc.go",
"generated_expansion.go",
"replicaset.go",
"statefulset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion",
deps = [
"//pkg/apis/apps:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",

View File

@@ -26,6 +26,9 @@ import (
type AppsInterface interface {
RESTClient() rest.Interface
ControllerRevisionsGetter
DaemonSetsGetter
DeploymentsGetter
ReplicaSetsGetter
StatefulSetsGetter
}
@@ -38,6 +41,18 @@ func (c *AppsClient) ControllerRevisions(namespace string) ControllerRevisionInt
return newControllerRevisions(c, namespace)
}
func (c *AppsClient) DaemonSets(namespace string) DaemonSetInterface {
return newDaemonSets(c, namespace)
}
func (c *AppsClient) Deployments(namespace string) DeploymentInterface {
return newDeployments(c, namespace)
}
func (c *AppsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
func (c *AppsClient) StatefulSets(namespace string) StatefulSetInterface {
return newStatefulSets(c, namespace)
}

View File

@@ -23,7 +23,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
@@ -35,15 +35,15 @@ type DaemonSetsGetter interface {
// DaemonSetInterface has methods to work with DaemonSet resources.
type DaemonSetInterface interface {
Create(*extensions.DaemonSet) (*extensions.DaemonSet, error)
Update(*extensions.DaemonSet) (*extensions.DaemonSet, error)
UpdateStatus(*extensions.DaemonSet) (*extensions.DaemonSet, error)
Create(*apps.DaemonSet) (*apps.DaemonSet, error)
Update(*apps.DaemonSet) (*apps.DaemonSet, error)
UpdateStatus(*apps.DaemonSet) (*apps.DaemonSet, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*extensions.DaemonSet, error)
List(opts v1.ListOptions) (*extensions.DaemonSetList, error)
Get(name string, options v1.GetOptions) (*apps.DaemonSet, error)
List(opts v1.ListOptions) (*apps.DaemonSetList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.DaemonSet, err error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.DaemonSet, err error)
DaemonSetExpansion
}
@@ -54,7 +54,7 @@ type daemonSets struct {
}
// newDaemonSets returns a DaemonSets
func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
func newDaemonSets(c *AppsClient, namespace string) *daemonSets {
return &daemonSets{
client: c.RESTClient(),
ns: namespace,
@@ -62,8 +62,8 @@ func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
}
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
func (c *daemonSets) Get(name string, options v1.GetOptions) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
func (c *daemonSets) Get(name string, options v1.GetOptions) (result *apps.DaemonSet, err error) {
result = &apps.DaemonSet{}
err = c.client.Get().
Namespace(c.ns).
Resource("daemonsets").
@@ -75,8 +75,8 @@ func (c *daemonSets) Get(name string, options v1.GetOptions) (result *extensions
}
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
func (c *daemonSets) List(opts v1.ListOptions) (result *extensions.DaemonSetList, err error) {
result = &extensions.DaemonSetList{}
func (c *daemonSets) List(opts v1.ListOptions) (result *apps.DaemonSetList, err error) {
result = &apps.DaemonSetList{}
err = c.client.Get().
Namespace(c.ns).
Resource("daemonsets").
@@ -97,8 +97,8 @@ func (c *daemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *daemonSets) Create(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
func (c *daemonSets) Create(daemonSet *apps.DaemonSet) (result *apps.DaemonSet, err error) {
result = &apps.DaemonSet{}
err = c.client.Post().
Namespace(c.ns).
Resource("daemonsets").
@@ -109,8 +109,8 @@ func (c *daemonSets) Create(daemonSet *extensions.DaemonSet) (result *extensions
}
// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *daemonSets) Update(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
func (c *daemonSets) Update(daemonSet *apps.DaemonSet) (result *apps.DaemonSet, err error) {
result = &apps.DaemonSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("daemonsets").
@@ -124,8 +124,8 @@ func (c *daemonSets) Update(daemonSet *extensions.DaemonSet) (result *extensions
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *daemonSets) UpdateStatus(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
func (c *daemonSets) UpdateStatus(daemonSet *apps.DaemonSet) (result *apps.DaemonSet, err error) {
result = &apps.DaemonSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("daemonsets").
@@ -160,8 +160,8 @@ func (c *daemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.
}
// Patch applies the patch and returns the patched daemonSet.
func (c *daemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
func (c *daemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.DaemonSet, err error) {
result = &apps.DaemonSet{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("daemonsets").

View File

@@ -23,8 +23,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
@@ -36,18 +35,15 @@ type DeploymentsGetter interface {
// DeploymentInterface has methods to work with Deployment resources.
type DeploymentInterface interface {
Create(*extensions.Deployment) (*extensions.Deployment, error)
Update(*extensions.Deployment) (*extensions.Deployment, error)
UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error)
Create(*apps.Deployment) (*apps.Deployment, error)
Update(*apps.Deployment) (*apps.Deployment, error)
UpdateStatus(*apps.Deployment) (*apps.Deployment, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*extensions.Deployment, error)
List(opts v1.ListOptions) (*extensions.DeploymentList, error)
Get(name string, options v1.GetOptions) (*apps.Deployment, error)
List(opts v1.ListOptions) (*apps.DeploymentList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.Deployment, err error)
GetScale(deploymentName string, options v1.GetOptions) (*autoscaling.Scale, error)
UpdateScale(deploymentName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.Deployment, err error)
DeploymentExpansion
}
@@ -58,7 +54,7 @@ type deployments struct {
}
// newDeployments returns a Deployments
func newDeployments(c *ExtensionsClient, namespace string) *deployments {
func newDeployments(c *AppsClient, namespace string) *deployments {
return &deployments{
client: c.RESTClient(),
ns: namespace,
@@ -66,8 +62,8 @@ func newDeployments(c *ExtensionsClient, namespace string) *deployments {
}
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
func (c *deployments) Get(name string, options v1.GetOptions) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
func (c *deployments) Get(name string, options v1.GetOptions) (result *apps.Deployment, err error) {
result = &apps.Deployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("deployments").
@@ -79,8 +75,8 @@ func (c *deployments) Get(name string, options v1.GetOptions) (result *extension
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *deployments) List(opts v1.ListOptions) (result *extensions.DeploymentList, err error) {
result = &extensions.DeploymentList{}
func (c *deployments) List(opts v1.ListOptions) (result *apps.DeploymentList, err error) {
result = &apps.DeploymentList{}
err = c.client.Get().
Namespace(c.ns).
Resource("deployments").
@@ -101,8 +97,8 @@ func (c *deployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *deployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
func (c *deployments) Create(deployment *apps.Deployment) (result *apps.Deployment, err error) {
result = &apps.Deployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("deployments").
@@ -113,8 +109,8 @@ func (c *deployments) Create(deployment *extensions.Deployment) (result *extensi
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *deployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
func (c *deployments) Update(deployment *apps.Deployment) (result *apps.Deployment, err error) {
result = &apps.Deployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("deployments").
@@ -128,8 +124,8 @@ func (c *deployments) Update(deployment *extensions.Deployment) (result *extensi
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
func (c *deployments) UpdateStatus(deployment *apps.Deployment) (result *apps.Deployment, err error) {
result = &apps.Deployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("deployments").
@@ -164,8 +160,8 @@ func (c *deployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1
}
// Patch applies the patch and returns the patched deployment.
func (c *deployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
func (c *deployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.Deployment, err error) {
result = &apps.Deployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("deployments").
@@ -176,31 +172,3 @@ func (c *deployments) Patch(name string, pt types.PatchType, data []byte, subres
Into(result)
return
}
// GetScale takes name of the deployment, and returns the corresponding autoscaling.Scale object, and an error if there is any.
func (c *deployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Get().
Namespace(c.ns).
Resource("deployments").
Name(deploymentName).
SubResource("scale").
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *deployments) UpdateScale(deploymentName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Put().
Namespace(c.ns).
Resource("deployments").
Name(deploymentName).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}

View File

@@ -11,12 +11,14 @@ go_library(
"doc.go",
"fake_apps_client.go",
"fake_controllerrevision.go",
"fake_daemonset.go",
"fake_deployment.go",
"fake_replicaset.go",
"fake_statefulset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake",
deps = [
"//pkg/apis/apps:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",

View File

@@ -32,6 +32,18 @@ func (c *FakeApps) ControllerRevisions(namespace string) internalversion.Control
return &FakeControllerRevisions{c, namespace}
}
func (c *FakeApps) DaemonSets(namespace string) internalversion.DaemonSetInterface {
return &FakeDaemonSets{c, namespace}
}
func (c *FakeApps) Deployments(namespace string) internalversion.DeploymentInterface {
return &FakeDeployments{c, namespace}
}
func (c *FakeApps) ReplicaSets(namespace string) internalversion.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace}
}
func (c *FakeApps) StatefulSets(namespace string) internalversion.StatefulSetInterface {
return &FakeStatefulSets{c, namespace}
}

View File

@@ -25,34 +25,34 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// FakeDaemonSets implements DaemonSetInterface
type FakeDaemonSets struct {
Fake *FakeExtensions
Fake *FakeApps
ns string
}
var daemonsetsResource = schema.GroupVersionResource{Group: "extensions", Version: "", Resource: "daemonsets"}
var daemonsetsResource = schema.GroupVersionResource{Group: "apps", Version: "", Resource: "daemonsets"}
var daemonsetsKind = schema.GroupVersionKind{Group: "extensions", Version: "", Kind: "DaemonSet"}
var daemonsetsKind = schema.GroupVersionKind{Group: "apps", Version: "", Kind: "DaemonSet"}
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
func (c *FakeDaemonSets) Get(name string, options v1.GetOptions) (result *extensions.DaemonSet, err error) {
func (c *FakeDaemonSets) Get(name string, options v1.GetOptions) (result *apps.DaemonSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &extensions.DaemonSet{})
Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &apps.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
return obj.(*apps.DaemonSet), err
}
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *extensions.DaemonSetList, err error) {
func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *apps.DaemonSetList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &extensions.DaemonSetList{})
Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &apps.DaemonSetList{})
if obj == nil {
return nil, err
@@ -62,8 +62,8 @@ func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *extensions.DaemonSet
if label == nil {
label = labels.Everything()
}
list := &extensions.DaemonSetList{ListMeta: obj.(*extensions.DaemonSetList).ListMeta}
for _, item := range obj.(*extensions.DaemonSetList).Items {
list := &apps.DaemonSetList{ListMeta: obj.(*apps.DaemonSetList).ListMeta}
for _, item := range obj.(*apps.DaemonSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@@ -79,43 +79,43 @@ func (c *FakeDaemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Create(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
func (c *FakeDaemonSets) Create(daemonSet *apps.DaemonSet) (result *apps.DaemonSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &extensions.DaemonSet{})
Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &apps.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
return obj.(*apps.DaemonSet), err
}
// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Update(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
func (c *FakeDaemonSets) Update(daemonSet *apps.DaemonSet) (result *apps.DaemonSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &extensions.DaemonSet{})
Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &apps.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
return obj.(*apps.DaemonSet), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeDaemonSets) UpdateStatus(daemonSet *extensions.DaemonSet) (*extensions.DaemonSet, error) {
func (c *FakeDaemonSets) UpdateStatus(daemonSet *apps.DaemonSet) (*apps.DaemonSet, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &extensions.DaemonSet{})
Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &apps.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
return obj.(*apps.DaemonSet), err
}
// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
func (c *FakeDaemonSets) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &extensions.DaemonSet{})
Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &apps.DaemonSet{})
return err
}
@@ -124,17 +124,17 @@ func (c *FakeDaemonSets) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &extensions.DaemonSetList{})
_, err := c.Fake.Invokes(action, &apps.DaemonSetList{})
return err
}
// Patch applies the patch and returns the patched daemonSet.
func (c *FakeDaemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.DaemonSet, err error) {
func (c *FakeDaemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.DaemonSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &extensions.DaemonSet{})
Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &apps.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
return obj.(*apps.DaemonSet), err
}

View File

@@ -25,35 +25,34 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// FakeDeployments implements DeploymentInterface
type FakeDeployments struct {
Fake *FakeExtensions
Fake *FakeApps
ns string
}
var deploymentsResource = schema.GroupVersionResource{Group: "extensions", Version: "", Resource: "deployments"}
var deploymentsResource = schema.GroupVersionResource{Group: "apps", Version: "", Resource: "deployments"}
var deploymentsKind = schema.GroupVersionKind{Group: "extensions", Version: "", Kind: "Deployment"}
var deploymentsKind = schema.GroupVersionKind{Group: "apps", Version: "", Kind: "Deployment"}
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *extensions.Deployment, err error) {
func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *apps.Deployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &extensions.Deployment{})
Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &apps.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
return obj.(*apps.Deployment), err
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *FakeDeployments) List(opts v1.ListOptions) (result *extensions.DeploymentList, err error) {
func (c *FakeDeployments) List(opts v1.ListOptions) (result *apps.DeploymentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &extensions.DeploymentList{})
Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &apps.DeploymentList{})
if obj == nil {
return nil, err
@@ -63,8 +62,8 @@ func (c *FakeDeployments) List(opts v1.ListOptions) (result *extensions.Deployme
if label == nil {
label = labels.Everything()
}
list := &extensions.DeploymentList{ListMeta: obj.(*extensions.DeploymentList).ListMeta}
for _, item := range obj.(*extensions.DeploymentList).Items {
list := &apps.DeploymentList{ListMeta: obj.(*apps.DeploymentList).ListMeta}
for _, item := range obj.(*apps.DeploymentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@@ -80,43 +79,43 @@ func (c *FakeDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
func (c *FakeDeployments) Create(deployment *apps.Deployment) (result *apps.Deployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &extensions.Deployment{})
Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &apps.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
return obj.(*apps.Deployment), err
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
func (c *FakeDeployments) Update(deployment *apps.Deployment) (result *apps.Deployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &extensions.Deployment{})
Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &apps.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
return obj.(*apps.Deployment), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeDeployments) UpdateStatus(deployment *extensions.Deployment) (*extensions.Deployment, error) {
func (c *FakeDeployments) UpdateStatus(deployment *apps.Deployment) (*apps.Deployment, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &extensions.Deployment{})
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &apps.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
return obj.(*apps.Deployment), err
}
// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &extensions.Deployment{})
Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &apps.Deployment{})
return err
}
@@ -125,39 +124,17 @@ func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &extensions.DeploymentList{})
_, err := c.Fake.Invokes(action, &apps.DeploymentList{})
return err
}
// Patch applies the patch and returns the patched deployment.
func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.Deployment, err error) {
func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.Deployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &extensions.Deployment{})
Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &apps.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
}
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *FakeDeployments) UpdateScale(deploymentName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
return obj.(*apps.Deployment), err
}

View File

@@ -25,35 +25,34 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// FakeReplicaSets implements ReplicaSetInterface
type FakeReplicaSets struct {
Fake *FakeExtensions
Fake *FakeApps
ns string
}
var replicasetsResource = schema.GroupVersionResource{Group: "extensions", Version: "", Resource: "replicasets"}
var replicasetsResource = schema.GroupVersionResource{Group: "apps", Version: "", Resource: "replicasets"}
var replicasetsKind = schema.GroupVersionKind{Group: "extensions", Version: "", Kind: "ReplicaSet"}
var replicasetsKind = schema.GroupVersionKind{Group: "apps", Version: "", Kind: "ReplicaSet"}
// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *extensions.ReplicaSet, err error) {
func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *apps.ReplicaSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &extensions.ReplicaSet{})
Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &apps.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
return obj.(*apps.ReplicaSet), err
}
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *extensions.ReplicaSetList, err error) {
func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *apps.ReplicaSetList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &extensions.ReplicaSetList{})
Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &apps.ReplicaSetList{})
if obj == nil {
return nil, err
@@ -63,8 +62,8 @@ func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *extensions.ReplicaS
if label == nil {
label = labels.Everything()
}
list := &extensions.ReplicaSetList{ListMeta: obj.(*extensions.ReplicaSetList).ListMeta}
for _, item := range obj.(*extensions.ReplicaSetList).Items {
list := &apps.ReplicaSetList{ListMeta: obj.(*apps.ReplicaSetList).ListMeta}
for _, item := range obj.(*apps.ReplicaSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@@ -80,43 +79,43 @@ func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Create(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
func (c *FakeReplicaSets) Create(replicaSet *apps.ReplicaSet) (result *apps.ReplicaSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &extensions.ReplicaSet{})
Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &apps.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
return obj.(*apps.ReplicaSet), err
}
// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Update(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
func (c *FakeReplicaSets) Update(replicaSet *apps.ReplicaSet) (result *apps.ReplicaSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &extensions.ReplicaSet{})
Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &apps.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
return obj.(*apps.ReplicaSet), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeReplicaSets) UpdateStatus(replicaSet *extensions.ReplicaSet) (*extensions.ReplicaSet, error) {
func (c *FakeReplicaSets) UpdateStatus(replicaSet *apps.ReplicaSet) (*apps.ReplicaSet, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &extensions.ReplicaSet{})
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &apps.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
return obj.(*apps.ReplicaSet), err
}
// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &extensions.ReplicaSet{})
Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &apps.ReplicaSet{})
return err
}
@@ -125,39 +124,17 @@ func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &extensions.ReplicaSetList{})
_, err := c.Fake.Invokes(action, &apps.ReplicaSetList{})
return err
}
// Patch applies the patch and returns the patched replicaSet.
func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.ReplicaSet, err error) {
func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.ReplicaSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &extensions.ReplicaSet{})
Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &apps.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
}
// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
}
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
return obj.(*apps.ReplicaSet), err
}

View File

@@ -26,7 +26,6 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
apps "k8s.io/kubernetes/pkg/apis/apps"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
)
// FakeStatefulSets implements StatefulSetInterface
@@ -139,25 +138,3 @@ func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, s
}
return obj.(*apps.StatefulSet), err
}
// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
}
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &autoscaling.Scale{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.Scale), err
}

View File

@@ -20,4 +20,10 @@ package internalversion
type ControllerRevisionExpansion interface{}
type DaemonSetExpansion interface{}
type DeploymentExpansion interface{}
type ReplicaSetExpansion interface{}
type StatefulSetExpansion interface{}

View File

@@ -23,8 +23,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
@@ -36,18 +35,15 @@ type ReplicaSetsGetter interface {
// ReplicaSetInterface has methods to work with ReplicaSet resources.
type ReplicaSetInterface interface {
Create(*extensions.ReplicaSet) (*extensions.ReplicaSet, error)
Update(*extensions.ReplicaSet) (*extensions.ReplicaSet, error)
UpdateStatus(*extensions.ReplicaSet) (*extensions.ReplicaSet, error)
Create(*apps.ReplicaSet) (*apps.ReplicaSet, error)
Update(*apps.ReplicaSet) (*apps.ReplicaSet, error)
UpdateStatus(*apps.ReplicaSet) (*apps.ReplicaSet, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*extensions.ReplicaSet, error)
List(opts v1.ListOptions) (*extensions.ReplicaSetList, error)
Get(name string, options v1.GetOptions) (*apps.ReplicaSet, error)
List(opts v1.ListOptions) (*apps.ReplicaSetList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.ReplicaSet, err error)
GetScale(replicaSetName string, options v1.GetOptions) (*autoscaling.Scale, error)
UpdateScale(replicaSetName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.ReplicaSet, err error)
ReplicaSetExpansion
}
@@ -58,7 +54,7 @@ type replicaSets struct {
}
// newReplicaSets returns a ReplicaSets
func newReplicaSets(c *ExtensionsClient, namespace string) *replicaSets {
func newReplicaSets(c *AppsClient, namespace string) *replicaSets {
return &replicaSets{
client: c.RESTClient(),
ns: namespace,
@@ -66,8 +62,8 @@ func newReplicaSets(c *ExtensionsClient, namespace string) *replicaSets {
}
// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
func (c *replicaSets) Get(name string, options v1.GetOptions) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
func (c *replicaSets) Get(name string, options v1.GetOptions) (result *apps.ReplicaSet, err error) {
result = &apps.ReplicaSet{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicasets").
@@ -79,8 +75,8 @@ func (c *replicaSets) Get(name string, options v1.GetOptions) (result *extension
}
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
func (c *replicaSets) List(opts v1.ListOptions) (result *extensions.ReplicaSetList, err error) {
result = &extensions.ReplicaSetList{}
func (c *replicaSets) List(opts v1.ListOptions) (result *apps.ReplicaSetList, err error) {
result = &apps.ReplicaSetList{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicasets").
@@ -101,8 +97,8 @@ func (c *replicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *replicaSets) Create(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
func (c *replicaSets) Create(replicaSet *apps.ReplicaSet) (result *apps.ReplicaSet, err error) {
result = &apps.ReplicaSet{}
err = c.client.Post().
Namespace(c.ns).
Resource("replicasets").
@@ -113,8 +109,8 @@ func (c *replicaSets) Create(replicaSet *extensions.ReplicaSet) (result *extensi
}
// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *replicaSets) Update(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
func (c *replicaSets) Update(replicaSet *apps.ReplicaSet) (result *apps.ReplicaSet, err error) {
result = &apps.ReplicaSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicasets").
@@ -128,8 +124,8 @@ func (c *replicaSets) Update(replicaSet *extensions.ReplicaSet) (result *extensi
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *replicaSets) UpdateStatus(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
func (c *replicaSets) UpdateStatus(replicaSet *apps.ReplicaSet) (result *apps.ReplicaSet, err error) {
result = &apps.ReplicaSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicasets").
@@ -164,8 +160,8 @@ func (c *replicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1
}
// Patch applies the patch and returns the patched replicaSet.
func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.ReplicaSet, err error) {
result = &apps.ReplicaSet{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("replicasets").
@@ -176,31 +172,3 @@ func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subres
Into(result)
return
}
// GetScale takes name of the replicaSet, and returns the corresponding autoscaling.Scale object, and an error if there is any.
func (c *replicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Get().
Namespace(c.ns).
Resource("replicasets").
Name(replicaSetName).
SubResource("scale").
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *replicaSets) UpdateScale(replicaSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Put().
Namespace(c.ns).
Resource("replicasets").
Name(replicaSetName).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}

View File

@@ -24,7 +24,6 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
apps "k8s.io/kubernetes/pkg/apis/apps"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
@@ -45,9 +44,6 @@ type StatefulSetInterface interface {
List(opts v1.ListOptions) (*apps.StatefulSetList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.StatefulSet, err error)
GetScale(statefulSetName string, options v1.GetOptions) (*autoscaling.Scale, error)
UpdateScale(statefulSetName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
StatefulSetExpansion
}
@@ -176,31 +172,3 @@ func (c *statefulSets) Patch(name string, pt types.PatchType, data []byte, subre
Into(result)
return
}
// GetScale takes name of the statefulSet, and returns the corresponding autoscaling.Scale object, and an error if there is any.
func (c *statefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Get().
Namespace(c.ns).
Resource("statefulsets").
Name(statefulSetName).
SubResource("scale").
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
func (c *statefulSets) UpdateScale(statefulSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
result = &autoscaling.Scale{}
err = c.client.Put().
Namespace(c.ns).
Resource("statefulsets").
Name(statefulSetName).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}

View File

@@ -8,18 +8,13 @@ load(
go_library(
name = "go_default_library",
srcs = [
"daemonset.go",
"deployment.go",
"deployment_expansion.go",
"doc.go",
"extensions_client.go",
"generated_expansion.go",
"ingress.go",
"replicaset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion",
deps = [
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@@ -1,29 +0,0 @@
/*
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 internalversion
import "k8s.io/kubernetes/pkg/apis/extensions"
// The DeploymentExpansion interface allows manually adding extra methods to the DeploymentInterface.
type DeploymentExpansion interface {
Rollback(*extensions.DeploymentRollback) error
}
// Rollback applied the provided DeploymentRollback to the named deployment in the current namespace.
func (c *deployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error {
return c.client.Post().Namespace(c.ns).Resource("deployments").Name(deploymentRollback.Name).SubResource("rollback").Body(deploymentRollback).Do().Error()
}

View File

@@ -25,10 +25,7 @@ import (
type ExtensionsInterface interface {
RESTClient() rest.Interface
DaemonSetsGetter
DeploymentsGetter
IngressesGetter
ReplicaSetsGetter
}
// ExtensionsClient is used to interact with features provided by the extensions group.
@@ -36,22 +33,10 @@ type ExtensionsClient struct {
restClient rest.Interface
}
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface {
return newDaemonSets(c, namespace)
}
func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface {
return newDeployments(c, namespace)
}
func (c *ExtensionsClient) Ingresses(namespace string) IngressInterface {
return newIngresses(c, namespace)
}
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
// NewForConfig creates a new ExtensionsClient for the given config.
func NewForConfig(c *rest.Config) (*ExtensionsClient, error) {
config := *c

View File

@@ -9,16 +9,11 @@ go_library(
name = "go_default_library",
srcs = [
"doc.go",
"fake_daemonset.go",
"fake_deployment.go",
"fake_deployment_expansion.go",
"fake_extensions_client.go",
"fake_ingress.go",
"fake_replicaset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/fake",
deps = [
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@@ -1,33 +0,0 @@
/*
Copyright 2014 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 (
core "k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/apis/extensions"
)
func (c *FakeDeployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error {
action := core.CreateActionImpl{}
action.Verb = "create"
action.Resource = deploymentsResource
action.Subresource = "rollback"
action.Object = deploymentRollback
_, err := c.Fake.Invokes(action, deploymentRollback)
return err
}

View File

@@ -28,22 +28,10 @@ type FakeExtensions struct {
*testing.Fake
}
func (c *FakeExtensions) DaemonSets(namespace string) internalversion.DaemonSetInterface {
return &FakeDaemonSets{c, namespace}
}
func (c *FakeExtensions) Deployments(namespace string) internalversion.DeploymentInterface {
return &FakeDeployments{c, namespace}
}
func (c *FakeExtensions) Ingresses(namespace string) internalversion.IngressInterface {
return &FakeIngresses{c, namespace}
}
func (c *FakeExtensions) ReplicaSets(namespace string) internalversion.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeExtensions) RESTClient() rest.Interface {

View File

@@ -18,8 +18,4 @@ limitations under the License.
package internalversion
type DaemonSetExpansion interface{}
type IngressExpansion interface{}
type ReplicaSetExpansion interface{}

View File

@@ -9,7 +9,10 @@ go_library(
name = "go_default_library",
srcs = [
"controllerrevision.go",
"daemonset.go",
"deployment.go",
"interface.go",
"replicaset.go",
"statefulset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/apps/internalversion",

View File

@@ -25,10 +25,10 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/extensions/internalversion"
internalversion "k8s.io/kubernetes/pkg/client/listers/apps/internalversion"
)
// DaemonSetInformer provides access to a shared informer and lister for
@@ -61,16 +61,16 @@ func NewFilteredDaemonSetInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().DaemonSets(namespace).List(options)
return client.Apps().DaemonSets(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().DaemonSets(namespace).Watch(options)
return client.Apps().DaemonSets(namespace).Watch(options)
},
},
&extensions.DaemonSet{},
&apps.DaemonSet{},
resyncPeriod,
indexers,
)
@@ -81,7 +81,7 @@ func (f *daemonSetInformer) defaultInformer(client internalclientset.Interface,
}
func (f *daemonSetInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&extensions.DaemonSet{}, f.defaultInformer)
return f.factory.InformerFor(&apps.DaemonSet{}, f.defaultInformer)
}
func (f *daemonSetInformer) Lister() internalversion.DaemonSetLister {

View File

@@ -25,10 +25,10 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/extensions/internalversion"
internalversion "k8s.io/kubernetes/pkg/client/listers/apps/internalversion"
)
// DeploymentInformer provides access to a shared informer and lister for
@@ -61,16 +61,16 @@ func NewFilteredDeploymentInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().Deployments(namespace).List(options)
return client.Apps().Deployments(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().Deployments(namespace).Watch(options)
return client.Apps().Deployments(namespace).Watch(options)
},
},
&extensions.Deployment{},
&apps.Deployment{},
resyncPeriod,
indexers,
)
@@ -81,7 +81,7 @@ func (f *deploymentInformer) defaultInformer(client internalclientset.Interface,
}
func (f *deploymentInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&extensions.Deployment{}, f.defaultInformer)
return f.factory.InformerFor(&apps.Deployment{}, f.defaultInformer)
}
func (f *deploymentInformer) Lister() internalversion.DeploymentLister {

View File

@@ -26,6 +26,12 @@ import (
type Interface interface {
// ControllerRevisions returns a ControllerRevisionInformer.
ControllerRevisions() ControllerRevisionInformer
// DaemonSets returns a DaemonSetInformer.
DaemonSets() DaemonSetInformer
// Deployments returns a DeploymentInformer.
Deployments() DeploymentInformer
// ReplicaSets returns a ReplicaSetInformer.
ReplicaSets() ReplicaSetInformer
// StatefulSets returns a StatefulSetInformer.
StatefulSets() StatefulSetInformer
}
@@ -46,6 +52,21 @@ func (v *version) ControllerRevisions() ControllerRevisionInformer {
return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// DaemonSets returns a DaemonSetInformer.
func (v *version) DaemonSets() DaemonSetInformer {
return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Deployments returns a DeploymentInformer.
func (v *version) Deployments() DeploymentInformer {
return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ReplicaSets returns a ReplicaSetInformer.
func (v *version) ReplicaSets() ReplicaSetInformer {
return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// StatefulSets returns a StatefulSetInformer.
func (v *version) StatefulSets() StatefulSetInformer {
return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@@ -25,10 +25,10 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/extensions/internalversion"
internalversion "k8s.io/kubernetes/pkg/client/listers/apps/internalversion"
)
// ReplicaSetInformer provides access to a shared informer and lister for
@@ -61,16 +61,16 @@ func NewFilteredReplicaSetInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().ReplicaSets(namespace).List(options)
return client.Apps().ReplicaSets(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Extensions().ReplicaSets(namespace).Watch(options)
return client.Apps().ReplicaSets(namespace).Watch(options)
},
},
&extensions.ReplicaSet{},
&apps.ReplicaSet{},
resyncPeriod,
indexers,
)
@@ -81,7 +81,7 @@ func (f *replicaSetInformer) defaultInformer(client internalclientset.Interface,
}
func (f *replicaSetInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&extensions.ReplicaSet{}, f.defaultInformer)
return f.factory.InformerFor(&apps.ReplicaSet{}, f.defaultInformer)
}
func (f *replicaSetInformer) Lister() internalversion.ReplicaSetLister {

View File

@@ -8,11 +8,8 @@ load(
go_library(
name = "go_default_library",
srcs = [
"daemonset.go",
"deployment.go",
"ingress.go",
"interface.go",
"replicaset.go",
],
importpath = "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/extensions/internalversion",
deps = [

View File

@@ -24,14 +24,8 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// DaemonSets returns a DaemonSetInformer.
DaemonSets() DaemonSetInformer
// Deployments returns a DeploymentInformer.
Deployments() DeploymentInformer
// Ingresses returns a IngressInformer.
Ingresses() IngressInformer
// ReplicaSets returns a ReplicaSetInformer.
ReplicaSets() ReplicaSetInformer
}
type version struct {
@@ -45,22 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// DaemonSets returns a DaemonSetInformer.
func (v *version) DaemonSets() DaemonSetInformer {
return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Deployments returns a DeploymentInformer.
func (v *version) Deployments() DeploymentInformer {
return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Ingresses returns a IngressInformer.
func (v *version) Ingresses() IngressInformer {
return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ReplicaSets returns a ReplicaSetInformer.
func (v *version) ReplicaSets() ReplicaSetInformer {
return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@@ -77,6 +77,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=apps, Version=internalVersion
case apps.SchemeGroupVersion.WithResource("controllerrevisions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().ControllerRevisions().Informer()}, nil
case apps.SchemeGroupVersion.WithResource("daemonsets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().DaemonSets().Informer()}, nil
case apps.SchemeGroupVersion.WithResource("deployments"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().Deployments().Informer()}, nil
case apps.SchemeGroupVersion.WithResource("replicasets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().ReplicaSets().Informer()}, nil
case apps.SchemeGroupVersion.WithResource("statefulsets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().StatefulSets().Informer()}, nil
@@ -137,14 +143,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Core().InternalVersion().ServiceAccounts().Informer()}, nil
// Group=extensions, Version=internalVersion
case extensions.SchemeGroupVersion.WithResource("daemonsets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().InternalVersion().DaemonSets().Informer()}, nil
case extensions.SchemeGroupVersion.WithResource("deployments"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().InternalVersion().Deployments().Informer()}, nil
case extensions.SchemeGroupVersion.WithResource("ingresses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().InternalVersion().Ingresses().Informer()}, nil
case extensions.SchemeGroupVersion.WithResource("replicasets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().InternalVersion().ReplicaSets().Informer()}, nil
// Group=networking.k8s.io, Version=internalVersion
case networking.SchemeGroupVersion.WithResource("networkpolicies"):

View File

@@ -9,7 +9,10 @@ go_library(
name = "go_default_library",
srcs = [
"controllerrevision.go",
"daemonset.go",
"deployment.go",
"expansion_generated.go",
"replicaset.go",
"statefulset.go",
"statefulset_expansion.go",
],

View File

@@ -22,13 +22,13 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// DaemonSetLister helps list DaemonSets.
type DaemonSetLister interface {
// List lists all DaemonSets in the indexer.
List(selector labels.Selector) (ret []*extensions.DaemonSet, err error)
List(selector labels.Selector) (ret []*apps.DaemonSet, err error)
// DaemonSets returns an object that can list and get DaemonSets.
DaemonSets(namespace string) DaemonSetNamespaceLister
DaemonSetListerExpansion
@@ -45,9 +45,9 @@ func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister {
}
// List lists all DaemonSets in the indexer.
func (s *daemonSetLister) List(selector labels.Selector) (ret []*extensions.DaemonSet, err error) {
func (s *daemonSetLister) List(selector labels.Selector) (ret []*apps.DaemonSet, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.DaemonSet))
ret = append(ret, m.(*apps.DaemonSet))
})
return ret, err
}
@@ -60,9 +60,9 @@ func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister
// DaemonSetNamespaceLister helps list and get DaemonSets.
type DaemonSetNamespaceLister interface {
// List lists all DaemonSets in the indexer for a given namespace.
List(selector labels.Selector) (ret []*extensions.DaemonSet, err error)
List(selector labels.Selector) (ret []*apps.DaemonSet, err error)
// Get retrieves the DaemonSet from the indexer for a given namespace and name.
Get(name string) (*extensions.DaemonSet, error)
Get(name string) (*apps.DaemonSet, error)
DaemonSetNamespaceListerExpansion
}
@@ -74,21 +74,21 @@ type daemonSetNamespaceLister struct {
}
// List lists all DaemonSets in the indexer for a given namespace.
func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*extensions.DaemonSet, err error) {
func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*apps.DaemonSet, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.DaemonSet))
ret = append(ret, m.(*apps.DaemonSet))
})
return ret, err
}
// Get retrieves the DaemonSet from the indexer for a given namespace and name.
func (s daemonSetNamespaceLister) Get(name string) (*extensions.DaemonSet, error) {
func (s daemonSetNamespaceLister) Get(name string) (*apps.DaemonSet, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(extensions.Resource("daemonset"), name)
return nil, errors.NewNotFound(apps.Resource("daemonset"), name)
}
return obj.(*extensions.DaemonSet), nil
return obj.(*apps.DaemonSet), nil
}

View File

@@ -22,13 +22,13 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// DeploymentLister helps list Deployments.
type DeploymentLister interface {
// List lists all Deployments in the indexer.
List(selector labels.Selector) (ret []*extensions.Deployment, err error)
List(selector labels.Selector) (ret []*apps.Deployment, err error)
// Deployments returns an object that can list and get Deployments.
Deployments(namespace string) DeploymentNamespaceLister
DeploymentListerExpansion
@@ -45,9 +45,9 @@ func NewDeploymentLister(indexer cache.Indexer) DeploymentLister {
}
// List lists all Deployments in the indexer.
func (s *deploymentLister) List(selector labels.Selector) (ret []*extensions.Deployment, err error) {
func (s *deploymentLister) List(selector labels.Selector) (ret []*apps.Deployment, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.Deployment))
ret = append(ret, m.(*apps.Deployment))
})
return ret, err
}
@@ -60,9 +60,9 @@ func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceList
// DeploymentNamespaceLister helps list and get Deployments.
type DeploymentNamespaceLister interface {
// List lists all Deployments in the indexer for a given namespace.
List(selector labels.Selector) (ret []*extensions.Deployment, err error)
List(selector labels.Selector) (ret []*apps.Deployment, err error)
// Get retrieves the Deployment from the indexer for a given namespace and name.
Get(name string) (*extensions.Deployment, error)
Get(name string) (*apps.Deployment, error)
DeploymentNamespaceListerExpansion
}
@@ -74,21 +74,21 @@ type deploymentNamespaceLister struct {
}
// List lists all Deployments in the indexer for a given namespace.
func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*extensions.Deployment, err error) {
func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*apps.Deployment, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.Deployment))
ret = append(ret, m.(*apps.Deployment))
})
return ret, err
}
// Get retrieves the Deployment from the indexer for a given namespace and name.
func (s deploymentNamespaceLister) Get(name string) (*extensions.Deployment, error) {
func (s deploymentNamespaceLister) Get(name string) (*apps.Deployment, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(extensions.Resource("deployment"), name)
return nil, errors.NewNotFound(apps.Resource("deployment"), name)
}
return obj.(*extensions.Deployment), nil
return obj.(*apps.Deployment), nil
}

View File

@@ -25,3 +25,27 @@ type ControllerRevisionListerExpansion interface{}
// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to
// ControllerRevisionNamespaceLister.
type ControllerRevisionNamespaceListerExpansion interface{}
// DaemonSetListerExpansion allows custom methods to be added to
// DaemonSetLister.
type DaemonSetListerExpansion interface{}
// DaemonSetNamespaceListerExpansion allows custom methods to be added to
// DaemonSetNamespaceLister.
type DaemonSetNamespaceListerExpansion interface{}
// DeploymentListerExpansion allows custom methods to be added to
// DeploymentLister.
type DeploymentListerExpansion interface{}
// DeploymentNamespaceListerExpansion allows custom methods to be added to
// DeploymentNamespaceLister.
type DeploymentNamespaceListerExpansion interface{}
// ReplicaSetListerExpansion allows custom methods to be added to
// ReplicaSetLister.
type ReplicaSetListerExpansion interface{}
// ReplicaSetNamespaceListerExpansion allows custom methods to be added to
// ReplicaSetNamespaceLister.
type ReplicaSetNamespaceListerExpansion interface{}

View File

@@ -22,13 +22,13 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
apps "k8s.io/kubernetes/pkg/apis/apps"
)
// ReplicaSetLister helps list ReplicaSets.
type ReplicaSetLister interface {
// List lists all ReplicaSets in the indexer.
List(selector labels.Selector) (ret []*extensions.ReplicaSet, err error)
List(selector labels.Selector) (ret []*apps.ReplicaSet, err error)
// ReplicaSets returns an object that can list and get ReplicaSets.
ReplicaSets(namespace string) ReplicaSetNamespaceLister
ReplicaSetListerExpansion
@@ -45,9 +45,9 @@ func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister {
}
// List lists all ReplicaSets in the indexer.
func (s *replicaSetLister) List(selector labels.Selector) (ret []*extensions.ReplicaSet, err error) {
func (s *replicaSetLister) List(selector labels.Selector) (ret []*apps.ReplicaSet, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.ReplicaSet))
ret = append(ret, m.(*apps.ReplicaSet))
})
return ret, err
}
@@ -60,9 +60,9 @@ func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceList
// ReplicaSetNamespaceLister helps list and get ReplicaSets.
type ReplicaSetNamespaceLister interface {
// List lists all ReplicaSets in the indexer for a given namespace.
List(selector labels.Selector) (ret []*extensions.ReplicaSet, err error)
List(selector labels.Selector) (ret []*apps.ReplicaSet, err error)
// Get retrieves the ReplicaSet from the indexer for a given namespace and name.
Get(name string) (*extensions.ReplicaSet, error)
Get(name string) (*apps.ReplicaSet, error)
ReplicaSetNamespaceListerExpansion
}
@@ -74,21 +74,21 @@ type replicaSetNamespaceLister struct {
}
// List lists all ReplicaSets in the indexer for a given namespace.
func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*extensions.ReplicaSet, err error) {
func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*apps.ReplicaSet, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*extensions.ReplicaSet))
ret = append(ret, m.(*apps.ReplicaSet))
})
return ret, err
}
// Get retrieves the ReplicaSet from the indexer for a given namespace and name.
func (s replicaSetNamespaceLister) Get(name string) (*extensions.ReplicaSet, error) {
func (s replicaSetNamespaceLister) Get(name string) (*apps.ReplicaSet, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(extensions.Resource("replicaset"), name)
return nil, errors.NewNotFound(apps.Resource("replicaset"), name)
}
return obj.(*extensions.ReplicaSet), nil
return obj.(*apps.ReplicaSet), nil
}

View File

@@ -1,29 +1,17 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"daemonset.go",
"daemonset_expansion.go",
"deployment.go",
"deployment_expansion.go",
"expansion_generated.go",
"ingress.go",
"replicaset.go",
"replicaset_expansion.go",
],
importpath = "k8s.io/kubernetes/pkg/client/listers/extensions/internalversion",
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
],
@@ -41,17 +29,3 @@ filegroup(
srcs = [":package-srcs"],
tags = ["automanaged"],
)
go_test(
name = "go_default_test",
srcs = ["daemonset_expansion_test.go"],
embed = [":go_default_library"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -1,78 +0,0 @@
/*
Copyright 2017 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 internalversion
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/extensions"
)
// DaemonSetListerExpansion allows custom methods to be added to
// DaemonSetLister.
type DaemonSetListerExpansion interface {
GetPodDaemonSets(pod *api.Pod) ([]*extensions.DaemonSet, error)
}
// DaemonSetNamespaceListerExpansion allows custom methods to be added to
// DaemonSetNamespaceLister.
type DaemonSetNamespaceListerExpansion interface{}
// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod.
// Only the one specified in the Pod's ControllerRef will actually manage it.
// Returns an error only if no matching DaemonSets are found.
func (s *daemonSetLister) GetPodDaemonSets(pod *api.Pod) ([]*extensions.DaemonSet, error) {
var selector labels.Selector
var daemonSet *extensions.DaemonSet
if len(pod.Labels) == 0 {
return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name)
}
list, err := s.DaemonSets(pod.Namespace).List(labels.Everything())
if err != nil {
return nil, err
}
var daemonSets []*extensions.DaemonSet
for i := range list {
daemonSet = list[i]
if daemonSet.Namespace != pod.Namespace {
continue
}
selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector)
if err != nil {
// this should not happen if the DaemonSet passed validation
return nil, err
}
// If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything.
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
continue
}
daemonSets = append(daemonSets, daemonSet)
}
if len(daemonSets) == 0 {
return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
}
return daemonSets, nil
}

View File

@@ -1,152 +0,0 @@
/*
Copyright 2017 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 internalversion
import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/tools/cache"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/extensions"
)
func TestDaemonSetLister(t *testing.T) {
store := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{"namespace": cache.MetaNamespaceIndexFunc})
lister := NewDaemonSetLister(store)
testCases := []struct {
inDSs []*extensions.DaemonSet
list func() ([]*extensions.DaemonSet, error)
outDaemonSetNames sets.String
expectErr bool
}{
// Basic listing
{
inDSs: []*extensions.DaemonSet{
{ObjectMeta: metav1.ObjectMeta{Name: "basic"}},
},
list: func() ([]*extensions.DaemonSet, error) {
return lister.List(labels.Everything())
},
outDaemonSetNames: sets.NewString("basic"),
},
// Listing multiple daemon sets
{
inDSs: []*extensions.DaemonSet{
{ObjectMeta: metav1.ObjectMeta{Name: "basic"}},
{ObjectMeta: metav1.ObjectMeta{Name: "complex"}},
{ObjectMeta: metav1.ObjectMeta{Name: "complex2"}},
},
list: func() ([]*extensions.DaemonSet, error) {
return lister.List(labels.Everything())
},
outDaemonSetNames: sets.NewString("basic", "complex", "complex2"),
},
// No pod labels
{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: metav1.ObjectMeta{Name: "basic", Namespace: "ns"},
Spec: extensions.DaemonSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "baz"}},
},
},
},
list: func() ([]*extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "pod1", Namespace: "ns"},
}
return lister.GetPodDaemonSets(pod)
},
outDaemonSetNames: sets.NewString(),
expectErr: true,
},
// No DS selectors
{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: metav1.ObjectMeta{Name: "basic", Namespace: "ns"},
},
},
list: func() ([]*extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod1",
Namespace: "ns",
Labels: map[string]string{"foo": "bar"},
},
}
return lister.GetPodDaemonSets(pod)
},
outDaemonSetNames: sets.NewString(),
expectErr: true,
},
// Matching labels to selectors and namespace
{
inDSs: []*extensions.DaemonSet{
{
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
Spec: extensions.DaemonSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
},
},
{
ObjectMeta: metav1.ObjectMeta{Name: "bar", Namespace: "ns"},
Spec: extensions.DaemonSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
},
},
},
list: func() ([]*extensions.DaemonSet, error) {
pod := &api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod1",
Labels: map[string]string{"foo": "bar"},
Namespace: "ns",
},
}
return lister.GetPodDaemonSets(pod)
},
outDaemonSetNames: sets.NewString("bar"),
},
}
for _, c := range testCases {
for _, r := range c.inDSs {
store.Add(r)
}
daemonSets, err := c.list()
if err != nil && c.expectErr {
continue
} else if c.expectErr {
t.Error("Expected error, got none")
continue
} else if err != nil {
t.Errorf("Unexpected error %#v", err)
continue
}
daemonSetNames := make([]string, len(daemonSets))
for ix := range daemonSets {
daemonSetNames[ix] = daemonSets[ix].Name
}
if !c.outDaemonSetNames.HasAll(daemonSetNames...) || len(daemonSetNames) != len(c.outDaemonSetNames) {
t.Errorf("Unexpected got controllers %+v expected %+v", daemonSetNames, c.outDaemonSetNames)
}
}
}

View File

@@ -1,70 +0,0 @@
/*
Copyright 2017 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 internalversion
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/kubernetes/pkg/apis/extensions"
)
// DeploymentListerExpansion allows custom methods to be added to
// DeploymentLister.
type DeploymentListerExpansion interface {
GetDeploymentsForReplicaSet(rs *extensions.ReplicaSet) ([]*extensions.Deployment, error)
}
// DeploymentNamespaceListerExpansion allows custom methods to be added to
// DeploymentNamespaceLister.
type DeploymentNamespaceListerExpansion interface{}
// GetDeploymentsForReplicaSet returns a list of Deployments that potentially
// match a ReplicaSet. Only the one specified in the ReplicaSet's ControllerRef
// will actually manage it.
// Returns an error only if no matching Deployments are found.
func (s *deploymentLister) GetDeploymentsForReplicaSet(rs *extensions.ReplicaSet) ([]*extensions.Deployment, error) {
if len(rs.Labels) == 0 {
return nil, fmt.Errorf("no deployments found for ReplicaSet %v because it has no labels", rs.Name)
}
// TODO: MODIFY THIS METHOD so that it checks for the podTemplateSpecHash label
dList, err := s.Deployments(rs.Namespace).List(labels.Everything())
if err != nil {
return nil, err
}
var deployments []*extensions.Deployment
for _, d := range dList {
selector, err := metav1.LabelSelectorAsSelector(d.Spec.Selector)
if err != nil {
return nil, fmt.Errorf("invalid label selector: %v", err)
}
// If a deployment with a nil or empty selector creeps in, it should match nothing, not everything.
if selector.Empty() || !selector.Matches(labels.Set(rs.Labels)) {
continue
}
deployments = append(deployments, d)
}
if len(deployments) == 0 {
return nil, fmt.Errorf("could not find deployments set for ReplicaSet %s in namespace %s with labels: %v", rs.Name, rs.Namespace, rs.Labels)
}
return deployments, nil
}

View File

@@ -1,73 +0,0 @@
/*
Copyright 2017 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 internalversion
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/extensions"
)
// ReplicaSetListerExpansion allows custom methods to be added to
// ReplicaSetLister.
type ReplicaSetListerExpansion interface {
GetPodReplicaSets(pod *api.Pod) ([]*extensions.ReplicaSet, error)
}
// ReplicaSetNamespaceListerExpansion allows custom methods to be added to
// ReplicaSetNamespaceLister.
type ReplicaSetNamespaceListerExpansion interface{}
// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod.
// Only the one specified in the Pod's ControllerRef will actually manage it.
// Returns an error only if no matching ReplicaSets are found.
func (s *replicaSetLister) GetPodReplicaSets(pod *api.Pod) ([]*extensions.ReplicaSet, error) {
if len(pod.Labels) == 0 {
return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name)
}
list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything())
if err != nil {
return nil, err
}
var rss []*extensions.ReplicaSet
for _, rs := range list {
if rs.Namespace != pod.Namespace {
continue
}
selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector)
if err != nil {
return nil, fmt.Errorf("invalid selector: %v", err)
}
// If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything.
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
continue
}
rss = append(rss, rs)
}
if len(rss) == 0 {
return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
}
return rss, nil
}