Commit ac2114ea authored by galal-hussein's avatar galal-hussein

go generate

parent 4af06882
......@@ -6,54 +6,54 @@ import (
"k8s.io/apimachinery/pkg/runtime"
)
type DeploymentLifecycle interface {
Create(obj *v1.Deployment) (runtime.Object, error)
Remove(obj *v1.Deployment) (runtime.Object, error)
Updated(obj *v1.Deployment) (runtime.Object, error)
type DaemonSetLifecycle interface {
Create(obj *v1.DaemonSet) (runtime.Object, error)
Remove(obj *v1.DaemonSet) (runtime.Object, error)
Updated(obj *v1.DaemonSet) (runtime.Object, error)
}
type deploymentLifecycleAdapter struct {
lifecycle DeploymentLifecycle
type daemonSetLifecycleAdapter struct {
lifecycle DaemonSetLifecycle
}
func (w *deploymentLifecycleAdapter) HasCreate() bool {
func (w *daemonSetLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *deploymentLifecycleAdapter) HasFinalize() bool {
func (w *daemonSetLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *deploymentLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Deployment))
func (w *daemonSetLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Deployment))
func (w *daemonSetLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Deployment))
func (w *daemonSetLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func NewDeploymentLifecycleAdapter(name string, clusterScoped bool, client DeploymentInterface, l DeploymentLifecycle) DeploymentHandlerFunc {
adapter := &deploymentLifecycleAdapter{lifecycle: l}
func NewDaemonSetLifecycleAdapter(name string, clusterScoped bool, client DaemonSetInterface, l DaemonSetLifecycle) DaemonSetHandlerFunc {
adapter := &daemonSetLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Deployment) (runtime.Object, error) {
return func(key string, obj *v1.DaemonSet) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
......
......@@ -6,13 +6,13 @@ import (
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentList) DeepCopyInto(out *DeploymentList) {
func (in *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]appsv1.Deployment, len(*in))
*out = make([]appsv1.DaemonSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
......@@ -20,18 +20,18 @@ func (in *DeploymentList) DeepCopyInto(out *DeploymentList) {
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentList.
func (in *DeploymentList) DeepCopy() *DeploymentList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetList.
func (in *DaemonSetList) DeepCopy() *DaemonSetList {
if in == nil {
return nil
}
out := new(DeploymentList)
out := new(DaemonSetList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DeploymentList) DeepCopyObject() runtime.Object {
func (in *DaemonSetList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
......
......@@ -20,13 +20,13 @@ type Interface interface {
RESTClient() rest.Interface
controller.Starter
DeploymentsGetter
DaemonSetsGetter
}
type Clients struct {
Interface Interface
Deployment DeploymentClient
DaemonSet DaemonSetClient
}
type Client struct {
......@@ -34,7 +34,7 @@ type Client struct {
restClient rest.Interface
starters []controller.Starter
deploymentControllers map[string]DeploymentController
daemonSetControllers map[string]DaemonSetController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
......@@ -70,8 +70,8 @@ func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Deployment: &deploymentClient2{
iface: iface.Deployments(""),
DaemonSet: &daemonSetClient2{
iface: iface.DaemonSets(""),
},
}
}
......@@ -89,7 +89,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
return &Client{
restClient: restClient,
deploymentControllers: map[string]DeploymentController{},
daemonSetControllers: map[string]DaemonSetController{},
}, nil
}
......@@ -105,13 +105,13 @@ func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type DeploymentsGetter interface {
Deployments(namespace string) DeploymentInterface
type DaemonSetsGetter interface {
DaemonSets(namespace string) DaemonSetInterface
}
func (c *Client) Deployments(namespace string) DeploymentInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DeploymentResource, DeploymentGroupVersionKind, deploymentFactory{})
return &deploymentClient{
func (c *Client) DaemonSets(namespace string) DaemonSetInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DaemonSetResource, DaemonSetGroupVersionKind, daemonSetFactory{})
return &daemonSetClient{
ns: namespace,
client: c,
objectClient: objectClient,
......
......@@ -33,7 +33,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&DeploymentList{},
&DaemonSetList{},
)
return nil
}
......@@ -99,7 +99,7 @@ func main() {
}
if err := generator.ControllersForForeignTypes(basePackage, appsv1.SchemeGroupVersion, []interface{}{
appsv1.Deployment{},
appsv1.DaemonSet{},
}, nil); err != nil {
logrus.Fatal(err)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment