Skip to content

Commit

Permalink
Move *RunControllerName out of v1alpha1 🐸
Browse files Browse the repository at this point in the history
This is not related to the API version. It also remove the constant in
the reconciler for the same information.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Dec 11, 2019
1 parent 14c8da2 commit 02776f3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/pipeline/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ limitations under the License.
package pipeline

const (
// PipelineRunControllerName holds the name of the PipelineRun controller
// nolint: golint
PipelineRunControllerName = "PipelineRun"

// TaskRunControllerName holds the name of the PipelineRun controller
TaskRunControllerName = "TaskRun"

// PipelineResourceTypeGit indicates that this source is a GitHub repo.
ArtifactStorageBucketType = "bucket"
Expand Down
9 changes: 4 additions & 5 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/tektoncd/pipeline/pkg/apis/config"

"github.com/tektoncd/pipeline/pkg/apis/pipeline"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -30,11 +30,10 @@ import (
)

var (
pipelineRunControllerName = "PipelineRun"
groupVersionKind = schema.GroupVersionKind{
groupVersionKind = schema.GroupVersionKind{
Group: SchemeGroupVersion.Group,
Version: SchemeGroupVersion.Version,
Kind: pipelineRunControllerName,
Kind: pipeline.PipelineRunControllerName,
}
)

Expand Down Expand Up @@ -238,7 +237,7 @@ func (pr *PipelineRun) IsCancelled() bool {
// GetRunKey return the pipelinerun key for timeout handler map
func (pr *PipelineRun) GetRunKey() string {
// The address of the pointer is a threadsafe unique identifier for the pipelinerun
return fmt.Sprintf("%s/%p", pipelineRunControllerName, pr)
return fmt.Sprintf("%s/%p", pipeline.PipelineRunControllerName, pr)
}

// IsTimedOut returns true if a pipelinerun has exceeded its spec.Timeout based on its status.Timeout
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1alpha1/taskrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (tr *TaskRun) GetPipelineRunPVCName() string {
return ""
}
for _, ref := range tr.GetOwnerReferences() {
if ref.Kind == pipelineRunControllerName {
if ref.Kind == pipeline.PipelineRunControllerName {
return fmt.Sprintf("%s-pvc", ref.Name)
}
}
Expand All @@ -254,7 +254,7 @@ func (tr *TaskRun) GetPipelineRunPVCName() string {
// owner reference of type PipelineRun
func (tr *TaskRun) HasPipelineRunOwnerReference() bool {
for _, ref := range tr.GetOwnerReferences() {
if ref.Kind == pipelineRunControllerName {
if ref.Kind == pipeline.PipelineRunControllerName {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/pipelinerun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func NewController(images pipeline.Images) func(context.Context, configmap.Watch
timeoutHandler: timeoutHandler,
metrics: metrics,
}
impl := controller.NewImpl(c, c.Logger, pipelineRunControllerName)
impl := controller.NewImpl(c, c.Logger, pipeline.PipelineRunControllerName)

timeoutHandler.SetPipelineRunCallbackFunc(impl.Enqueue)
timeoutHandler.CheckTimeouts(kubeclientset, pipelineclientset)
Expand Down
2 changes: 0 additions & 2 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ const (
ReasonInvalidGraph = "PipelineInvalidGraph"
// pipelineRunAgentName defines logging agent name for PipelineRun Controller
pipelineRunAgentName = "pipeline-controller"
// pipelineRunControllerName defines name for PipelineRun Controller
pipelineRunControllerName = "PipelineRun"

// Event reasons
eventReasonFailed = "PipelineRunFailed"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/taskrun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func NewController(images pipeline.Images) func(context.Context, configmap.Watch
metrics: metrics,
entrypointCache: entrypointCache,
}
impl := controller.NewImpl(c, c.Logger, taskRunControllerName)
impl := controller.NewImpl(c, c.Logger, pipeline.TaskRunControllerName)

timeoutHandler.SetTaskRunCallbackFunc(impl.Enqueue)
timeoutHandler.CheckTimeouts(kubeclientset, pipelineclientset)
Expand Down
5 changes: 0 additions & 5 deletions pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ import (
const (
// taskRunAgentName defines logging agent name for TaskRun Controller
taskRunAgentName = "taskrun-controller"
// taskRunControllerName defines name for TaskRun Controller
taskRunControllerName = "TaskRun"

// imageDigestExporterContainerName defines the name of the container that will collect the
// built images digest
)

// Reconciler implements controller.Reconciler for Configuration resources.
Expand Down

0 comments on commit 02776f3

Please sign in to comment.