From a4e98b0413d1cee590a1cb3e26ba5d25eab726d0 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 29 Jun 2023 19:49:28 -0500 Subject: [PATCH] Move workflow pkg --- internal/agent/agent.go | 2 +- internal/agent/agent_test.go | 2 +- internal/agent/mock.go | 2 +- internal/agent/run.go | 3 ++- internal/agent/runtime.go | 2 +- internal/agent/runtime/docker.go | 5 +++-- internal/agent/runtime/docker_test.go | 2 +- internal/agent/runtime/fake.go | 3 ++- internal/agent/transport/fake.go | 3 ++- internal/agent/transport/grpc.go | 2 +- internal/agent/transport/grpc_test.go | 2 +- internal/agent/transport/handler.go | 2 +- internal/agent/transport/mock.go | 2 +- internal/controller/manager.go | 2 +- internal/{ => obsolete}/workflow/convert.go | 0 internal/{ => obsolete}/workflow/convert_test.go | 0 internal/{ => obsolete}/workflow/reconciler.go | 0 internal/{ => obsolete}/workflow/reconciler_test.go | 0 internal/{ => obsolete}/workflow/template_funcs.go | 0 internal/{ => obsolete}/workflow/template_validator.go | 0 internal/{ => obsolete}/workflow/template_validator_test.go | 0 internal/{ => obsolete}/workflow/types.go | 0 internal/server/kubernetes_api_workflow.go | 2 +- internal/{agent => }/workflow/workflow.go | 0 24 files changed, 20 insertions(+), 16 deletions(-) rename internal/{ => obsolete}/workflow/convert.go (100%) rename internal/{ => obsolete}/workflow/convert_test.go (100%) rename internal/{ => obsolete}/workflow/reconciler.go (100%) rename internal/{ => obsolete}/workflow/reconciler_test.go (100%) rename internal/{ => obsolete}/workflow/template_funcs.go (100%) rename internal/{ => obsolete}/workflow/template_validator.go (100%) rename internal/{ => obsolete}/workflow/template_validator_test.go (100%) rename internal/{ => obsolete}/workflow/types.go (100%) rename internal/{agent => }/workflow/workflow.go (100%) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index af49fd549..a1ddf31de 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -7,7 +7,7 @@ import ( "github.com/go-logr/logr" "github.com/tinkerbell/tink/internal/agent/event" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // Agent is the core data structure for handling workflow execution on target nodes. It leverages diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index 83ddd6dfd..6a826be0d 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -14,7 +14,7 @@ import ( "github.com/tinkerbell/tink/internal/agent/failure" "github.com/tinkerbell/tink/internal/agent/runtime" "github.com/tinkerbell/tink/internal/agent/transport" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" "go.uber.org/zap" ) diff --git a/internal/agent/mock.go b/internal/agent/mock.go index c7d50b390..6cad397ea 100644 --- a/internal/agent/mock.go +++ b/internal/agent/mock.go @@ -8,7 +8,7 @@ import ( "sync" "github.com/tinkerbell/tink/internal/agent/transport" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // Ensure, that TransportMock does implement Transport. diff --git a/internal/agent/run.go b/internal/agent/run.go index 8543edf41..cfd3290e8 100644 --- a/internal/agent/run.go +++ b/internal/agent/run.go @@ -7,9 +7,10 @@ import ( "time" "github.com/go-logr/logr" + "github.com/tinkerbell/tink/internal/agent/event" "github.com/tinkerbell/tink/internal/agent/failure" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // ReasonRuntimeError is the default reason used when no reason is provided by the runtime. diff --git a/internal/agent/runtime.go b/internal/agent/runtime.go index eea77536f..67bc69579 100644 --- a/internal/agent/runtime.go +++ b/internal/agent/runtime.go @@ -3,7 +3,7 @@ package agent import ( "context" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // ContainerRuntime is a runtime capable of executing workflow actions. diff --git a/internal/agent/runtime/docker.go b/internal/agent/runtime/docker.go index 4d34f4d42..34ad5dea4 100644 --- a/internal/agent/runtime/docker.go +++ b/internal/agent/runtime/docker.go @@ -12,11 +12,12 @@ import ( "github.com/docker/docker/api/types/mount" "github.com/docker/docker/client" "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/util/rand" + "github.com/tinkerbell/tink/internal/agent" "github.com/tinkerbell/tink/internal/agent/runtime/internal" - "github.com/tinkerbell/tink/internal/agent/workflow" "github.com/tinkerbell/tink/internal/ptr" - "k8s.io/apimachinery/pkg/util/rand" + "github.com/tinkerbell/tink/internal/workflow" ) var _ agent.ContainerRuntime = &Docker{} diff --git a/internal/agent/runtime/docker_test.go b/internal/agent/runtime/docker_test.go index 4237d6cbe..8992e4a82 100644 --- a/internal/agent/runtime/docker_test.go +++ b/internal/agent/runtime/docker_test.go @@ -13,7 +13,7 @@ import ( "github.com/rs/zerolog" "github.com/tinkerbell/tink/internal/agent/failure" "github.com/tinkerbell/tink/internal/agent/runtime" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" "go.uber.org/multierr" "github.com/docker/docker/api/types" diff --git a/internal/agent/runtime/fake.go b/internal/agent/runtime/fake.go index 2798331db..cf2432f42 100644 --- a/internal/agent/runtime/fake.go +++ b/internal/agent/runtime/fake.go @@ -4,8 +4,9 @@ import ( "context" "github.com/go-logr/logr" + "github.com/tinkerbell/tink/internal/agent" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) var _ agent.ContainerRuntime = Fake{} diff --git a/internal/agent/transport/fake.go b/internal/agent/transport/fake.go index 9e329910f..db9390fc0 100644 --- a/internal/agent/transport/fake.go +++ b/internal/agent/transport/fake.go @@ -4,8 +4,9 @@ import ( "context" "github.com/go-logr/logr" + "github.com/tinkerbell/tink/internal/agent/event" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) func Noop() Fake { diff --git a/internal/agent/transport/grpc.go b/internal/agent/transport/grpc.go index d0b2c8806..e2b4ff2b7 100644 --- a/internal/agent/transport/grpc.go +++ b/internal/agent/transport/grpc.go @@ -8,8 +8,8 @@ import ( "github.com/avast/retry-go" "github.com/go-logr/logr" "github.com/tinkerbell/tink/internal/agent/event" - "github.com/tinkerbell/tink/internal/agent/workflow" workflowproto "github.com/tinkerbell/tink/internal/proto/workflow/v2" + "github.com/tinkerbell/tink/internal/workflow" ) var _ event.Recorder = &GRPC{} diff --git a/internal/agent/transport/grpc_test.go b/internal/agent/transport/grpc_test.go index 42200ee45..261f571ce 100644 --- a/internal/agent/transport/grpc_test.go +++ b/internal/agent/transport/grpc_test.go @@ -12,8 +12,8 @@ import ( "github.com/rs/zerolog" "github.com/tinkerbell/tink/internal/agent/event" "github.com/tinkerbell/tink/internal/agent/transport" - "github.com/tinkerbell/tink/internal/agent/workflow" workflowproto "github.com/tinkerbell/tink/internal/proto/workflow/v2" + "github.com/tinkerbell/tink/internal/workflow" "google.golang.org/grpc" ) diff --git a/internal/agent/transport/handler.go b/internal/agent/transport/handler.go index 9bbf99f2c..34336a848 100644 --- a/internal/agent/transport/handler.go +++ b/internal/agent/transport/handler.go @@ -4,7 +4,7 @@ import ( "context" "github.com/tinkerbell/tink/internal/agent/event" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // WorkflowHandler is responsible for workflow execution. diff --git a/internal/agent/transport/mock.go b/internal/agent/transport/mock.go index e73ba35f4..429a70548 100644 --- a/internal/agent/transport/mock.go +++ b/internal/agent/transport/mock.go @@ -8,7 +8,7 @@ import ( "sync" "github.com/tinkerbell/tink/internal/agent/event" - "github.com/tinkerbell/tink/internal/agent/workflow" + "github.com/tinkerbell/tink/internal/workflow" ) // Ensure, that WorkflowHandlerMock does implement WorkflowHandler. diff --git a/internal/controller/manager.go b/internal/controller/manager.go index bc0d01157..2672a7fae 100644 --- a/internal/controller/manager.go +++ b/internal/controller/manager.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/tinkerbell/tink/api/v1alpha1" - "github.com/tinkerbell/tink/internal/workflow" + "github.com/tinkerbell/tink/internal/obsolete/workflow" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" diff --git a/internal/workflow/convert.go b/internal/obsolete/workflow/convert.go similarity index 100% rename from internal/workflow/convert.go rename to internal/obsolete/workflow/convert.go diff --git a/internal/workflow/convert_test.go b/internal/obsolete/workflow/convert_test.go similarity index 100% rename from internal/workflow/convert_test.go rename to internal/obsolete/workflow/convert_test.go diff --git a/internal/workflow/reconciler.go b/internal/obsolete/workflow/reconciler.go similarity index 100% rename from internal/workflow/reconciler.go rename to internal/obsolete/workflow/reconciler.go diff --git a/internal/workflow/reconciler_test.go b/internal/obsolete/workflow/reconciler_test.go similarity index 100% rename from internal/workflow/reconciler_test.go rename to internal/obsolete/workflow/reconciler_test.go diff --git a/internal/workflow/template_funcs.go b/internal/obsolete/workflow/template_funcs.go similarity index 100% rename from internal/workflow/template_funcs.go rename to internal/obsolete/workflow/template_funcs.go diff --git a/internal/workflow/template_validator.go b/internal/obsolete/workflow/template_validator.go similarity index 100% rename from internal/workflow/template_validator.go rename to internal/obsolete/workflow/template_validator.go diff --git a/internal/workflow/template_validator_test.go b/internal/obsolete/workflow/template_validator_test.go similarity index 100% rename from internal/workflow/template_validator_test.go rename to internal/obsolete/workflow/template_validator_test.go diff --git a/internal/workflow/types.go b/internal/obsolete/workflow/types.go similarity index 100% rename from internal/workflow/types.go rename to internal/obsolete/workflow/types.go diff --git a/internal/server/kubernetes_api_workflow.go b/internal/server/kubernetes_api_workflow.go index 17e7fdff1..1fd0719ee 100644 --- a/internal/server/kubernetes_api_workflow.go +++ b/internal/server/kubernetes_api_workflow.go @@ -5,8 +5,8 @@ import ( "github.com/pkg/errors" "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/obsolete/workflow" "github.com/tinkerbell/tink/internal/proto" - "github.com/tinkerbell/tink/internal/workflow" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/agent/workflow/workflow.go b/internal/workflow/workflow.go similarity index 100% rename from internal/agent/workflow/workflow.go rename to internal/workflow/workflow.go