diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 8541464a7..000000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -deploy diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 6b7a5eea1..000000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_size = 2 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true - -[{Makefile,go.mod,go.sum,*.go,.gitmodules,*.sh,*.mk}] -indent_size = 8 -indent_style = tab - -[*.md] -indent_size = 4 diff --git a/.envrc b/.envrc deleted file mode 100644 index 1803c46ea..000000000 --- a/.envrc +++ /dev/null @@ -1,6 +0,0 @@ -has nix && use nix -dotenv_if_exists -PATH_add bin -path_add GOBIN bin - -export TINKERBELL_GRPC_AUTHORITY=127.0.0.1:42113 diff --git a/.golangci.yml b/.golangci.yml index 6a60d6b07..9e9854253 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -174,8 +174,8 @@ issues: linters: - noctx # local to tink: kubebuilder needs the stdlib invalid `inline` json struct tag - - path: pkg/apis/.* - text: "struct-tag" + - path: api/.* + text: "struct-tag: unknown option 'inline'" - path: main\.go linters: - noctx diff --git a/Makefile b/Makefile index 0d4ce258b..9c562fced 100644 --- a/Makefile +++ b/Makefile @@ -95,18 +95,18 @@ test: ## Run tests source <($(SETUP_ENVTEST) use -p env) && $(GO) test -coverprofile=coverage.txt ./... .PHONY: generate-proto -generate-proto: buf.gen.yaml buf.lock $(shell git ls-files 'protos/*/*.proto') _protoc +generate-proto: buf.gen.yaml buf.lock $(shell git ls-files '**/*.proto') _protoc $(BUF) mod update $(BUF) generate - $(GOFUMPT) -w protos/*/*.pb.* + $(GOFUMPT) -w internal/proto/*.pb.* .PHONY: generate generate: generate-proto generate-go generate-manifests ## Generate code, manifests etc. .PHONY: generate-go generate-go: - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./pkg/apis/..." - $(GOFUMPT) -w ./pkg/apis + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./api/..." + $(GOFUMPT) -w ./api .PHONY: generate-manifests generate-manifests: generate-crds generate-rbacs generate-server-rbacs ## Generate manifests e.g. CRD, RBAC etc. @@ -114,7 +114,7 @@ generate-manifests: generate-crds generate-rbacs generate-server-rbacs ## Genera .PHONY: generate-crds generate-crds: $(CONTROLLER_GEN) \ - paths=./pkg/apis/... \ + paths=./api/... \ crd:crdVersions=v1 \ rbac:roleName=manager-role \ output:crd:dir=./config/crd/bases \ @@ -123,17 +123,17 @@ generate-crds: $(YAMLFMT) ./config/crd/bases/* ./config/webhook/* .PHONY: generate-rbacs -generate-rbacs: +generate-rbacs: $(CONTROLLER_GEN) \ - paths=./pkg/controllers/... \ + paths=./internal/controller/... \ output:rbac:dir=./config/rbac/ \ rbac:roleName=manager-role $(YAMLFMT) ./config/rbac/* .PHONY: generate-server-rbacs -generate-server-rbacs: +generate-server-rbacs: $(CONTROLLER_GEN) \ - paths=./server/... \ + paths=./internal/server/... \ output:rbac:dir=./config/server-rbac \ rbac:roleName=server-role $(YAMLFMT) ./config/server-rbac/* @@ -168,9 +168,9 @@ check-generated: check-proto ## Check if generated files are up to date. .PHONY: check-proto check-proto: generate-proto - @git diff --no-ext-diff --quiet --exit-code -- protos/*/*.pb.* || ( + @git diff --no-ext-diff --quiet --exit-code -- **/*.pb.* || ( echo "Protobuf files need to be regenerated!"; - git diff --no-ext-diff --exit-code -- protos/*/*.pb.* + git diff --no-ext-diff --exit-code -- **/*.pb.* ) .PHONY: verify diff --git a/pkg/apis/core/v1alpha1/doc.go b/api/v1alpha1/doc.go similarity index 100% rename from pkg/apis/core/v1alpha1/doc.go rename to api/v1alpha1/doc.go diff --git a/pkg/apis/core/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go similarity index 100% rename from pkg/apis/core/v1alpha1/groupversion_info.go rename to api/v1alpha1/groupversion_info.go diff --git a/pkg/apis/core/v1alpha1/hardware_methods.go b/api/v1alpha1/hardware_methods.go similarity index 100% rename from pkg/apis/core/v1alpha1/hardware_methods.go rename to api/v1alpha1/hardware_methods.go diff --git a/pkg/apis/core/v1alpha1/hardware_test.go b/api/v1alpha1/hardware_test.go similarity index 100% rename from pkg/apis/core/v1alpha1/hardware_test.go rename to api/v1alpha1/hardware_test.go diff --git a/pkg/apis/core/v1alpha1/hardware_types.go b/api/v1alpha1/hardware_types.go similarity index 100% rename from pkg/apis/core/v1alpha1/hardware_types.go rename to api/v1alpha1/hardware_types.go diff --git a/pkg/apis/core/v1alpha1/template_methods.go b/api/v1alpha1/template_methods.go similarity index 100% rename from pkg/apis/core/v1alpha1/template_methods.go rename to api/v1alpha1/template_methods.go diff --git a/pkg/apis/core/v1alpha1/template_test.go b/api/v1alpha1/template_test.go similarity index 100% rename from pkg/apis/core/v1alpha1/template_test.go rename to api/v1alpha1/template_test.go diff --git a/pkg/apis/core/v1alpha1/template_types.go b/api/v1alpha1/template_types.go similarity index 100% rename from pkg/apis/core/v1alpha1/template_types.go rename to api/v1alpha1/template_types.go diff --git a/pkg/apis/core/v1alpha1/workflow_methods.go b/api/v1alpha1/workflow_methods.go similarity index 100% rename from pkg/apis/core/v1alpha1/workflow_methods.go rename to api/v1alpha1/workflow_methods.go diff --git a/pkg/apis/core/v1alpha1/workflow_test.go b/api/v1alpha1/workflow_test.go similarity index 100% rename from pkg/apis/core/v1alpha1/workflow_test.go rename to api/v1alpha1/workflow_test.go diff --git a/pkg/apis/core/v1alpha1/workflow_types.go b/api/v1alpha1/workflow_types.go similarity index 100% rename from pkg/apis/core/v1alpha1/workflow_types.go rename to api/v1alpha1/workflow_types.go diff --git a/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from pkg/apis/core/v1alpha1/zz_generated.deepcopy.go rename to api/v1alpha1/zz_generated.deepcopy.go diff --git a/ci-checks.sh b/ci-checks.sh index 5557234c3..43a7f9436 100755 --- a/ci-checks.sh +++ b/ci-checks.sh @@ -7,12 +7,12 @@ set -eux failed=0 # spell-checks only language files to avoid spell-checking checksums -if ! git ls-files '*.sh' '*.go' '*.md' | xargs codespell -q 3 -I .codespell-whitelist; then +if ! git ls-files '*.sh' '*.go' | xargs codespell -q 3 -I .codespell-whitelist; then failed=1 fi # --check doesn't show what line number fails, so write the result to disk for the diff to catch -if ! git ls-files '*.json' '*.md' | xargs prettier --list-different --write; then +if ! git ls-files '*.json' | xargs prettier --list-different --write; then failed=1 fi diff --git a/cmd/tink-controller/main.go b/cmd/tink-controller/main.go index 62eb515a2..ae7ce9b94 100644 --- a/cmd/tink-controller/main.go +++ b/cmd/tink-controller/main.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" - "github.com/tinkerbell/tink/pkg/controllers" - wfctrl "github.com/tinkerbell/tink/pkg/controllers/workflow" + "github.com/tinkerbell/tink/internal/controller" + "github.com/tinkerbell/tink/internal/workflow" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -72,16 +72,16 @@ func NewRootCommand(config *DaemonConfig, logger log.Logger) *cobra.Command { if err != nil { return err } - options := controllers.GetControllerOptions() + options := controller.GetControllerOptions() options.LeaderElectionNamespace = namespace - manager, err := controllers.NewManager(cfg, options) + manager, err := controller.NewManager(cfg, options) if err != nil { return err } return manager.RegisterControllers( cmd.Context(), - wfctrl.NewController(manager.GetClient()), + workflow.NewController(manager.GetClient()), ).Start(cmd.Context()) }, } diff --git a/cmd/tink-worker/cmd/root.go b/cmd/tink-worker/cmd/root.go index cf01723de..24fc647c3 100644 --- a/cmd/tink-worker/cmd/root.go +++ b/cmd/tink-worker/cmd/root.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/viper" "github.com/tinkerbell/tink/cmd/tink-worker/worker" "github.com/tinkerbell/tink/internal/client" - "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) const ( @@ -51,7 +51,7 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { if err != nil { return err } - workflowClient := workflow.NewWorkflowServiceClient(conn) + workflowClient := proto.NewWorkflowServiceClient(conn) dockerClient, err := dockercli.NewClientWithOpts(dockercli.FromEnv, dockercli.WithAPIVersionNegotiation()) if err != nil { diff --git a/cmd/tink-worker/worker/container_manager.go b/cmd/tink-worker/worker/container_manager.go index 8f25ab102..2188997b2 100644 --- a/cmd/tink-worker/worker/container_manager.go +++ b/cmd/tink-worker/worker/container_manager.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/client" "github.com/packethost/pkg/log" "github.com/pkg/errors" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) const ( @@ -49,7 +49,7 @@ func NewContainerManager(logger log.Logger, cli DockerClient, registryDetails Re return &containerManager{logger, cli, registryDetails} } -func (m *containerManager) CreateContainer(ctx context.Context, cmd []string, wfID string, action *pb.WorkflowAction, captureLogs, privileged bool) (string, error) { +func (m *containerManager) CreateContainer(ctx context.Context, cmd []string, wfID string, action *proto.WorkflowAction, captureLogs, privileged bool) (string, error) { l := m.getLogger(ctx) config := &container.Config{ Image: path.Join(m.registryDetails.Registry, action.GetImage()), @@ -98,10 +98,10 @@ func (m *containerManager) StartContainer(ctx context.Context, id string) error return errors.Wrap(m.cli.ContainerStart(ctx, id, types.ContainerStartOptions{}), "DOCKER START") } -func (m *containerManager) WaitForContainer(ctx context.Context, id string) (pb.State, error) { +func (m *containerManager) WaitForContainer(ctx context.Context, id string) (proto.State, error) { // Inspect whether the container is in running state if _, err := m.cli.ContainerInspect(ctx, id); err != nil { - return pb.State_STATE_FAILED, nil //nolint:nilerr // error is not nil, but it returns nil + return proto.State_STATE_FAILED, nil //nolint:nilerr // error is not nil, but it returns nil } // send API call to wait for the container completion @@ -110,17 +110,17 @@ func (m *containerManager) WaitForContainer(ctx context.Context, id string) (pb. select { case status := <-wait: if status.StatusCode == 0 { - return pb.State_STATE_SUCCESS, nil + return proto.State_STATE_SUCCESS, nil } - return pb.State_STATE_FAILED, nil + return proto.State_STATE_FAILED, nil case err := <-errC: - return pb.State_STATE_FAILED, err + return proto.State_STATE_FAILED, err case <-ctx.Done(): - return pb.State_STATE_TIMEOUT, ctx.Err() + return proto.State_STATE_TIMEOUT, ctx.Err() } } -func (m *containerManager) WaitForFailedContainer(ctx context.Context, id string, failedActionStatus chan pb.State) { +func (m *containerManager) WaitForFailedContainer(ctx context.Context, id string, failedActionStatus chan proto.State) { l := m.getLogger(ctx) // send API call to wait for the container completion wait, errC := m.cli.ContainerWait(ctx, id, container.WaitConditionNotRunning) @@ -128,16 +128,16 @@ func (m *containerManager) WaitForFailedContainer(ctx context.Context, id string select { case status := <-wait: if status.StatusCode == 0 { - failedActionStatus <- pb.State_STATE_SUCCESS + failedActionStatus <- proto.State_STATE_SUCCESS return } - failedActionStatus <- pb.State_STATE_FAILED + failedActionStatus <- proto.State_STATE_FAILED case err := <-errC: l.Error(err) - failedActionStatus <- pb.State_STATE_FAILED + failedActionStatus <- proto.State_STATE_FAILED case <-ctx.Done(): l.Error(ctx.Err()) - failedActionStatus <- pb.State_STATE_TIMEOUT + failedActionStatus <- proto.State_STATE_TIMEOUT } } diff --git a/cmd/tink-worker/worker/container_manager_test.go b/cmd/tink-worker/worker/container_manager_test.go index 330524c57..347e9a804 100644 --- a/cmd/tink-worker/worker/container_manager_test.go +++ b/cmd/tink-worker/worker/container_manager_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/client" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/packethost/pkg/log" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) type fakeDockerClient struct { @@ -91,7 +91,7 @@ func TestContainerManagerCreate(t *testing.T) { cases := []struct { name string workflowName string - action *pb.WorkflowAction + action *proto.WorkflowAction containerID string registry string clientErr error @@ -100,7 +100,7 @@ func TestContainerManagerCreate(t *testing.T) { { name: "Happy Path", workflowName: "saveTheRebelBase", - action: &pb.WorkflowAction{ + action: &proto.WorkflowAction{ TaskName: "UseTheForce", Name: "blow up the death star", Image: "yav.in/4/forestmoon", @@ -114,7 +114,7 @@ func TestContainerManagerCreate(t *testing.T) { { name: "create failure", workflowName: "saveTheRebelBase", - action: &pb.WorkflowAction{ + action: &proto.WorkflowAction{ TaskName: "UseTheForce", Name: "blow up the death star", Image: "yav.in/4/forestmoon", @@ -206,41 +206,41 @@ func TestContainerManagerWait(t *testing.T) { contextTimeout time.Duration clientErr error waitErr error - wantState pb.State + wantState proto.State wantErr error }{ { name: "Happy Path", containerID: "nomedalforchewie", dockerResponse: 0, - wantState: pb.State_STATE_SUCCESS, + wantState: proto.State_STATE_SUCCESS, }, { name: "start failure", containerID: "chewieDied", dockerResponse: 1, - wantState: pb.State_STATE_FAILED, + wantState: proto.State_STATE_FAILED, waitErr: nil, }, { name: "client wait failure", containerID: "nomedalforchewie", dockerResponse: 1, - wantState: pb.State_STATE_FAILED, + wantState: proto.State_STATE_FAILED, waitErr: errors.New("Vader Won"), wantErr: errors.New("Vader Won"), }, { name: "client inspect failure", containerID: "nomedalforchewie", - wantState: pb.State_STATE_FAILED, + wantState: proto.State_STATE_FAILED, clientErr: errors.New("inspect failed"), wantErr: nil, }, { name: "client timeout", containerID: "nomedalforchewie", - wantState: pb.State_STATE_TIMEOUT, + wantState: proto.State_STATE_TIMEOUT, contextTimeout: time.Millisecond * 2, waitErr: errors.New("Vader Won"), wantErr: errors.New("context deadline exceeded"), @@ -285,33 +285,33 @@ func TestContainerManagerWaitFailed(t *testing.T) { contextTimeout time.Duration waitTime time.Duration clientErr error - wantState pb.State + wantState proto.State }{ { name: "Happy Path", containerID: "nomedalforchewie", dockerResponse: 0, waitTime: 0, - wantState: pb.State_STATE_SUCCESS, + wantState: proto.State_STATE_SUCCESS, }, { name: "start failure", containerID: "chewieDied", dockerResponse: 1, - wantState: pb.State_STATE_FAILED, + wantState: proto.State_STATE_FAILED, clientErr: nil, }, { name: "client wait failure", containerID: "nomedalforchewie", dockerResponse: 1, - wantState: pb.State_STATE_FAILED, + wantState: proto.State_STATE_FAILED, clientErr: errors.New("Vader Won"), }, { name: "client timeout", containerID: "nomedalforchewie", - wantState: pb.State_STATE_TIMEOUT, + wantState: proto.State_STATE_TIMEOUT, waitTime: time.Millisecond * 20, contextTimeout: time.Millisecond * 10, clientErr: errors.New("Vader Won"), @@ -327,7 +327,7 @@ func TestContainerManagerWaitFailed(t *testing.T) { if tc.contextTimeout == 0 { ctx = context.Background() } - failedChan := make(chan pb.State) + failedChan := make(chan proto.State) go mgr.WaitForFailedContainer(ctx, tc.containerID, failedChan) got := <-failedChan diff --git a/cmd/tink-worker/worker/worker.go b/cmd/tink-worker/worker/worker.go index 0eed69816..4daef36d6 100644 --- a/cmd/tink-worker/worker/worker.go +++ b/cmd/tink-worker/worker/worker.go @@ -9,7 +9,7 @@ import ( "github.com/packethost/pkg/log" "github.com/pkg/errors" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) const ( @@ -81,10 +81,10 @@ type LogCapturer interface { // ContainerManager manages linux containers for Tinkerbell workers. type ContainerManager interface { - CreateContainer(ctx context.Context, cmd []string, wfID string, action *pb.WorkflowAction, captureLogs, privileged bool) (string, error) + CreateContainer(ctx context.Context, cmd []string, wfID string, action *proto.WorkflowAction, captureLogs, privileged bool) (string, error) StartContainer(ctx context.Context, id string) error - WaitForContainer(ctx context.Context, id string) (pb.State, error) - WaitForFailedContainer(ctx context.Context, id string, failedActionStatus chan pb.State) + WaitForContainer(ctx context.Context, id string) (proto.State, error) + WaitForFailedContainer(ctx context.Context, id string, failedActionStatus chan proto.State) RemoveContainer(ctx context.Context, id string) error PullImage(ctx context.Context, image string) error } @@ -94,7 +94,7 @@ type Worker struct { workerID string logCapturer LogCapturer containerManager ContainerManager - tinkClient pb.WorkflowServiceClient + tinkClient proto.WorkflowServiceClient logger log.Logger dataDir string @@ -110,7 +110,7 @@ type Worker struct { // NewWorker creates a new Worker, creating a new Docker registry client. func NewWorker( workerID string, - tinkClient pb.WorkflowServiceClient, + tinkClient proto.WorkflowServiceClient, containerManager ContainerManager, logCapturer LogCapturer, logger log.Logger, @@ -148,16 +148,16 @@ func (w Worker) getLogger(ctx context.Context) *log.Logger { } // execute executes a workflow action, optionally capturing logs. -func (w *Worker) execute(ctx context.Context, wfID string, action *pb.WorkflowAction) (pb.State, error) { +func (w *Worker) execute(ctx context.Context, wfID string, action *proto.WorkflowAction) (proto.State, error) { l := w.getLogger(ctx).With("workflowID", wfID, "workerID", action.GetWorkerId(), "actionName", action.GetName(), "actionImage", action.GetImage()) if err := w.containerManager.PullImage(ctx, action.GetImage()); err != nil { - return pb.State_STATE_RUNNING, errors.Wrap(err, "pull image") + return proto.State_STATE_RUNNING, errors.Wrap(err, "pull image") } id, err := w.containerManager.CreateContainer(ctx, action.Command, wfID, action, w.captureLogs, w.createPrivileged) if err != nil { - return pb.State_STATE_RUNNING, errors.Wrap(err, "create container") + return proto.State_STATE_RUNNING, errors.Wrap(err, "create container") } l.With("containerID", id, "command", action.Command).Info("container created") @@ -174,7 +174,7 @@ func (w *Worker) execute(ctx context.Context, wfID string, action *pb.WorkflowAc err = w.containerManager.StartContainer(timeCtx, id) if err != nil { - return pb.State_STATE_RUNNING, errors.Wrap(err, "start container") + return proto.State_STATE_RUNNING, errors.Wrap(err, "start container") } if w.captureLogs { @@ -198,12 +198,12 @@ func (w *Worker) execute(ctx context.Context, wfID string, action *pb.WorkflowAc return st, errors.Wrap(err, "wait container") } - if st == pb.State_STATE_SUCCESS { + if st == proto.State_STATE_SUCCESS { l.With("status", st).Info("action container exited with success") return st, nil } - if st == pb.State_STATE_TIMEOUT && action.OnTimeout != nil { + if st == proto.State_STATE_TIMEOUT && action.OnTimeout != nil { rst := w.executeReaction(ctx, st.String(), action.OnTimeout, wfID, action) l.With("status", rst).Info("action timeout") } else if action.OnFailure != nil { @@ -221,7 +221,7 @@ func (w *Worker) execute(ctx context.Context, wfID string, action *pb.WorkflowAc } // executeReaction executes special case OnTimeout/OnFailure actions. -func (w *Worker) executeReaction(ctx context.Context, reaction string, cmd []string, wfID string, action *pb.WorkflowAction) pb.State { +func (w *Worker) executeReaction(ctx context.Context, reaction string, cmd []string, wfID string, action *proto.WorkflowAction) proto.State { l := w.getLogger(ctx) id, err := w.containerManager.CreateContainer(ctx, cmd, wfID, action, w.captureLogs, w.createPrivileged) if err != nil { @@ -233,7 +233,7 @@ func (w *Worker) executeReaction(ctx context.Context, reaction string, cmd []str go w.logCapturer.CaptureLogs(ctx, id) } - st := make(chan pb.State) + st := make(chan proto.State) go w.containerManager.WaitForFailedContainer(ctx, id, st) err = w.containerManager.StartContainer(ctx, id) @@ -255,7 +255,7 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { return nil default: } - res, err := w.tinkClient.GetWorkflowContexts(ctx, &pb.WorkflowContextRequest{WorkerId: w.workerID}) + res, err := w.tinkClient.GetWorkflowContexts(ctx, &proto.WorkflowContextRequest{WorkerId: w.workerID}) if err != nil { l.Error(errors.Wrap(err, errGetWfContext)) <-time.After(w.retryInterval) @@ -279,7 +279,7 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { l = l.With("workflowID", wfID) ctx := context.WithValue(ctx, loggingContextKey, &l) - actions, err := w.tinkClient.GetWorkflowActions(ctx, &pb.WorkflowActionsRequest{WorkflowId: wfID}) + actions, err := w.tinkClient.GetWorkflowActions(ctx, &proto.WorkflowActionsRequest{WorkflowId: wfID}) if err != nil { l.Error(errors.Wrap(err, errGetWfActions)) continue @@ -287,7 +287,7 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { turn := false actionIndex := 0 - var nextAction *pb.WorkflowAction + var nextAction *proto.WorkflowAction if wfContext.GetCurrentAction() == "" { if actions.GetActionList()[0].GetWorkerId() == w.workerID { actionIndex = 0 @@ -295,15 +295,15 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { } } else { switch wfContext.GetCurrentActionState() { - case pb.State_STATE_SUCCESS: + case proto.State_STATE_SUCCESS: if isLastAction(wfContext, actions) { continue } nextAction = actions.GetActionList()[wfContext.GetCurrentActionIndex()+1] actionIndex = int(wfContext.GetCurrentActionIndex()) + 1 - case pb.State_STATE_FAILED: + case proto.State_STATE_FAILED: continue - case pb.State_STATE_TIMEOUT: + case proto.State_STATE_TIMEOUT: continue default: nextAction = actions.GetActionList()[wfContext.GetCurrentActionIndex()] @@ -322,12 +322,12 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { "taskName", action.GetTaskName(), ) ctx := context.WithValue(ctx, loggingContextKey, &l) - if wfContext.GetCurrentActionState() != pb.State_STATE_RUNNING { - actionStatus := &pb.WorkflowActionStatus{ + if wfContext.GetCurrentActionState() != proto.State_STATE_RUNNING { + actionStatus := &proto.WorkflowActionStatus{ WorkflowId: wfID, TaskName: action.GetTaskName(), ActionName: action.GetName(), - ActionStatus: pb.State_STATE_RUNNING, + ActionStatus: proto.State_STATE_RUNNING, Seconds: 0, Message: "Started execution", WorkerId: action.GetWorkerId(), @@ -341,7 +341,7 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { st, err := w.execute(ctx, wfID, action) elapsed := time.Since(start) - actionStatus := &pb.WorkflowActionStatus{ + actionStatus := &proto.WorkflowActionStatus{ WorkflowId: wfID, TaskName: action.GetTaskName(), ActionName: action.GetName(), @@ -349,11 +349,11 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { WorkerId: action.GetWorkerId(), } - if err != nil || st != pb.State_STATE_SUCCESS { - if st == pb.State_STATE_TIMEOUT { - actionStatus.ActionStatus = pb.State_STATE_TIMEOUT + if err != nil || st != proto.State_STATE_SUCCESS { + if st == proto.State_STATE_TIMEOUT { + actionStatus.ActionStatus = proto.State_STATE_TIMEOUT } else { - actionStatus.ActionStatus = pb.State_STATE_FAILED + actionStatus.ActionStatus = proto.State_STATE_FAILED } l = l.With("actionStatus", actionStatus.ActionStatus.String()) l.Error(err) @@ -361,7 +361,7 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { break } - actionStatus.ActionStatus = pb.State_STATE_SUCCESS + actionStatus.ActionStatus = proto.State_STATE_SUCCESS actionStatus.Message = "finished execution successfully" w.reportActionStatus(ctx, l, actionStatus) l.Info("sent action status") @@ -386,12 +386,12 @@ func (w *Worker) ProcessWorkflowActions(ctx context.Context) error { } } -func isLastAction(wfContext *pb.WorkflowContext, actions *pb.WorkflowActionList) bool { +func isLastAction(wfContext *proto.WorkflowContext, actions *proto.WorkflowActionList) bool { return int(wfContext.GetCurrentActionIndex()) == len(actions.GetActionList())-1 } // reportActionStatus reports the status of an action to the Tinkerbell server and retries forever on error. -func (w *Worker) reportActionStatus(ctx context.Context, l log.Logger, actionStatus *pb.WorkflowActionStatus) { +func (w *Worker) reportActionStatus(ctx context.Context, l log.Logger, actionStatus *proto.WorkflowActionStatus) { for { l.Info("reporting Action Status") _, err := w.tinkClient.ReportActionStatus(ctx, actionStatus) diff --git a/cmd/virtual-worker/cmd/root.go b/cmd/virtual-worker/cmd/root.go index 86efc0f15..24ede6a85 100644 --- a/cmd/virtual-worker/cmd/root.go +++ b/cmd/virtual-worker/cmd/root.go @@ -12,7 +12,7 @@ import ( tinkWorker "github.com/tinkerbell/tink/cmd/tink-worker/worker" "github.com/tinkerbell/tink/cmd/virtual-worker/worker" "github.com/tinkerbell/tink/internal/client" - "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) const ( @@ -47,7 +47,7 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { if err != nil { return err } - workflowClient := workflow.NewWorkflowServiceClient(conn) + workflowClient := proto.NewWorkflowServiceClient(conn) containerManager := worker.NewFakeContainerManager(logger, sleepMin, sleepJitter) logCapturer := worker.NewEmptyLogCapturer() diff --git a/cmd/virtual-worker/worker/container_manager.go b/cmd/virtual-worker/worker/container_manager.go index 3be3b7fa9..b0ed0f832 100644 --- a/cmd/virtual-worker/worker/container_manager.go +++ b/cmd/virtual-worker/worker/container_manager.go @@ -7,7 +7,7 @@ import ( "github.com/packethost/pkg/log" "github.com/tinkerbell/tink/cmd/tink-worker/worker" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/proto" ) func getRandHexStr(r *rand.Rand, length int) string { @@ -51,7 +51,7 @@ func NewFakeContainerManager(l log.Logger, sleepMinimum, sleepJitter time.Durati } } -func (m *fakeManager) CreateContainer(_ context.Context, cmd []string, _ string, _ *pb.WorkflowAction, _, _ bool) (string, error) { +func (m *fakeManager) CreateContainer(_ context.Context, cmd []string, _ string, _ *proto.WorkflowAction, _, _ bool) (string, error) { m.logger.With("command", cmd).Info("creating container") return getRandHexStr(m.r, 64), nil } @@ -61,17 +61,17 @@ func (m *fakeManager) StartContainer(_ context.Context, id string) error { return nil } -func (m *fakeManager) WaitForContainer(_ context.Context, id string) (pb.State, error) { +func (m *fakeManager) WaitForContainer(_ context.Context, id string) (proto.State, error) { m.logger.With("containerID", id).Info("waiting for container") m.sleep() - return pb.State_STATE_SUCCESS, nil + return proto.State_STATE_SUCCESS, nil } -func (m *fakeManager) WaitForFailedContainer(_ context.Context, id string, failedActionStatus chan pb.State) { +func (m *fakeManager) WaitForFailedContainer(_ context.Context, id string, failedActionStatus chan proto.State) { m.logger.With("containerID", id).Info("waiting for container") m.sleep() - failedActionStatus <- pb.State_STATE_SUCCESS + failedActionStatus <- proto.State_STATE_SUCCESS } func (m *fakeManager) RemoveContainer(_ context.Context, id string) error { diff --git a/pkg/controllers/manager.go b/internal/controller/manager.go similarity index 98% rename from pkg/controllers/manager.go rename to internal/controller/manager.go index 3389a4c2c..d549be6d4 100644 --- a/pkg/controllers/manager.go +++ b/internal/controller/manager.go @@ -1,11 +1,11 @@ -package controllers +package controller import ( "context" "fmt" "github.com/go-logr/zapr" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" + "github.com/tinkerbell/tink/api/v1alpha1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" diff --git a/pkg/controllers/manager_test.go b/internal/controller/manager_test.go similarity index 98% rename from pkg/controllers/manager_test.go rename to internal/controller/manager_test.go index f53a3d016..1ac71af1d 100644 --- a/pkg/controllers/manager_test.go +++ b/internal/controller/manager_test.go @@ -1,10 +1,10 @@ -package controllers +package controller import ( "reflect" "testing" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" + "github.com/tinkerbell/tink/api/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/controllers/types.go b/internal/controller/types.go similarity index 97% rename from pkg/controllers/types.go rename to internal/controller/types.go index 47f1555c7..7f0ea07c3 100644 --- a/pkg/controllers/types.go +++ b/internal/controller/types.go @@ -1,4 +1,4 @@ -package controllers +package controller import ( "context" diff --git a/internal/e2e/e2e_test.go b/internal/e2e/e2e_test.go index 749a7c94e..aa276cc1b 100644 --- a/internal/e2e/e2e_test.go +++ b/internal/e2e/e2e_test.go @@ -9,14 +9,13 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/tinkerbell/tink/api/v1alpha1" "github.com/tinkerbell/tink/cmd/tink-worker/worker" - virtWorker "github.com/tinkerbell/tink/cmd/virtual-worker/worker" + virtualworker "github.com/tinkerbell/tink/cmd/virtual-worker/worker" "github.com/tinkerbell/tink/internal/client" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - pb "github.com/tinkerbell/tink/protos/workflow" - "google.golang.org/protobuf/proto" + "github.com/tinkerbell/tink/internal/proto" + googleproto "google.golang.org/protobuf/proto" "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/yaml" ) @@ -86,10 +85,10 @@ var _ = Describe("Tink API", func() { By("Running a virtual worker") conn, err := client.NewClientConn(serverAddr, false) Expect(err).NotTo(HaveOccurred()) - rClient := pb.NewWorkflowServiceClient(conn) + rClient := proto.NewWorkflowServiceClient(conn) - containerManager := virtWorker.NewFakeContainerManager(logger, time.Millisecond*100, time.Millisecond*200) - logCapturer := virtWorker.NewEmptyLogCapturer() + containerManager := virtualworker.NewFakeContainerManager(logger, time.Millisecond*100, time.Millisecond*200) + logCapturer := virtualworker.NewEmptyLogCapturer() workerID := hardware.Spec.Interfaces[0].DHCP.MAC w := worker.NewWorker( workerID, @@ -156,20 +155,20 @@ var _ = Describe("Tink API", func() { By("Getting Workflow Contexts") conn, err := client.NewClientConn(serverAddr, false) Expect(err).NotTo(HaveOccurred()) - rClient := pb.NewWorkflowServiceClient(conn) + rClient := proto.NewWorkflowServiceClient(conn) workerID := hardware.Spec.Interfaces[0].DHCP.MAC - res, err := rClient.GetWorkflowContexts(ctx, &pb.WorkflowContextRequest{WorkerId: workerID}) + res, err := rClient.GetWorkflowContexts(ctx, &proto.WorkflowContextRequest{WorkerId: workerID}) Expect(err).NotTo(HaveOccurred()) // expected workflow name to context mapping - expectedWorkflows := map[string]*pb.WorkflowContext{ + expectedWorkflows := map[string]*proto.WorkflowContext{ "wf1": { WorkflowId: "wf1", CurrentWorker: "3c:ec:ef:4c:4f:54", CurrentTask: "os-installation", CurrentAction: "stream-image", CurrentActionIndex: 0, - CurrentActionState: pb.State_STATE_PENDING, + CurrentActionState: proto.State_STATE_PENDING, TotalNumberOfActions: 3, }, "wf3": { @@ -178,7 +177,7 @@ var _ = Describe("Tink API", func() { CurrentTask: "task-1", CurrentAction: "task-1-action-1", CurrentActionIndex: 0, - CurrentActionState: pb.State_STATE_PENDING, + CurrentActionState: proto.State_STATE_PENDING, TotalNumberOfActions: 2, }, } @@ -189,10 +188,10 @@ var _ = Describe("Tink API", func() { if !ok { continue } - if !proto.Equal(want, got) { + if !googleproto.Equal(want, got) { fmt.Printf("Expected:\n\t%#v\nGot:\n\t%#v", want, got) } - Expect(proto.Equal(want, got)).To(Equal(true), fmt.Sprintf("Didn't find expected context for %s", got.WorkflowId)) + Expect(googleproto.Equal(want, got)).To(Equal(true), fmt.Sprintf("Didn't find expected context for %s", got.WorkflowId)) // Remove the key from the map delete(expectedWorkflows, got.WorkflowId) diff --git a/internal/e2e/tink_suite_test.go b/internal/e2e/tink_suite_test.go index f5d5cd4c6..ca6d68cd0 100644 --- a/internal/e2e/tink_suite_test.go +++ b/internal/e2e/tink_suite_test.go @@ -10,11 +10,11 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/packethost/pkg/log" + "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/controller" "github.com/tinkerbell/tink/internal/grpcserver" "github.com/tinkerbell/tink/internal/server" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - "github.com/tinkerbell/tink/pkg/controllers" - wfctrl "github.com/tinkerbell/tink/pkg/controllers/workflow" + "github.com/tinkerbell/tink/internal/workflow" "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/client" @@ -84,12 +84,12 @@ var _ = BeforeSuite(func() { logger.Info("HTTP server: ", fmt.Sprintf("%+v", serverAddr)) // Start the controller - options := controllers.GetControllerOptions() + options := controller.GetControllerOptions() options.LeaderElectionNamespace = "default" - manager, err := controllers.NewManager(cfg, options) + manager, err := controller.NewManager(cfg, options) Expect(err).NotTo(HaveOccurred()) go func() { - err := manager.RegisterControllers(ctx, wfctrl.NewController(manager.GetClient())).Start(ctx) + err := manager.RegisterControllers(ctx, workflow.NewController(manager.GetClient())).Start(ctx) Expect(err).To(BeNil()) }() }) diff --git a/internal/proto/doc.go b/internal/proto/doc.go new file mode 100644 index 000000000..c2f793f1b --- /dev/null +++ b/internal/proto/doc.go @@ -0,0 +1,6 @@ +/* +Package proto contains generated gRPC and Protobuf types for use in Tink Worker - Tink +Server communication. Maintaining the generated code separately from core packages helps maintain +a smaller surface area for those packages. +*/ +package proto diff --git a/protos/workflow/workflow.pb.go b/internal/proto/workflow.pb.go similarity index 54% rename from protos/workflow/workflow.pb.go rename to internal/proto/workflow.pb.go index 36226abcf..5db560e83 100644 --- a/protos/workflow/workflow.pb.go +++ b/internal/proto/workflow.pb.go @@ -6,9 +6,9 @@ // versions: // protoc-gen-go v1.28.1 // protoc (unknown) -// source: protos/workflow/workflow.proto +// source: internal/proto/workflow.proto -package workflow +package proto import ( reflect "reflect" @@ -84,11 +84,11 @@ func (x State) String() string { } func (State) Descriptor() protoreflect.EnumDescriptor { - return file_protos_workflow_workflow_proto_enumTypes[0].Descriptor() + return file_internal_proto_workflow_proto_enumTypes[0].Descriptor() } func (State) Type() protoreflect.EnumType { - return &file_protos_workflow_workflow_proto_enumTypes[0] + return &file_internal_proto_workflow_proto_enumTypes[0] } func (x State) Number() protoreflect.EnumNumber { @@ -97,7 +97,7 @@ func (x State) Number() protoreflect.EnumNumber { // Deprecated: Use State.Descriptor instead. func (State) EnumDescriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{0} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{0} } type Empty struct { @@ -109,7 +109,7 @@ type Empty struct { func (x *Empty) Reset() { *x = Empty{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[0] + mi := &file_internal_proto_workflow_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122,7 +122,7 @@ func (x *Empty) String() string { func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[0] + mi := &file_internal_proto_workflow_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -135,7 +135,7 @@ func (x *Empty) ProtoReflect() protoreflect.Message { // Deprecated: Use Empty.ProtoReflect.Descriptor instead. func (*Empty) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{0} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{0} } type WorkflowContextRequest struct { @@ -149,7 +149,7 @@ type WorkflowContextRequest struct { func (x *WorkflowContextRequest) Reset() { *x = WorkflowContextRequest{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[1] + mi := &file_internal_proto_workflow_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -162,7 +162,7 @@ func (x *WorkflowContextRequest) String() string { func (*WorkflowContextRequest) ProtoMessage() {} func (x *WorkflowContextRequest) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[1] + mi := &file_internal_proto_workflow_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -175,7 +175,7 @@ func (x *WorkflowContextRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowContextRequest.ProtoReflect.Descriptor instead. func (*WorkflowContextRequest) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{1} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{1} } func (x *WorkflowContextRequest) GetWorkerId() string { @@ -206,14 +206,14 @@ type WorkflowContext struct { CurrentActionIndex int64 `protobuf:"varint,5,opt,name=current_action_index,json=currentActionIndex,proto3" json:"current_action_index,omitempty"` // // The state of the current action - CurrentActionState State `protobuf:"varint,6,opt,name=current_action_state,json=currentActionState,proto3,enum=tinkerbell.tink.workflow.State" json:"current_action_state,omitempty"` + CurrentActionState State `protobuf:"varint,6,opt,name=current_action_state,json=currentActionState,proto3,enum=proto.State" json:"current_action_state,omitempty"` TotalNumberOfActions int64 `protobuf:"varint,7,opt,name=total_number_of_actions,json=totalNumberOfActions,proto3" json:"total_number_of_actions,omitempty"` } func (x *WorkflowContext) Reset() { *x = WorkflowContext{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[2] + mi := &file_internal_proto_workflow_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -226,7 +226,7 @@ func (x *WorkflowContext) String() string { func (*WorkflowContext) ProtoMessage() {} func (x *WorkflowContext) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[2] + mi := &file_internal_proto_workflow_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -239,7 +239,7 @@ func (x *WorkflowContext) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowContext.ProtoReflect.Descriptor instead. func (*WorkflowContext) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{2} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{2} } func (x *WorkflowContext) GetWorkflowId() string { @@ -304,7 +304,7 @@ type WorkflowActionsRequest struct { func (x *WorkflowActionsRequest) Reset() { *x = WorkflowActionsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[3] + mi := &file_internal_proto_workflow_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -317,7 +317,7 @@ func (x *WorkflowActionsRequest) String() string { func (*WorkflowActionsRequest) ProtoMessage() {} func (x *WorkflowActionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[3] + mi := &file_internal_proto_workflow_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -330,7 +330,7 @@ func (x *WorkflowActionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowActionsRequest.ProtoReflect.Descriptor instead. func (*WorkflowActionsRequest) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{3} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{3} } func (x *WorkflowActionsRequest) GetWorkflowId() string { @@ -353,7 +353,7 @@ type WorkflowActionList struct { func (x *WorkflowActionList) Reset() { *x = WorkflowActionList{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[4] + mi := &file_internal_proto_workflow_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -366,7 +366,7 @@ func (x *WorkflowActionList) String() string { func (*WorkflowActionList) ProtoMessage() {} func (x *WorkflowActionList) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[4] + mi := &file_internal_proto_workflow_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -379,7 +379,7 @@ func (x *WorkflowActionList) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowActionList.ProtoReflect.Descriptor instead. func (*WorkflowActionList) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{4} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{4} } func (x *WorkflowActionList) GetActionList() []*WorkflowAction { @@ -436,7 +436,7 @@ type WorkflowAction struct { func (x *WorkflowAction) Reset() { *x = WorkflowAction{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[5] + mi := &file_internal_proto_workflow_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -449,7 +449,7 @@ func (x *WorkflowAction) String() string { func (*WorkflowAction) ProtoMessage() {} func (x *WorkflowAction) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[5] + mi := &file_internal_proto_workflow_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -462,7 +462,7 @@ func (x *WorkflowAction) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowAction.ProtoReflect.Descriptor instead. func (*WorkflowAction) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{5} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{5} } func (x *WorkflowAction) GetTaskName() string { @@ -562,7 +562,7 @@ type WorkflowActionStatus struct { // // The state of the action. Those are the same described for workflow as // well. pending, running, successful and so on. - ActionStatus State `protobuf:"varint,4,opt,name=action_status,json=actionStatus,proto3,enum=tinkerbell.tink.workflow.State" json:"action_status,omitempty"` + ActionStatus State `protobuf:"varint,4,opt,name=action_status,json=actionStatus,proto3,enum=proto.State" json:"action_status,omitempty"` // // The execution time for the action Seconds int64 `protobuf:"varint,5,opt,name=seconds,proto3" json:"seconds,omitempty"` @@ -579,7 +579,7 @@ type WorkflowActionStatus struct { func (x *WorkflowActionStatus) Reset() { *x = WorkflowActionStatus{} if protoimpl.UnsafeEnabled { - mi := &file_protos_workflow_workflow_proto_msgTypes[6] + mi := &file_internal_proto_workflow_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -592,7 +592,7 @@ func (x *WorkflowActionStatus) String() string { func (*WorkflowActionStatus) ProtoMessage() {} func (x *WorkflowActionStatus) ProtoReflect() protoreflect.Message { - mi := &file_protos_workflow_workflow_proto_msgTypes[6] + mi := &file_internal_proto_workflow_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -605,7 +605,7 @@ func (x *WorkflowActionStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowActionStatus.ProtoReflect.Descriptor instead. func (*WorkflowActionStatus) Descriptor() ([]byte, []int) { - return file_protos_workflow_workflow_proto_rawDescGZIP(), []int{6} + return file_internal_proto_workflow_proto_rawDescGZIP(), []int{6} } func (x *WorkflowActionStatus) GetWorkflowId() string { @@ -664,164 +664,152 @@ func (x *WorkflowActionStatus) GetWorkerId() string { return "" } -var File_protos_workflow_workflow_proto protoreflect.FileDescriptor - -var file_protos_workflow_workflow_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, - 0x77, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x18, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, - 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x35, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x64, 0x22, 0xdf, 0x02, 0x0a, 0x0f, - 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, +var File_internal_proto_workflow_proto protoreflect.FileDescriptor + +var file_internal_proto_workflow_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x22, 0x35, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x77, 0x6f, + 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x64, 0x22, 0xcc, 0x02, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x77, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x57, 0x6f, 0x72, + 0x6b, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, + 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x3e, 0x0a, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x12, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x35, 0x0a, 0x17, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, + 0x6f, 0x66, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x39, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, + 0x64, 0x22, 0x4c, 0x0a, 0x12, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x22, + 0xb4, 0x02, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, + 0x6f, 0x75, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x09, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x09, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x77, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, + 0x6d, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, + 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0xb4, 0x02, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, - 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x77, 0x6f, 0x72, 0x6b, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, - 0x6e, 0x74, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x12, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x12, 0x51, 0x0a, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1f, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, - 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x12, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x6f, 0x66, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x39, 0x0a, - 0x16, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x22, 0x5f, 0x0a, 0x12, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x49, - 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, - 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xb4, 0x02, 0x0a, 0x0e, 0x57, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, - 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x6e, 0x5f, 0x74, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x6e, 0x54, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, - 0x6c, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x6e, 0x46, 0x61, - 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x09, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, - 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, - 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, - 0x22, 0xc7, 0x02, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, - 0x73, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x61, 0x73, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1f, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, - 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x65, 0x0a, 0x05, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x45, 0x4e, - 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, - 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, - 0x54, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, - 0x54, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x11, - 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, - 0x04, 0x32, 0xea, 0x02, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x12, 0x30, 0x2e, 0x74, - 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, - 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, - 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x76, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, - 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, - 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, - 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x2e, 0x74, 0x69, - 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x1f, 0x2e, 0x74, 0x69, - 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x2e, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x2c, - 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, 0x6e, - 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2f, 0x74, 0x69, 0x6e, 0x6b, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x73, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x62, 0x06, 0x70, 0x72, + 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x31, + 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x1b, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x65, 0x0a, + 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, + 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, + 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x11, + 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, + 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0x04, 0x32, 0xf8, 0x01, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x12, + 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x12, 0x47, 0x65, + 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x12, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, + 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, + 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, + 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2f, 0x74, 0x69, 0x6e, 0x6b, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_protos_workflow_workflow_proto_rawDescOnce sync.Once - file_protos_workflow_workflow_proto_rawDescData = file_protos_workflow_workflow_proto_rawDesc + file_internal_proto_workflow_proto_rawDescOnce sync.Once + file_internal_proto_workflow_proto_rawDescData = file_internal_proto_workflow_proto_rawDesc ) -func file_protos_workflow_workflow_proto_rawDescGZIP() []byte { - file_protos_workflow_workflow_proto_rawDescOnce.Do(func() { - file_protos_workflow_workflow_proto_rawDescData = protoimpl.X.CompressGZIP(file_protos_workflow_workflow_proto_rawDescData) +func file_internal_proto_workflow_proto_rawDescGZIP() []byte { + file_internal_proto_workflow_proto_rawDescOnce.Do(func() { + file_internal_proto_workflow_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_proto_workflow_proto_rawDescData) }) - return file_protos_workflow_workflow_proto_rawDescData + return file_internal_proto_workflow_proto_rawDescData } var ( - file_protos_workflow_workflow_proto_enumTypes = make([]protoimpl.EnumInfo, 1) - file_protos_workflow_workflow_proto_msgTypes = make([]protoimpl.MessageInfo, 7) - file_protos_workflow_workflow_proto_goTypes = []interface{}{ - (State)(0), // 0: tinkerbell.tink.workflow.State - (*Empty)(nil), // 1: tinkerbell.tink.workflow.Empty - (*WorkflowContextRequest)(nil), // 2: tinkerbell.tink.workflow.WorkflowContextRequest - (*WorkflowContext)(nil), // 3: tinkerbell.tink.workflow.WorkflowContext - (*WorkflowActionsRequest)(nil), // 4: tinkerbell.tink.workflow.WorkflowActionsRequest - (*WorkflowActionList)(nil), // 5: tinkerbell.tink.workflow.WorkflowActionList - (*WorkflowAction)(nil), // 6: tinkerbell.tink.workflow.WorkflowAction - (*WorkflowActionStatus)(nil), // 7: tinkerbell.tink.workflow.WorkflowActionStatus + file_internal_proto_workflow_proto_enumTypes = make([]protoimpl.EnumInfo, 1) + file_internal_proto_workflow_proto_msgTypes = make([]protoimpl.MessageInfo, 7) + file_internal_proto_workflow_proto_goTypes = []interface{}{ + (State)(0), // 0: proto.State + (*Empty)(nil), // 1: proto.Empty + (*WorkflowContextRequest)(nil), // 2: proto.WorkflowContextRequest + (*WorkflowContext)(nil), // 3: proto.WorkflowContext + (*WorkflowActionsRequest)(nil), // 4: proto.WorkflowActionsRequest + (*WorkflowActionList)(nil), // 5: proto.WorkflowActionList + (*WorkflowAction)(nil), // 6: proto.WorkflowAction + (*WorkflowActionStatus)(nil), // 7: proto.WorkflowActionStatus (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp } ) -var file_protos_workflow_workflow_proto_depIdxs = []int32{ - 0, // 0: tinkerbell.tink.workflow.WorkflowContext.current_action_state:type_name -> tinkerbell.tink.workflow.State - 6, // 1: tinkerbell.tink.workflow.WorkflowActionList.action_list:type_name -> tinkerbell.tink.workflow.WorkflowAction - 0, // 2: tinkerbell.tink.workflow.WorkflowActionStatus.action_status:type_name -> tinkerbell.tink.workflow.State - 8, // 3: tinkerbell.tink.workflow.WorkflowActionStatus.created_at:type_name -> google.protobuf.Timestamp - 2, // 4: tinkerbell.tink.workflow.WorkflowService.GetWorkflowContexts:input_type -> tinkerbell.tink.workflow.WorkflowContextRequest - 4, // 5: tinkerbell.tink.workflow.WorkflowService.GetWorkflowActions:input_type -> tinkerbell.tink.workflow.WorkflowActionsRequest - 7, // 6: tinkerbell.tink.workflow.WorkflowService.ReportActionStatus:input_type -> tinkerbell.tink.workflow.WorkflowActionStatus - 3, // 7: tinkerbell.tink.workflow.WorkflowService.GetWorkflowContexts:output_type -> tinkerbell.tink.workflow.WorkflowContext - 5, // 8: tinkerbell.tink.workflow.WorkflowService.GetWorkflowActions:output_type -> tinkerbell.tink.workflow.WorkflowActionList - 1, // 9: tinkerbell.tink.workflow.WorkflowService.ReportActionStatus:output_type -> tinkerbell.tink.workflow.Empty +var file_internal_proto_workflow_proto_depIdxs = []int32{ + 0, // 0: proto.WorkflowContext.current_action_state:type_name -> proto.State + 6, // 1: proto.WorkflowActionList.action_list:type_name -> proto.WorkflowAction + 0, // 2: proto.WorkflowActionStatus.action_status:type_name -> proto.State + 8, // 3: proto.WorkflowActionStatus.created_at:type_name -> google.protobuf.Timestamp + 2, // 4: proto.WorkflowService.GetWorkflowContexts:input_type -> proto.WorkflowContextRequest + 4, // 5: proto.WorkflowService.GetWorkflowActions:input_type -> proto.WorkflowActionsRequest + 7, // 6: proto.WorkflowService.ReportActionStatus:input_type -> proto.WorkflowActionStatus + 3, // 7: proto.WorkflowService.GetWorkflowContexts:output_type -> proto.WorkflowContext + 5, // 8: proto.WorkflowService.GetWorkflowActions:output_type -> proto.WorkflowActionList + 1, // 9: proto.WorkflowService.ReportActionStatus:output_type -> proto.Empty 7, // [7:10] is the sub-list for method output_type 4, // [4:7] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -829,13 +817,13 @@ var file_protos_workflow_workflow_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_protos_workflow_workflow_proto_init() } -func file_protos_workflow_workflow_proto_init() { - if File_protos_workflow_workflow_proto != nil { +func init() { file_internal_proto_workflow_proto_init() } +func file_internal_proto_workflow_proto_init() { + if File_internal_proto_workflow_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_protos_workflow_workflow_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Empty); i { case 0: return &v.state @@ -847,7 +835,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowContextRequest); i { case 0: return &v.state @@ -859,7 +847,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowContext); i { case 0: return &v.state @@ -871,7 +859,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowActionsRequest); i { case 0: return &v.state @@ -883,7 +871,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowActionList); i { case 0: return &v.state @@ -895,7 +883,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowAction); i { case 0: return &v.state @@ -907,7 +895,7 @@ func file_protos_workflow_workflow_proto_init() { return nil } } - file_protos_workflow_workflow_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_internal_proto_workflow_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorkflowActionStatus); i { case 0: return &v.state @@ -924,19 +912,19 @@ func file_protos_workflow_workflow_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_protos_workflow_workflow_proto_rawDesc, + RawDescriptor: file_internal_proto_workflow_proto_rawDesc, NumEnums: 1, NumMessages: 7, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_protos_workflow_workflow_proto_goTypes, - DependencyIndexes: file_protos_workflow_workflow_proto_depIdxs, - EnumInfos: file_protos_workflow_workflow_proto_enumTypes, - MessageInfos: file_protos_workflow_workflow_proto_msgTypes, + GoTypes: file_internal_proto_workflow_proto_goTypes, + DependencyIndexes: file_internal_proto_workflow_proto_depIdxs, + EnumInfos: file_internal_proto_workflow_proto_enumTypes, + MessageInfos: file_internal_proto_workflow_proto_msgTypes, }.Build() - File_protos_workflow_workflow_proto = out.File - file_protos_workflow_workflow_proto_rawDesc = nil - file_protos_workflow_workflow_proto_goTypes = nil - file_protos_workflow_workflow_proto_depIdxs = nil + File_internal_proto_workflow_proto = out.File + file_internal_proto_workflow_proto_rawDesc = nil + file_internal_proto_workflow_proto_goTypes = nil + file_internal_proto_workflow_proto_depIdxs = nil } diff --git a/protos/workflow/workflow.proto b/internal/proto/workflow.proto similarity index 97% rename from protos/workflow/workflow.proto rename to internal/proto/workflow.proto index 1910f4e2f..31639121a 100644 --- a/protos/workflow/workflow.proto +++ b/internal/proto/workflow.proto @@ -4,9 +4,9 @@ */ syntax = "proto3"; -option go_package = "github.com/tinkerbell/tink/protos/workflow"; +option go_package = "github.com/tinkerbell/tink/internal/proto"; -package tinkerbell.tink.workflow; +package proto; import "google/protobuf/timestamp.proto"; diff --git a/protos/workflow/workflow_grpc.pb.go b/internal/proto/workflow_grpc.pb.go similarity index 91% rename from protos/workflow/workflow_grpc.pb.go rename to internal/proto/workflow_grpc.pb.go index ad364b779..d7803e7ed 100644 --- a/protos/workflow/workflow_grpc.pb.go +++ b/internal/proto/workflow_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) -// source: protos/workflow/workflow.proto +// source: internal/proto/workflow.proto -package workflow +package proto import ( context "context" @@ -37,7 +37,7 @@ func NewWorkflowServiceClient(cc grpc.ClientConnInterface) WorkflowServiceClient } func (c *workflowServiceClient) GetWorkflowContexts(ctx context.Context, in *WorkflowContextRequest, opts ...grpc.CallOption) (WorkflowService_GetWorkflowContextsClient, error) { - stream, err := c.cc.NewStream(ctx, &WorkflowService_ServiceDesc.Streams[0], "/tinkerbell.tink.workflow.WorkflowService/GetWorkflowContexts", opts...) + stream, err := c.cc.NewStream(ctx, &WorkflowService_ServiceDesc.Streams[0], "/proto.WorkflowService/GetWorkflowContexts", opts...) if err != nil { return nil, err } @@ -70,7 +70,7 @@ func (x *workflowServiceGetWorkflowContextsClient) Recv() (*WorkflowContext, err func (c *workflowServiceClient) GetWorkflowActions(ctx context.Context, in *WorkflowActionsRequest, opts ...grpc.CallOption) (*WorkflowActionList, error) { out := new(WorkflowActionList) - err := c.cc.Invoke(ctx, "/tinkerbell.tink.workflow.WorkflowService/GetWorkflowActions", in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.WorkflowService/GetWorkflowActions", in, out, opts...) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (c *workflowServiceClient) GetWorkflowActions(ctx context.Context, in *Work func (c *workflowServiceClient) ReportActionStatus(ctx context.Context, in *WorkflowActionStatus, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, "/tinkerbell.tink.workflow.WorkflowService/ReportActionStatus", in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.WorkflowService/ReportActionStatus", in, out, opts...) if err != nil { return nil, err } @@ -152,7 +152,7 @@ func _WorkflowService_GetWorkflowActions_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/tinkerbell.tink.workflow.WorkflowService/GetWorkflowActions", + FullMethod: "/proto.WorkflowService/GetWorkflowActions", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WorkflowServiceServer).GetWorkflowActions(ctx, req.(*WorkflowActionsRequest)) @@ -170,7 +170,7 @@ func _WorkflowService_ReportActionStatus_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/tinkerbell.tink.workflow.WorkflowService/ReportActionStatus", + FullMethod: "/proto.WorkflowService/ReportActionStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WorkflowServiceServer).ReportActionStatus(ctx, req.(*WorkflowActionStatus)) @@ -182,7 +182,7 @@ func _WorkflowService_ReportActionStatus_Handler(srv interface{}, ctx context.Co // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var WorkflowService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "tinkerbell.tink.workflow.WorkflowService", + ServiceName: "proto.WorkflowService", HandlerType: (*WorkflowServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -201,5 +201,5 @@ var WorkflowService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "protos/workflow/workflow.proto", + Metadata: "internal/proto/workflow.proto", } diff --git a/internal/server/kubernetes_api.go b/internal/server/kubernetes_api.go index 52c97dd67..8242ed455 100644 --- a/internal/server/kubernetes_api.go +++ b/internal/server/kubernetes_api.go @@ -5,8 +5,8 @@ import ( "time" "github.com/packethost/pkg/log" - "github.com/tinkerbell/tink/pkg/controllers" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/internal/controller" + "github.com/tinkerbell/tink/internal/proto" "google.golang.org/grpc" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -51,9 +51,9 @@ func NewKubeBackedServer(logger log.Logger, kubeconfig, apiserver, namespace str // NewKubeBackedServerFromREST returns a server that implements the Workflow // server interface with the given Kubernetes rest client and namespace. func NewKubeBackedServerFromREST(logger log.Logger, config *rest.Config, namespace string) *KubernetesBackedServer { - options := controllers.GetServerOptions() + options := controller.GetServerOptions() options.Namespace = namespace - manager := controllers.NewManagerOrDie(config, options) + manager := controller.NewManagerOrDie(config, options) go func() { err := manager.Start(context.Background()) if err != nil { @@ -79,5 +79,5 @@ type KubernetesBackedServer struct { // Register registers the service on the gRPC server. func (s *KubernetesBackedServer) Register(server *grpc.Server) { - pb.RegisterWorkflowServiceServer(server, s) + proto.RegisterWorkflowServiceServer(server, s) } diff --git a/internal/server/kubernetes_api_test.go b/internal/server/kubernetes_api_test.go index 186660166..fdab4a07e 100644 --- a/internal/server/kubernetes_api_test.go +++ b/internal/server/kubernetes_api_test.go @@ -7,9 +7,9 @@ import ( "github.com/google/go-cmp/cmp" "github.com/packethost/pkg/log" + "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/proto" "github.com/tinkerbell/tink/internal/testtime" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - "github.com/tinkerbell/tink/protos/workflow" ) var TestTime = testtime.NewFrozenTimeUnix(1637361793) @@ -18,14 +18,14 @@ func TestModifyWorkflowState(t *testing.T) { cases := []struct { name string inputWf *v1alpha1.Workflow - inputWfContext *workflow.WorkflowContext + inputWfContext *proto.WorkflowContext want *v1alpha1.Workflow wantErr error }{ { name: "no workflow", inputWf: nil, - inputWfContext: &workflow.WorkflowContext{}, + inputWfContext: &proto.WorkflowContext{}, want: nil, wantErr: errors.New("no workflow provided"), }, @@ -58,13 +58,13 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ WorkflowId: "debian", CurrentWorker: "machine-mac-1", CurrentTask: "power-on", CurrentAction: "power-on-bmc", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_RUNNING, + CurrentActionState: proto.State_STATE_RUNNING, TotalNumberOfActions: 1, }, want: nil, @@ -92,12 +92,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "power-on-bmc", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_RUNNING, + CurrentActionState: proto.State_STATE_RUNNING, TotalNumberOfActions: 1, }, want: nil, @@ -125,12 +125,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "stream", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_RUNNING, + CurrentActionState: proto.State_STATE_RUNNING, TotalNumberOfActions: 1, }, want: &v1alpha1.Workflow{ @@ -179,12 +179,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "stream", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_TIMEOUT, + CurrentActionState: proto.State_STATE_TIMEOUT, TotalNumberOfActions: 1, }, want: &v1alpha1.Workflow{ @@ -240,12 +240,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "stream", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_FAILED, + CurrentActionState: proto.State_STATE_FAILED, TotalNumberOfActions: 2, }, want: &v1alpha1.Workflow{ @@ -307,12 +307,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "stream", CurrentActionIndex: 0, - CurrentActionState: workflow.State_STATE_SUCCESS, + CurrentActionState: proto.State_STATE_SUCCESS, TotalNumberOfActions: 2, }, want: &v1alpha1.Workflow{ @@ -375,12 +375,12 @@ func TestModifyWorkflowState(t *testing.T) { }, }, }, - inputWfContext: &workflow.WorkflowContext{ + inputWfContext: &proto.WorkflowContext{ CurrentWorker: "machine-mac-1", CurrentTask: "provision", CurrentAction: "kexec", CurrentActionIndex: 1, - CurrentActionState: workflow.State_STATE_SUCCESS, + CurrentActionState: proto.State_STATE_SUCCESS, TotalNumberOfActions: 2, }, want: &v1alpha1.Workflow{ diff --git a/internal/server/kubernetes_api_workflow.go b/internal/server/kubernetes_api_workflow.go index 9c4109daa..691a33cd3 100644 --- a/internal/server/kubernetes_api_workflow.go +++ b/internal/server/kubernetes_api_workflow.go @@ -4,10 +4,10 @@ import ( "context" "github.com/pkg/errors" - "github.com/tinkerbell/tink/internal/convert" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - "github.com/tinkerbell/tink/pkg/controllers" - pb "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/controller" + "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" @@ -23,14 +23,14 @@ const ( errInvalidActionReported = "reported action name does not match the current action details" ) -func getWorkflowContext(wf v1alpha1.Workflow) *pb.WorkflowContext { - return &pb.WorkflowContext{ +func getWorkflowContext(wf v1alpha1.Workflow) *proto.WorkflowContext { + return &proto.WorkflowContext{ WorkflowId: wf.Name, CurrentWorker: wf.GetCurrentWorker(), CurrentTask: wf.GetCurrentTask(), CurrentAction: wf.GetCurrentAction(), CurrentActionIndex: int64(wf.GetCurrentActionIndex()), - CurrentActionState: pb.State(pb.State_value[string(wf.GetCurrentActionState())]), + CurrentActionState: proto.State(proto.State_value[string(wf.GetCurrentActionState())]), TotalNumberOfActions: int64(wf.GetTotalNumberOfActions()), } } @@ -38,7 +38,7 @@ func getWorkflowContext(wf v1alpha1.Workflow) *pb.WorkflowContext { func (s *KubernetesBackedServer) getCurrentAssignedNonTerminalWorkflowsForWorker(ctx context.Context, workerID string) ([]v1alpha1.Workflow, error) { stored := &v1alpha1.WorkflowList{} err := s.ClientFunc().List(ctx, stored, &client.MatchingFields{ - controllers.WorkflowWorkerNonTerminalStateIndex: workerID, + controller.WorkflowWorkerNonTerminalStateIndex: workerID, }) if err != nil { return nil, err @@ -54,18 +54,18 @@ func (s *KubernetesBackedServer) getCurrentAssignedNonTerminalWorkflowsForWorker } func (s *KubernetesBackedServer) getWorkflowByName(ctx context.Context, workflowID, namespace string) (*v1alpha1.Workflow, error) { - workflow := &v1alpha1.Workflow{} - err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, workflow) + wflw := &v1alpha1.Workflow{} + err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, wflw) if err != nil { s.logger.With("workflow", workflowID).Error(err) return nil, err } - return workflow, nil + return wflw, nil } // The following APIs are used by the worker. -func (s *KubernetesBackedServer) GetWorkflowContexts(req *pb.WorkflowContextRequest, stream pb.WorkflowService_GetWorkflowContextsServer) error { +func (s *KubernetesBackedServer) GetWorkflowContexts(req *proto.WorkflowContextRequest, stream proto.WorkflowService_GetWorkflowContextsServer) error { if req.GetWorkerId() == "" { return status.Errorf(codes.InvalidArgument, errInvalidWorkflowID) } @@ -81,7 +81,7 @@ func (s *KubernetesBackedServer) GetWorkflowContexts(req *pb.WorkflowContextRequ return nil } -func (s *KubernetesBackedServer) GetWorkflowActions(ctx context.Context, req *pb.WorkflowActionsRequest) (*pb.WorkflowActionList, error) { +func (s *KubernetesBackedServer) GetWorkflowActions(ctx context.Context, req *proto.WorkflowActionsRequest) (*proto.WorkflowActionList, error) { wfID := req.GetWorkflowId() if wfID == "" { return nil, status.Errorf(codes.InvalidArgument, errInvalidWorkflowID) @@ -90,11 +90,11 @@ func (s *KubernetesBackedServer) GetWorkflowActions(ctx context.Context, req *pb if err != nil { return nil, err } - return convert.WorkflowActionListCRDToProto(wf), nil + return workflow.ActionListCRDToProto(wf), nil } // Modifies a workflow for a given workflowContext. -func (s *KubernetesBackedServer) modifyWorkflowState(wf *v1alpha1.Workflow, wfContext *pb.WorkflowContext) error { +func (s *KubernetesBackedServer) modifyWorkflowState(wf *v1alpha1.Workflow, wfContext *proto.WorkflowContext) error { if wf == nil { return errors.New("no workflow provided") } @@ -125,39 +125,39 @@ cont: if actionIndex < 0 { return errors.New("action not found") } - wf.Status.Tasks[taskIndex].Actions[actionIndex].Status = v1alpha1.WorkflowState(pb.State_name[int32(wfContext.CurrentActionState)]) + wf.Status.Tasks[taskIndex].Actions[actionIndex].Status = v1alpha1.WorkflowState(proto.State_name[int32(wfContext.CurrentActionState)]) switch wfContext.CurrentActionState { - case pb.State_STATE_RUNNING: + case proto.State_STATE_RUNNING: // Workflow is running, so set the start time to now - wf.Status.State = v1alpha1.WorkflowState(pb.State_name[int32(wfContext.CurrentActionState)]) + wf.Status.State = v1alpha1.WorkflowState(proto.State_name[int32(wfContext.CurrentActionState)]) wf.Status.Tasks[taskIndex].Actions[actionIndex].StartedAt = func() *metav1.Time { t := metav1.NewTime(s.nowFunc()) return &t }() - case pb.State_STATE_FAILED, pb.State_STATE_TIMEOUT: + case proto.State_STATE_FAILED, proto.State_STATE_TIMEOUT: // Handle terminal statuses by updating the workflow state and time - wf.Status.State = v1alpha1.WorkflowState(pb.State_name[int32(wfContext.CurrentActionState)]) + wf.Status.State = v1alpha1.WorkflowState(proto.State_name[int32(wfContext.CurrentActionState)]) if wf.Status.Tasks[taskIndex].Actions[actionIndex].StartedAt != nil { wf.Status.Tasks[taskIndex].Actions[actionIndex].Seconds = int64(s.nowFunc().Sub(wf.Status.Tasks[taskIndex].Actions[actionIndex].StartedAt.Time).Seconds()) } - case pb.State_STATE_SUCCESS: + case proto.State_STATE_SUCCESS: // Handle a success by marking the task as complete if wf.Status.Tasks[taskIndex].Actions[actionIndex].StartedAt != nil { wf.Status.Tasks[taskIndex].Actions[actionIndex].Seconds = int64(s.nowFunc().Sub(wf.Status.Tasks[taskIndex].Actions[actionIndex].StartedAt.Time).Seconds()) } // Mark success on last action success if wfContext.CurrentActionIndex+1 == wfContext.TotalNumberOfActions { - wf.Status.State = v1alpha1.WorkflowState(pb.State_name[int32(wfContext.CurrentActionState)]) + wf.Status.State = v1alpha1.WorkflowState(proto.State_name[int32(wfContext.CurrentActionState)]) } - case pb.State_STATE_PENDING: + case proto.State_STATE_PENDING: // This is probably a client bug? return errors.New("no update requested") } return nil } -func validateActionStatusRequest(req *pb.WorkflowActionStatus) error { +func validateActionStatusRequest(req *proto.WorkflowActionStatus) error { if req.GetWorkflowId() == "" { return status.Errorf(codes.InvalidArgument, errInvalidWorkflowID) } @@ -170,7 +170,7 @@ func validateActionStatusRequest(req *pb.WorkflowActionStatus) error { return nil } -func getWorkflowContextForRequest(req *pb.WorkflowActionStatus, wf *v1alpha1.Workflow) *pb.WorkflowContext { +func getWorkflowContextForRequest(req *proto.WorkflowActionStatus, wf *v1alpha1.Workflow) *proto.WorkflowContext { wfContext := getWorkflowContext(*wf) wfContext.CurrentWorker = req.GetWorkerId() wfContext.CurrentTask = req.GetTaskName() @@ -179,7 +179,7 @@ func getWorkflowContextForRequest(req *pb.WorkflowActionStatus, wf *v1alpha1.Wor return wfContext } -func (s *KubernetesBackedServer) ReportActionStatus(ctx context.Context, req *pb.WorkflowActionStatus) (*pb.Empty, error) { +func (s *KubernetesBackedServer) ReportActionStatus(ctx context.Context, req *proto.WorkflowActionStatus) (*proto.Empty, error) { err := validateActionStatusRequest(req) if err != nil { return nil, err @@ -211,5 +211,5 @@ func (s *KubernetesBackedServer) ReportActionStatus(ctx context.Context, req *pb l.Error(err) return nil, status.Errorf(codes.InvalidArgument, errInvalidWorkflowID) } - return &pb.Empty{}, nil + return &proto.Empty{}, nil } diff --git a/pkg/controllers/workflow/controller.go b/internal/workflow/controller.go similarity index 92% rename from pkg/controllers/workflow/controller.go rename to internal/workflow/controller.go index 31c4a57a8..8d68cfa1e 100644 --- a/pkg/controllers/workflow/controller.go +++ b/internal/workflow/controller.go @@ -6,10 +6,7 @@ import ( "time" "github.com/go-logr/logr" - "github.com/tinkerbell/tink/internal/convert" - "github.com/tinkerbell/tink/internal/workflow" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - "github.com/tinkerbell/tink/pkg/controllers" + "github.com/tinkerbell/tink/api/v1alpha1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" "knative.dev/pkg/ptr" @@ -45,7 +42,7 @@ func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reco if errors.IsNotFound(err) { return reconcile.Result{}, nil } - return controllers.RetryIfError(ctx, err) + return reconcile.Result{}, err } if !stored.DeletionTimestamp.IsZero() { return reconcile.Result{}, nil @@ -86,7 +83,7 @@ func (c *Controller) processNewWorkflow(ctx context.Context, logger logr.Logger, stored.Namespace, ) } - return controllers.RetryIfError(ctx, err) + return reconcile.Result{}, err } data := make(map[string]interface{}) @@ -115,13 +112,13 @@ func (c *Controller) processNewWorkflow(ctx context.Context, logger logr.Logger, data["Hardware"] = contract } - tinkWf, _, err := workflow.RenderTemplateHardware(stored.Name, ptr.StringValue(tpl.Spec.Data), data) + tinkWf, _, err := RenderTemplateHardware(stored.Name, ptr.StringValue(tpl.Spec.Data), data) if err != nil { return reconcile.Result{}, err } // populate Task and Action data - stored.Status = *convert.WorkflowYAMLToStatus(tinkWf) + stored.Status = *YAMLToStatus(tinkWf) stored.Status.State = v1alpha1.WorkflowStatePending return reconcile.Result{}, nil diff --git a/pkg/controllers/workflow/controller_test.go b/internal/workflow/controller_test.go similarity index 99% rename from pkg/controllers/workflow/controller_test.go rename to internal/workflow/controller_test.go index ac3b445ca..5b783ee3a 100644 --- a/pkg/controllers/workflow/controller_test.go +++ b/internal/workflow/controller_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/tinkerbell/tink/api/v1alpha1" "github.com/tinkerbell/tink/internal/testtime" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" diff --git a/internal/convert/workflow.go b/internal/workflow/convert.go similarity index 70% rename from internal/convert/workflow.go rename to internal/workflow/convert.go index fb5289bd2..3c49d9aaa 100644 --- a/internal/convert/workflow.go +++ b/internal/workflow/convert.go @@ -1,30 +1,29 @@ -package convert +package workflow import ( "fmt" "sort" - "github.com/tinkerbell/tink/internal/workflow" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - protoworkflow "github.com/tinkerbell/tink/protos/workflow" + "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/proto" ) -func WorkflowToWorkflowContext(wf *v1alpha1.Workflow) *protoworkflow.WorkflowContext { +func ToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext { if wf == nil { return nil } - return &protoworkflow.WorkflowContext{ + return &proto.WorkflowContext{ WorkflowId: wf.GetName(), CurrentWorker: wf.GetCurrentWorker(), CurrentTask: wf.GetCurrentTask(), CurrentAction: wf.GetCurrentAction(), CurrentActionIndex: int64(wf.GetCurrentActionIndex()), - CurrentActionState: protoworkflow.State(protoworkflow.State_value[string(wf.GetCurrentActionState())]), + CurrentActionState: proto.State(proto.State_value[string(wf.GetCurrentActionState())]), TotalNumberOfActions: int64(wf.GetTotalNumberOfActions()), } } -func WorkflowYAMLToStatus(wf *workflow.Workflow) *v1alpha1.WorkflowStatus { +func YAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus { if wf == nil { return nil } @@ -38,7 +37,7 @@ func WorkflowYAMLToStatus(wf *workflow.Workflow) *v1alpha1.WorkflowStatus { Timeout: action.Timeout, Command: action.Command, Volumes: action.Volumes, - Status: v1alpha1.WorkflowState(protoworkflow.State_name[int32(protoworkflow.State_STATE_PENDING)]), + Status: v1alpha1.WorkflowState(proto.State_name[int32(proto.State_STATE_PENDING)]), Environment: action.Environment, Pid: action.Pid, }) @@ -57,16 +56,16 @@ func WorkflowYAMLToStatus(wf *workflow.Workflow) *v1alpha1.WorkflowStatus { } } -func WorkflowActionListCRDToProto(wf *v1alpha1.Workflow) *protoworkflow.WorkflowActionList { +func ActionListCRDToProto(wf *v1alpha1.Workflow) *proto.WorkflowActionList { if wf == nil { return nil } - resp := &protoworkflow.WorkflowActionList{ - ActionList: []*protoworkflow.WorkflowAction{}, + resp := &proto.WorkflowActionList{ + ActionList: []*proto.WorkflowAction{}, } for _, task := range wf.Status.Tasks { for _, action := range task.Actions { - resp.ActionList = append(resp.ActionList, &protoworkflow.WorkflowAction{ + resp.ActionList = append(resp.ActionList, &proto.WorkflowAction{ TaskName: task.Name, Name: action.Name, Image: action.Image, diff --git a/internal/convert/workflow_test.go b/internal/workflow/convert_test.go similarity index 86% rename from internal/convert/workflow_test.go rename to internal/workflow/convert_test.go index 5d9c9eca4..63d4a86b2 100644 --- a/internal/convert/workflow_test.go +++ b/internal/workflow/convert_test.go @@ -1,25 +1,24 @@ -package convert +package workflow import ( "reflect" "testing" "github.com/google/go-cmp/cmp" + "github.com/tinkerbell/tink/api/v1alpha1" + "github.com/tinkerbell/tink/internal/proto" "github.com/tinkerbell/tink/internal/testtime" - "github.com/tinkerbell/tink/internal/workflow" - "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" - protoworkflow "github.com/tinkerbell/tink/protos/workflow" "google.golang.org/protobuf/testing/protocmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -var TestTime = testtime.NewFrozenTimeUnix(1637361794) +var convertTestTime = testtime.NewFrozenTimeUnix(1637361794) -func TestWorkflowToWorkflowContext(t *testing.T) { +func TestToWorkflowContext(t *testing.T) { cases := []struct { name string input *v1alpha1.Workflow - want *protoworkflow.WorkflowContext + want *proto.WorkflowContext }{ { "nil workflow", @@ -29,7 +28,7 @@ func TestWorkflowToWorkflowContext(t *testing.T) { { "empty workflow", &v1alpha1.Workflow{}, - &protoworkflow.WorkflowContext{ + &proto.WorkflowContext{ WorkflowId: "", CurrentWorker: "", CurrentTask: "", @@ -69,13 +68,13 @@ func TestWorkflowToWorkflowContext(t *testing.T) { }, }, }, - &protoworkflow.WorkflowContext{ + &proto.WorkflowContext{ WorkflowId: "wf1", CurrentWorker: "worker1", CurrentTask: "task1", CurrentAction: "action2", CurrentActionIndex: 1, - CurrentActionState: protoworkflow.State_STATE_RUNNING, + CurrentActionState: proto.State_STATE_RUNNING, TotalNumberOfActions: 2, }, }, @@ -83,7 +82,7 @@ func TestWorkflowToWorkflowContext(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowToWorkflowContext(tc.input) + got := ToWorkflowContext(tc.input) if !reflect.DeepEqual(got, tc.want) { t.Errorf("Unexpedted response: wanted\n\t%#v\ngot\n\t%#v", tc.want, got) } @@ -91,11 +90,11 @@ func TestWorkflowToWorkflowContext(t *testing.T) { } } -func TestWorkflowActionListCRDToProto(t *testing.T) { +func TestActionListCRDToProto(t *testing.T) { cases := []struct { name string input *v1alpha1.Workflow - want *protoworkflow.WorkflowActionList + want *proto.WorkflowActionList }{ { "nil arg", @@ -111,13 +110,13 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { }, ObjectMeta: metav1.ObjectMeta{ Name: "wf1", - CreationTimestamp: *TestTime.MetaV1Now(), + CreationTimestamp: *convertTestTime.MetaV1Now(), }, Spec: v1alpha1.WorkflowSpec{}, Status: v1alpha1.WorkflowStatus{}, }, - &protoworkflow.WorkflowActionList{ - ActionList: []*protoworkflow.WorkflowAction{}, + &proto.WorkflowActionList{ + ActionList: []*proto.WorkflowAction{}, }, }, { @@ -132,7 +131,7 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { Annotations: map[string]string{ "workflow.tinkerbell.org/id": "7d9031ee-18d4-4ba4-b934-c3a78a1330f6", }, - CreationTimestamp: *TestTime.MetaV1Now(), + CreationTimestamp: *convertTestTime.MetaV1Now(), }, Spec: v1alpha1.WorkflowSpec{ TemplateRef: "MyCoolWorkflow", @@ -182,8 +181,8 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { }, }, }, - &protoworkflow.WorkflowActionList{ - ActionList: []*protoworkflow.WorkflowAction{ + &proto.WorkflowActionList{ + ActionList: []*proto.WorkflowAction{ { TaskName: "worker1", Name: "stream-debian-image", @@ -230,7 +229,7 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowActionListCRDToProto(tc.input) + got := ActionListCRDToProto(tc.input) if diff := cmp.Diff(tc.want, got, protocmp.Transform()); diff != "" { t.Errorf("unexpected difference:\n%v", diff) } @@ -238,10 +237,10 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { } } -func TestWorkflowYAMLToStatus(t *testing.T) { +func TestYAMLToStatus(t *testing.T) { cases := []struct { name string - inputWf *workflow.Workflow + inputWf *Workflow want *v1alpha1.WorkflowStatus }{ { @@ -251,16 +250,16 @@ func TestWorkflowYAMLToStatus(t *testing.T) { }, { "Full crd", - &workflow.Workflow{ + &Workflow{ Version: "1", Name: "debian-provision", ID: "0a90fac9-b509-4aa5-b294-5944128ece81", GlobalTimeout: 600, - Tasks: []workflow.Task{ + Tasks: []Task{ { Name: "do-or-do-not-there-is-no-try", WorkerAddr: "00:00:53:00:53:F4", - Actions: []workflow.Action{ + Actions: []Action{ { Name: "stream-image-to-disk", Image: "quay.io/tinkerbell-actions/image2disk:v1.0.0", @@ -316,7 +315,7 @@ func TestWorkflowYAMLToStatus(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowYAMLToStatus(tc.inputWf) + got := YAMLToStatus(tc.inputWf) if diff := cmp.Diff(got, tc.want, protocmp.Transform()); diff != "" { t.Errorf("unexpected difference:\n%v", diff) } diff --git a/internal/workflow/funcs.go b/internal/workflow/template_funcs.go similarity index 100% rename from internal/workflow/funcs.go rename to internal/workflow/template_funcs.go diff --git a/internal/workflow/template_validator_test.go b/internal/workflow/template_validator_test.go index b03e03f43..b74921e92 100644 --- a/internal/workflow/template_validator_test.go +++ b/internal/workflow/template_validator_test.go @@ -155,67 +155,67 @@ func TestValidateTemplate(t *testing.T) { }{ { name: "template name is invalid", - wf: workflow(withTemplateInvalidName()), + wf: toWorkflow(withTemplateInvalidName()), expectedError: true, }, { name: "template name too long", - wf: workflow(withTemplateLongName()), + wf: toWorkflow(withTemplateLongName()), expectedError: true, }, { name: "template version is invalid", - wf: workflow(withTemplateInvalidVersion()), + wf: toWorkflow(withTemplateInvalidVersion()), expectedError: true, }, { name: "template tasks is nil", - wf: workflow(withTemplateNilTasks()), + wf: toWorkflow(withTemplateNilTasks()), expectedError: true, }, { name: "template tasks is empty", - wf: workflow(withTemplateEmptyTasks()), + wf: toWorkflow(withTemplateEmptyTasks()), expectedError: true, }, { name: "task name is invalid", - wf: workflow(withTaskInvalidName()), + wf: toWorkflow(withTaskInvalidName()), expectedError: true, }, { name: "task name is too long", - wf: workflow(withTaskLongName()), + wf: toWorkflow(withTaskLongName()), expectedError: true, }, { name: "task name is duplicated", - wf: workflow(withTaskDuplicateName()), + wf: toWorkflow(withTaskDuplicateName()), expectedError: true, }, { name: "action name is invalid", - wf: workflow(withActionInvalidName()), + wf: toWorkflow(withActionInvalidName()), expectedError: true, }, { name: "action name is duplicated", - wf: workflow(withActionDuplicateName()), + wf: toWorkflow(withActionDuplicateName()), expectedError: true, }, { name: "action name is too long", - wf: workflow(withActionLongName()), + wf: toWorkflow(withActionLongName()), expectedError: true, }, { name: "action image is invalid", - wf: workflow(withActionInvalidImage()), + wf: toWorkflow(withActionInvalidImage()), expectedError: true, }, { name: "valid task name", - wf: workflow(), + wf: toWorkflow(), }, } for _, test := range testCases { @@ -770,7 +770,7 @@ tasks: type workflowModifier func(*Workflow) -func workflow(m ...workflowModifier) *Workflow { +func toWorkflow(m ...workflowModifier) *Workflow { wf := &Workflow{ ID: "ce2e62ed-826f-4485-a39f-a82bb74338e2", GlobalTimeout: 900, diff --git a/pkg/controllers/retry.go b/pkg/controllers/retry.go deleted file mode 100644 index 0c2e93900..000000000 --- a/pkg/controllers/retry.go +++ /dev/null @@ -1,17 +0,0 @@ -package controllers - -import ( - "context" - - "go.uber.org/multierr" - "knative.dev/pkg/logging" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -// RetryIfError logs any errors and requeues if not nil. Supports multierr unwrapping. -func RetryIfError(ctx context.Context, err error) (reconcile.Result, error) { - for _, err := range multierr.Errors(err) { - logging.FromContext(ctx).Errorf("Failed reconciliation, %s", err.Error()) - } - return reconcile.Result{Requeue: err != nil}, nil -} diff --git a/pkg/controllers/template/controller.go b/pkg/controllers/template/controller.go deleted file mode 100644 index 7b5f4040e..000000000 --- a/pkg/controllers/template/controller.go +++ /dev/null @@ -1,3 +0,0 @@ -package template - -// TODO: Create a controller that watches for Templates, validates them, and patches the .spec