From 4081d619394c04fbac338f8c8d14a41f456a7d63 Mon Sep 17 00:00:00 2001 From: poy Date: Wed, 27 Nov 2019 16:21:38 -0700 Subject: [PATCH] remove PipelineStatus and PipelineResourceStatus This removes two struct types: * `PipelineStatus` * `PipelineResourceStatus` These Status types were unused and did not follow the pattern of using Knative's DuckType. Other types such as `Task` do not have a Status type and instead defer to their corresponding `TaskRun` status. fixes #1636 --- pkg/apis/pipeline/v1alpha1/pipeline_types.go | 11 +----- pkg/apis/pipeline/v1alpha1/resource_types.go | 10 +----- .../v1alpha1/zz_generated.deepcopy.go | 34 ------------------- .../pipeline/v1alpha1/fake/fake_pipeline.go | 12 ------- .../v1alpha1/fake/fake_pipelineresource.go | 12 ------- .../typed/pipeline/v1alpha1/pipeline.go | 17 ---------- .../pipeline/v1alpha1/pipelineresource.go | 17 ---------- 7 files changed, 2 insertions(+), 111 deletions(-) diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_types.go b/pkg/apis/pipeline/v1alpha1/pipeline_types.go index 1a2e8b0b5b9..de19f38e23a 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_types.go @@ -33,12 +33,6 @@ type PipelineSpec struct { Params []ParamSpec `json:"params,omitempty"` } -// PipelineStatus does not contain anything because Pipelines on their own -// do not have a status, they just hold data which is later used by a -// PipelineRun. -type PipelineStatus struct { -} - // Check that Pipeline may be validated and defaulted. // TaskKind defines the type of Task used by the pipeline. type TaskKind string @@ -52,6 +46,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient:noStatus // Pipeline describes a list of Tasks to execute. It expresses how outputs // of tasks feed into inputs of subsequent tasks. @@ -64,10 +59,6 @@ type Pipeline struct { // Spec holds the desired state of the Pipeline from the client // +optional Spec PipelineSpec `json:"spec"` - // Status communicates the observed state of the Pipeline from the - // controller. - // +optional - Status PipelineStatus `json:"status"` } func (p *Pipeline) PipelineMetadata() metav1.ObjectMeta { diff --git a/pkg/apis/pipeline/v1alpha1/resource_types.go b/pkg/apis/pipeline/v1alpha1/resource_types.go index 2260426b16d..321cd5303e7 100644 --- a/pkg/apis/pipeline/v1alpha1/resource_types.go +++ b/pkg/apis/pipeline/v1alpha1/resource_types.go @@ -147,14 +147,9 @@ type PipelineResourceSpec struct { SecretParams []SecretParam `json:"secrets,omitempty"` } -// PipelineResourceStatus does not contain anything because Resources on their own -// do not have a status, they just hold data which is later used by PipelineRuns -// and TaskRuns. -type PipelineResourceStatus struct { -} - // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient:noStatus // PipelineResource describes a resource that is an input to or output from a // Task. @@ -167,9 +162,6 @@ type PipelineResource struct { // Spec holds the desired state of the PipelineResource from the client Spec PipelineResourceSpec `json:"spec,omitempty"` - // Status communicates the observed state of the PipelineResource from the controller - // +optional - Status PipelineResourceStatus `json:"status,omitempty"` } // PipelineResourceBinding connects a reference to an instance of a PipelineResource diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 2709b144c13..0c7becbb184 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -472,7 +472,6 @@ func (in *Pipeline) DeepCopyInto(out *Pipeline) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status return } @@ -581,7 +580,6 @@ func (in *PipelineResource) DeepCopyInto(out *PipelineResource) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status return } @@ -721,22 +719,6 @@ func (in *PipelineResourceSpec) DeepCopy() *PipelineResourceSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PipelineResourceStatus) DeepCopyInto(out *PipelineResourceStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceStatus. -func (in *PipelineResourceStatus) DeepCopy() *PipelineResourceStatus { - if in == nil { - return nil - } - out := new(PipelineResourceStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineRun) DeepCopyInto(out *PipelineRun) { *out = *in @@ -997,22 +979,6 @@ func (in *PipelineSpec) DeepCopy() *PipelineSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PipelineStatus) DeepCopyInto(out *PipelineStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineStatus. -func (in *PipelineStatus) DeepCopy() *PipelineStatus { - if in == nil { - return nil - } - out := new(PipelineStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline.go index c62bb888618..3c0f2d84bdd 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline.go @@ -100,18 +100,6 @@ func (c *FakePipelines) Update(pipeline *v1alpha1.Pipeline) (result *v1alpha1.Pi return obj.(*v1alpha1.Pipeline), 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 *FakePipelines) UpdateStatus(pipeline *v1alpha1.Pipeline) (*v1alpha1.Pipeline, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(pipelinesResource, "status", c.ns, pipeline), &v1alpha1.Pipeline{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Pipeline), err -} - // Delete takes name of the pipeline and deletes it. Returns an error if one occurs. func (c *FakePipelines) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipelineresource.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipelineresource.go index 50a2864747c..44e4517672b 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipelineresource.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipelineresource.go @@ -100,18 +100,6 @@ func (c *FakePipelineResources) Update(pipelineResource *v1alpha1.PipelineResour return obj.(*v1alpha1.PipelineResource), 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 *FakePipelineResources) UpdateStatus(pipelineResource *v1alpha1.PipelineResource) (*v1alpha1.PipelineResource, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(pipelineresourcesResource, "status", c.ns, pipelineResource), &v1alpha1.PipelineResource{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PipelineResource), err -} - // Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. func (c *FakePipelineResources) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline.go index 570f1a63c0f..175b9345894 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline.go @@ -39,7 +39,6 @@ type PipelinesGetter interface { type PipelineInterface interface { Create(*v1alpha1.Pipeline) (*v1alpha1.Pipeline, error) Update(*v1alpha1.Pipeline) (*v1alpha1.Pipeline, error) - UpdateStatus(*v1alpha1.Pipeline) (*v1alpha1.Pipeline, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error Get(name string, options v1.GetOptions) (*v1alpha1.Pipeline, error) @@ -133,22 +132,6 @@ func (c *pipelines) Update(pipeline *v1alpha1.Pipeline) (result *v1alpha1.Pipeli return } -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *pipelines) UpdateStatus(pipeline *v1alpha1.Pipeline) (result *v1alpha1.Pipeline, err error) { - result = &v1alpha1.Pipeline{} - err = c.client.Put(). - Namespace(c.ns). - Resource("pipelines"). - Name(pipeline.Name). - SubResource("status"). - Body(pipeline). - Do(). - Into(result) - return -} - // Delete takes name of the pipeline and deletes it. Returns an error if one occurs. func (c *pipelines) Delete(name string, options *v1.DeleteOptions) error { return c.client.Delete(). diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipelineresource.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipelineresource.go index b052dbd8730..2797c856882 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipelineresource.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipelineresource.go @@ -39,7 +39,6 @@ type PipelineResourcesGetter interface { type PipelineResourceInterface interface { Create(*v1alpha1.PipelineResource) (*v1alpha1.PipelineResource, error) Update(*v1alpha1.PipelineResource) (*v1alpha1.PipelineResource, error) - UpdateStatus(*v1alpha1.PipelineResource) (*v1alpha1.PipelineResource, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error Get(name string, options v1.GetOptions) (*v1alpha1.PipelineResource, error) @@ -133,22 +132,6 @@ func (c *pipelineResources) Update(pipelineResource *v1alpha1.PipelineResource) return } -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *pipelineResources) UpdateStatus(pipelineResource *v1alpha1.PipelineResource) (result *v1alpha1.PipelineResource, err error) { - result = &v1alpha1.PipelineResource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("pipelineresources"). - Name(pipelineResource.Name). - SubResource("status"). - Body(pipelineResource). - Do(). - Into(result) - return -} - // Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. func (c *pipelineResources) Delete(name string, options *v1.DeleteOptions) error { return c.client.Delete().