Skip to content

Commit

Permalink
Remove unused parameters from resources.MakePod
Browse files Browse the repository at this point in the history
The cache and logger parameters were not being used in the function.
  • Loading branch information
dibyom authored and tekton-robot committed Jul 17, 2019
1 parent 01d7dff commit df7ec8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
3 changes: 1 addition & 2 deletions pkg/reconciler/v1alpha1/taskrun/resources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"sort"
"strings"

"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -250,7 +249,7 @@ func TryGetPod(taskRunStatus v1alpha1.TaskRunStatus, gp GetPod) (*corev1.Pod, er

// MakePod converts TaskRun and TaskSpec objects to a Pod which implements the taskrun specified
// by the supplied CRD.
func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient kubernetes.Interface, cache *entrypoint.Cache, logger *zap.SugaredLogger) (*corev1.Pod, error) {
func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient kubernetes.Interface) (*corev1.Pod, error) {
cred, secrets, err := makeCredentialInitializer(taskRun.Spec.ServiceAccount, taskRun.Namespace, kubeclient)
if err != nil {
return nil, err
Expand Down
7 changes: 2 additions & 5 deletions pkg/reconciler/v1alpha1/taskrun/resources/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
fakek8s "k8s.io/client-go/kubernetes/fake"

"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/entrypoint"
"github.com/tektoncd/pipeline/test/names"
)

Expand Down Expand Up @@ -366,8 +365,7 @@ func TestMakePod(t *testing.T) {
},
Spec: c.trs,
}
cache, _ := entrypoint.NewCache()
got, err := MakePod(tr, c.ts, cs, cache, logger)
got, err := MakePod(tr, c.ts, cs)
if err != c.wantErr {
t.Fatalf("MakePod: %v", err)
}
Expand Down Expand Up @@ -591,8 +589,7 @@ func TestInitOutputResourcesDefaultDir(t *testing.T) {
},
Spec: c.trs,
}
cache, _ := entrypoint.NewCache()
got, err := MakePod(tr, c.ts, cs, cache, logger)
got, err := MakePod(tr, c.ts, cs)
if err != c.wantErr {
t.Fatalf("MakePod: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/v1alpha1/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (c *Reconciler) createPod(tr *v1alpha1.TaskRun, rtr *resources.ResolvedTask
ts = resources.ApplyResources(ts, inputResources, "inputs")
ts = resources.ApplyResources(ts, outputResources, "outputs")

pod, err := resources.MakePod(tr, *ts, c.KubeClientSet, c.cache, c.Logger)
pod, err := resources.MakePod(tr, *ts, c.KubeClientSet)
if err != nil {
return nil, xerrors.Errorf("translating Build to Pod: %w", err)
}
Expand Down
24 changes: 11 additions & 13 deletions pkg/reconciler/v1alpha1/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ import (
"github.com/knative/pkg/apis"
"github.com/knative/pkg/configmap"
rtesting "github.com/knative/pkg/reconciler/testing"
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/logging"
"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/entrypoint"
"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/resources"
"github.com/tektoncd/pipeline/pkg/status"
"github.com/tektoncd/pipeline/pkg/system"
"github.com/tektoncd/pipeline/test"
tb "github.com/tektoncd/pipeline/test/builder"
"github.com/tektoncd/pipeline/test/names"
"go.uber.org/zap"
"go.uber.org/zap/zaptest/observer"
"golang.org/x/xerrors"
Expand All @@ -48,6 +38,16 @@ import (
fakekubeclientset "k8s.io/client-go/kubernetes/fake"
ktesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"

"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/entrypoint"
"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/resources"
"github.com/tektoncd/pipeline/pkg/status"
"github.com/tektoncd/pipeline/pkg/system"
"github.com/tektoncd/pipeline/test"
tb "github.com/tektoncd/pipeline/test/builder"
"github.com/tektoncd/pipeline/test/names"
)

const (
Expand Down Expand Up @@ -1294,8 +1294,6 @@ func TestReconcilePodFetchError(t *testing.T) {
}

func makePod(taskRun *v1alpha1.TaskRun, task *v1alpha1.Task) (*corev1.Pod, error) {
logger, _ := logging.NewLogger("", "")
cache, _ := entrypoint.NewCache()
// TODO(jasonhall): This avoids a circular dependency where
// getTaskRunController takes a test.Data which must be populated with
// a pod created from MakePod which requires a (fake) Kube client. When
Expand All @@ -1308,7 +1306,7 @@ func makePod(taskRun *v1alpha1.TaskRun, task *v1alpha1.Task) (*corev1.Pod, error
Name: "default",
Namespace: taskRun.Namespace,
},
}), cache, logger)
}))
}

func TestReconcilePodUpdateStatus(t *testing.T) {
Expand Down

0 comments on commit df7ec8b

Please sign in to comment.