Skip to content

Commit

Permalink
remove PipelineStatus and PipelineResourceStatus
Browse files Browse the repository at this point in the history
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
  • Loading branch information
poy committed Nov 27, 2019
1 parent 6ea8888 commit 46c72cf
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 117 deletions.
2 changes: 0 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions pkg/apis/pipeline/v1alpha1/pipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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 {
Expand Down
10 changes: 1 addition & 9 deletions pkg/apis/pipeline/v1alpha1/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,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.
Expand All @@ -192,9 +187,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
Expand Down
34 changes: 0 additions & 34 deletions pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/pod/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func orderContainers(entrypointImage string, steps []corev1.Container) (corev1.C
func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
newPod, err := kubeclient.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("Error getting Pod %q when updating ready annotation: %w", pod.Name, err)
return fmt.Errorf("Error getting Pod %q when updating ready annotation: %v", pod.Name, err)
}

// Update the Pod's "READY" annotation to signal the first step to
Expand All @@ -152,7 +152,7 @@ func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
if newPod.ObjectMeta.Annotations[readyAnnotation] != readyAnnotationValue {
newPod.ObjectMeta.Annotations[readyAnnotation] = readyAnnotationValue
if _, err := kubeclient.CoreV1().Pods(newPod.Namespace).Update(newPod); err != nil {
return fmt.Errorf("Error adding ready annotation to Pod %q: %w", pod.Name, err)
return fmt.Errorf("Error adding ready annotation to Pod %q: %v", pod.Name, err)
}
}
return nil
Expand All @@ -163,7 +163,7 @@ func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error {
func StopSidecars(nopImage string, kubeclient kubernetes.Interface, pod corev1.Pod) error {
newPod, err := kubeclient.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("Error getting Pod %q when stopping sidecars: %w", pod.Name, err)
return fmt.Errorf("Error getting Pod %q when stopping sidecars: %v", pod.Name, err)
}

updated := false
Expand All @@ -181,7 +181,7 @@ func StopSidecars(nopImage string, kubeclient kubernetes.Interface, pod corev1.P
}
if updated {
if _, err := kubeclient.CoreV1().Pods(newPod.Namespace).Update(newPod); err != nil {
return fmt.Errorf("Error adding ready annotation to Pod %q: %w", pod.Name, err)
return fmt.Errorf("Error adding ready annotation to Pod %q: %v", pod.Name, err)
}
}
return nil
Expand Down

0 comments on commit 46c72cf

Please sign in to comment.