From eeabd8ae57fddd29d9decea8f3739f61f31f2dc0 Mon Sep 17 00:00:00 2001 From: parauliya Date: Tue, 28 Apr 2020 16:19:20 +0530 Subject: [PATCH 1/7] Merged hardware and target. Now while creating a workflow you can directly provide hardware/devices mac addr. And now there is no need of targets. --- cli/tink/cmd/target.go | 26 - cli/tink/cmd/target/commands.go | 59 -- cli/tink/cmd/target/create.go | 35 - cli/tink/cmd/target/delete.go | 32 - cli/tink/cmd/target/get.go | 34 - cli/tink/cmd/target/list.go | 58 -- cli/tink/cmd/target/update.go | 59 -- cli/tink/cmd/workflow/create.go | 15 +- client/main.go | 11 +- db/target.go | 117 ---- db/workflow.go | 14 +- .../tinkerbell-init.sql | 15 +- go.mod | 35 +- go.sum | 52 ++ grpc-server/grpc-server.go | 4 +- grpc-server/target.go | 147 ----- grpc-server/workflow.go | 31 +- protos/target/target.pb.go | 596 ------------------ protos/target/target.proto | 42 -- test/framework/target.go | 35 - test/framework/utils.go | 7 +- 21 files changed, 88 insertions(+), 1336 deletions(-) delete mode 100644 cli/tink/cmd/target.go delete mode 100644 cli/tink/cmd/target/commands.go delete mode 100644 cli/tink/cmd/target/create.go delete mode 100644 cli/tink/cmd/target/delete.go delete mode 100644 cli/tink/cmd/target/get.go delete mode 100644 cli/tink/cmd/target/list.go delete mode 100644 cli/tink/cmd/target/update.go delete mode 100644 db/target.go delete mode 100644 grpc-server/target.go delete mode 100644 protos/target/target.pb.go delete mode 100644 protos/target/target.proto delete mode 100644 test/framework/target.go diff --git a/cli/tink/cmd/target.go b/cli/tink/cmd/target.go deleted file mode 100644 index d82b5fa2f..000000000 --- a/cli/tink/cmd/target.go +++ /dev/null @@ -1,26 +0,0 @@ -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/tinkerbell/tink/cli/tink/cmd/target" -) - -// templateCmd represents the template sub-command -var targetCmd = &cobra.Command{ - Use: "target", - Short: "tink target client", - Example: "tink target [command]", - Args: func(c *cobra.Command, args []string) error { - if len(args) == 0 { - return fmt.Errorf("%v requires arguments", c.UseLine()) - } - return nil - }, -} - -func init() { - targetCmd.AddCommand(target.SubCommands...) - rootCmd.AddCommand(targetCmd) -} diff --git a/cli/tink/cmd/target/commands.go b/cli/tink/cmd/target/commands.go deleted file mode 100644 index 4dad988cf..000000000 --- a/cli/tink/cmd/target/commands.go +++ /dev/null @@ -1,59 +0,0 @@ -package target - -import ( - "encoding/json" - "errors" - "fmt" - "net" - - uuid "github.com/satori/go.uuid" - "github.com/spf13/cobra" -) - -// SubCommands holds the sub commands for targets command -// Example: tinkerbell targets [subcommand] -var SubCommands []*cobra.Command - -func verifyUUIDs(args []string) error { - if len(args) < 1 { - return errors.New("requires at least one id") - } - for _, arg := range args { - if _, err := uuid.FromString(arg); err != nil { - return fmt.Errorf("invalid uuid: %s", arg) - } - } - return nil -} - -type machine map[string]string - -type tmap struct { - Targets map[string]machine `json:"targets"` -} - -func isValidData(arg []byte) error { - var tr tmap - if json.Unmarshal([]byte(arg), &tr) != nil { - return fmt.Errorf("invalid json: %s", arg) - } - for _, v := range tr.Targets { - for key, val := range v { - switch key { - case string("mac_addr"): - _, err := net.ParseMAC(val) - if err != nil { - return err - } - case string("ipv4_addr"): - ip := net.ParseIP(val) - if ip == nil || ip.To4() == nil { - return fmt.Errorf("invalid ip_addr: %s", val) - } - default: - return fmt.Errorf("invalid key \"%s\" in data. it should be \"mac_addr\" or \"ip_addr\" only", key) - } - } - } - return nil -} diff --git a/cli/tink/cmd/target/create.go b/cli/tink/cmd/target/create.go deleted file mode 100644 index 2b28ae48c..000000000 --- a/cli/tink/cmd/target/create.go +++ /dev/null @@ -1,35 +0,0 @@ -package target - -import ( - "context" - "fmt" - "log" - - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" - "github.com/spf13/cobra" -) - -// pushCmd represents the push command -var createTargets = &cobra.Command{ - Use: "create", - Short: "create a target", - Example: `tinkerbell target create '{"targets": {"machine1": {"mac_addr": "02:42:db:98:4b:1e"},"machine2": {"ipv4_addr": "192.168.1.5"}}}'`, - Run: func(cmd *cobra.Command, args []string) { - for _, j := range args { - err := isValidData([]byte(j)) - if err != nil { - log.Fatal(err) - } - uuid, err := client.TargetClient.CreateTargets(context.Background(), &target.PushRequest{Data: j}) - if err != nil { - log.Fatal(err) - } - fmt.Println("Created Target:", uuid.Uuid) - } - }, -} - -func init() { - SubCommands = append(SubCommands, createTargets) -} diff --git a/cli/tink/cmd/target/delete.go b/cli/tink/cmd/target/delete.go deleted file mode 100644 index 1a719d2c4..000000000 --- a/cli/tink/cmd/target/delete.go +++ /dev/null @@ -1,32 +0,0 @@ -package target - -import ( - "context" - "log" - - "github.com/spf13/cobra" - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" -) - -// idCmd represents the id command -var deleteCmd = &cobra.Command{ - Use: "delete", - Short: "delete a target", - Example: "tink target delete 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1", - Args: func(_ *cobra.Command, args []string) error { - return verifyUUIDs(args) - }, - Run: func(cmd *cobra.Command, args []string) { - for _, id := range args { - _, err := client.TargetClient.DeleteTargetByID(context.Background(), &target.GetRequest{ID: id}) - if err != nil { - log.Fatal(err) - } - } - }, -} - -func init() { - SubCommands = append(SubCommands, deleteCmd) -} diff --git a/cli/tink/cmd/target/get.go b/cli/tink/cmd/target/get.go deleted file mode 100644 index b854f421c..000000000 --- a/cli/tink/cmd/target/get.go +++ /dev/null @@ -1,34 +0,0 @@ -package target - -import ( - "context" - "fmt" - "log" - - "github.com/spf13/cobra" - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" -) - -// idCmd represents the id command -var getCmd = &cobra.Command{ - Use: "get", - Short: "get a target", - Example: "tink target get 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1", - Args: func(_ *cobra.Command, args []string) error { - return verifyUUIDs(args) - }, - Run: func(cmd *cobra.Command, args []string) { - for _, id := range args { - tr, err := client.TargetClient.TargetByID(context.Background(), &target.GetRequest{ID: id}) - if err != nil { - log.Fatal(err) - } - fmt.Println(tr.JSON) - } - }, -} - -func init() { - SubCommands = append(SubCommands, getCmd) -} diff --git a/cli/tink/cmd/target/list.go b/cli/tink/cmd/target/list.go deleted file mode 100644 index 297274621..000000000 --- a/cli/tink/cmd/target/list.go +++ /dev/null @@ -1,58 +0,0 @@ -package target - -import ( - "context" - "fmt" - "io" - "log" - "os" - - "github.com/jedib0t/go-pretty/table" - "github.com/spf13/cobra" - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" -) - -// listCmd represents the list subcommand for target command -var listCmd = &cobra.Command{ - Use: "list", - Short: "list all targets", - Example: "tink target list", - Args: func(c *cobra.Command, args []string) error { - if len(args) != 0 { - return fmt.Errorf("%v takes no arguments", c.UseLine()) - } - return nil - }, - Run: func(cmd *cobra.Command, args []string) { - t := table.NewWriter() - t.SetOutputMirror(os.Stdout) - t.AppendHeader(table.Row{"Target Id", "Target Data"}) - listTargets(cmd, t) - t.Render() - }, -} - -func listTargets(cmd *cobra.Command, t table.Writer) { - list, err := client.TargetClient.ListTargets(context.Background(), &target.Empty{}) - if err != nil { - log.Fatal(err) - } - - var tmp *target.TargetList - err = nil - for tmp, err = list.Recv(); err == nil && tmp.Data != ""; tmp, err = list.Recv() { - t.AppendRows([]table.Row{ - {tmp.ID, tmp.Data}, - }) - } - - if err != nil && err != io.EOF { - log.Fatal(err) - } -} - -func init() { - listCmd.DisableFlagsInUseLine = true - SubCommands = append(SubCommands, listCmd) -} diff --git a/cli/tink/cmd/target/update.go b/cli/tink/cmd/target/update.go deleted file mode 100644 index 53fbee7c6..000000000 --- a/cli/tink/cmd/target/update.go +++ /dev/null @@ -1,59 +0,0 @@ -package target - -import ( - "context" - "fmt" - "log" - - "github.com/spf13/cobra" - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" -) - -var ( - id = "uuid" - data = "jsonData" - uid string - jsonData string -) - -// createCmd represents the create sub command for template command -var updateCmd = &cobra.Command{ - Use: "update", - Short: "update a target", - Example: "tink target update [flags]", - Run: func(c *cobra.Command, args []string) { - err := validateData(c, args) - if err != nil { - log.Fatal(err) - } - updateTargets(c, args) - }, -} - -func addFlags() { - flags := updateCmd.PersistentFlags() - flags.StringVarP(&uid, "uuid", "u", "", "id for targets to be updated") - flags.StringVarP(&jsonData, "jsondata", "j", "", "JSON data which needs to be pushed") - updateCmd.MarkPersistentFlagRequired(id) - updateCmd.MarkPersistentFlagRequired(data) -} - -func validateData(c *cobra.Command, args []string) error { - err := isValidData([]byte(jsonData)) - if err != nil { - fmt.Println(err) - return err - } - return nil -} -func updateTargets(c *cobra.Command, args []string) { - if _, err := client.TargetClient.UpdateTargetByID(context.Background(), &target.UpdateRequest{ID: uid, Data: jsonData}); err != nil { - log.Fatal(err) - } -} - -func init() { - addFlags() - SubCommands = append(SubCommands, updateCmd) -} diff --git a/cli/tink/cmd/workflow/create.go b/cli/tink/cmd/workflow/create.go index a5ef18b8b..4260bf0d1 100644 --- a/cli/tink/cmd/workflow/create.go +++ b/cli/tink/cmd/workflow/create.go @@ -12,9 +12,9 @@ import ( var ( fTemplate = "template" - fTarget = "target" + fHardware = "hardware" template string - target string + hardware string ) // createCmd represents the create subcommand for worflow command @@ -25,11 +25,6 @@ var createCmd = &cobra.Command{ PreRunE: func(c *cobra.Command, args []string) error { tmp, _ := c.Flags().GetString(fTemplate) err := validateID(tmp) - if err != nil { - return err - } - tar, _ := c.Flags().GetString(fTarget) - err = validateID(tar) return err }, Run: func(c *cobra.Command, args []string) { @@ -40,14 +35,14 @@ var createCmd = &cobra.Command{ func addFlags() { flags := createCmd.PersistentFlags() flags.StringVarP(&template, "template", "t", "", "workflow template") - flags.StringVarP(&target, "target", "r", "", "workflow target") + flags.StringVarP(&hardware, "hardware", "r", "", "workflow target hardwares") - createCmd.MarkPersistentFlagRequired(fTarget) + createCmd.MarkPersistentFlagRequired(fHardware) createCmd.MarkPersistentFlagRequired(fTemplate) } func createWorkflow(c *cobra.Command, args []string) { - req := workflow.CreateRequest{Template: template, Target: target} + req := workflow.CreateRequest{Template: template, Target: hardware} res, err := client.WorkflowClient.CreateWorkflow(context.Background(), &req) if err != nil { log.Fatal(err) diff --git a/client/main.go b/client/main.go index 483976bdb..ec9f62086 100644 --- a/client/main.go +++ b/client/main.go @@ -7,11 +7,10 @@ import ( "net/http" "os" + "github.com/pkg/errors" "github.com/tinkerbell/tink/protos/hardware" - "github.com/tinkerbell/tink/protos/target" "github.com/tinkerbell/tink/protos/template" "github.com/tinkerbell/tink/protos/workflow" - "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -19,7 +18,6 @@ import ( // gRPC clients var ( TemplateClient template.TemplateClient - TargetClient target.TargetClient WorkflowClient workflow.WorkflowSvcClient HardwareClient hardware.HardwareServiceClient ) @@ -66,15 +64,14 @@ func Setup() { log.Fatal(err) } TemplateClient = template.NewTemplateClient(conn) - TargetClient = target.NewTargetClient(conn) WorkflowClient = workflow.NewWorkflowSvcClient(conn) HardwareClient = hardware.NewHardwareServiceClient(conn) } func NewTinkerbellClient() (hardware.HardwareServiceClient, error) { conn, err := GetConnection() - if err != nil { - log.Fatal(err) - } + if err != nil { + log.Fatal(err) + } return hardware.NewHardwareServiceClient(conn), nil } diff --git a/db/target.go b/db/target.go deleted file mode 100644 index a73f4aa19..000000000 --- a/db/target.go +++ /dev/null @@ -1,117 +0,0 @@ -package db - -import ( - "context" - "database/sql" - "time" - - "github.com/pkg/errors" -) - -// InsertIntoTargetDB : Push targets data in target table -func InsertIntoTargetDB(ctx context.Context, db *sql.DB, data string, uuid string) error { - tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) - if err != nil { - return errors.Wrap(err, "BEGIN transaction") - } - - _, err = tx.Exec(` - INSERT INTO - targets (inserted_at, id, data) - VALUES - ($1, $2, $3) - ON CONFLICT (id) - DO - UPDATE SET - (inserted_at, deleted_at, data) = ($1, NULL, $3); - `, time.Now(), uuid, data) - if err != nil { - return errors.Wrap(err, "INSERT") - } - - err = tx.Commit() - if err != nil { - return errors.Wrap(err, "COMMIT") - } - return nil -} - -// TargetsByID : Get the targets data which belongs to the input id -func TargetsByID(ctx context.Context, db *sql.DB, id string) (string, error) { - arg := id - - query := ` - SELECT data - FROM targets - WHERE - deleted_at IS NULL - AND - id = $1 - ` - return get(ctx, db, query, arg) -} - -// DeleteFromTargetDB : Delete the targets which belong to the input id -func DeleteFromTargetDB(ctx context.Context, db *sql.DB, id string) error { - tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) - if err != nil { - return errors.Wrap(err, "BEGIN transaction") - } - - _, err = tx.Exec(` - UPDATE targets - SET - deleted_at = NOW() - WHERE - id = $1; - `, id) - - if err != nil { - return errors.Wrap(err, "DELETE") - } - - err = tx.Commit() - if err != nil { - return errors.Wrap(err, "COMMIT") - } - return nil -} - -// ListTargets returns all saved targets which are not deleted -func ListTargets(db *sql.DB, fn func(id, n string) error) error { - rows, err := db.Query(` - SELECT id, data - FROM targets - WHERE - deleted_at IS NULL; - `) - - if err != nil { - return err - } - - defer rows.Close() - var ( - id string - data string - ) - - for rows.Next() { - err = rows.Scan(&id, &data) - if err != nil { - err = errors.Wrap(err, "SELECT") - logger.Error(err) - return err - } - err = fn(id, data) - if err != nil { - return err - } - } - - err = rows.Err() - if err == sql.ErrNoRows { - err = nil - } - return err -} diff --git a/db/workflow.go b/db/workflow.go index b40851ccc..5e5e7dc39 100644 --- a/db/workflow.go +++ b/db/workflow.go @@ -14,9 +14,9 @@ import ( "github.com/docker/distribution/reference" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" - pb "github.com/tinkerbell/tink/protos/workflow" "github.com/pkg/errors" uuid "github.com/satori/go.uuid" + pb "github.com/tinkerbell/tink/protos/workflow" "gopkg.in/yaml.v2" ) @@ -91,13 +91,13 @@ func CreateWorkflow(ctx context.Context, db *sql.DB, wf Workflow, data string, i func insertInWorkflow(ctx context.Context, db *sql.DB, wf Workflow, tx *sql.Tx) error { _, err := tx.Exec(` INSERT INTO - workflow (created_at, updated_at, template, target, id) + workflow (created_at, updated_at, template, devices, id) VALUES ($1, $1, $2, $3, $4) ON CONFLICT (id) DO UPDATE SET - (updated_at, deleted_at, template, target) = ($1, NULL, $2, $3); + (updated_at, deleted_at, template, devices) = ($1, NULL, $2, $3); `, time.Now(), wf.Template, wf.Target, wf.ID) if err != nil { return errors.Wrap(err, "INSERT in to workflow") @@ -378,7 +378,7 @@ func GetfromWfWorkflowTable(ctx context.Context, db *sql.DB, id string) ([]strin // GetWorkflow returns a workflow func GetWorkflow(ctx context.Context, db *sql.DB, id string) (Workflow, error) { query := ` - SELECT template, target + SELECT template, devices FROM workflow WHERE id = $1 @@ -448,7 +448,7 @@ func DeleteWorkflow(ctx context.Context, db *sql.DB, id string, state int32) err // ListWorkflows returns all workflows func ListWorkflows(db *sql.DB, fn func(wf Workflow) error) error { rows, err := db.Query(` - SELECT id, template, target, created_at, updated_at + SELECT id, template, devices, created_at, updated_at FROM workflow WHERE deleted_at IS NULL; @@ -510,7 +510,7 @@ func UpdateWorkflow(ctx context.Context, db *sql.DB, wf Workflow, state int32) e _, err = tx.Exec(` UPDATE workflow SET - updated_at = NOW(), target = $2 + updated_at = NOW(), devices = $2 WHERE id = $1; `, wf.ID, wf.Target) @@ -518,7 +518,7 @@ func UpdateWorkflow(ctx context.Context, db *sql.DB, wf Workflow, state int32) e _, err = tx.Exec(` UPDATE workflow SET - updated_at = NOW(), template = $2, target = $3 + updated_at = NOW(), template = $2, devices = $3 WHERE id = $1; `, wf.ID, wf.Template, wf.Target) diff --git a/deploy/db/docker-entrypoint-initdb.d/tinkerbell-init.sql b/deploy/db/docker-entrypoint-initdb.d/tinkerbell-init.sql index dcb01f7fd..9b27c818f 100644 --- a/deploy/db/docker-entrypoint-initdb.d/tinkerbell-init.sql +++ b/deploy/db/docker-entrypoint-initdb.d/tinkerbell-init.sql @@ -25,21 +25,10 @@ CREATE TABLE IF NOT EXISTS template ( CREATE INDEX IF NOT EXISTS idx_tid ON template (id); CREATE INDEX IF NOT EXISTS idx_tdeleted_at ON template (deleted_at NULLS FIRST); -CREATE TABLE IF NOT EXISTS targets ( - id UUID UNIQUE - , inserted_at TIMESTAMPTZ - , deleted_at TIMESTAMPTZ - , data JSONB -); - -CREATE INDEX IF NOT EXISTS idx_rid ON targets (id); -CREATE INDEX IF NOT EXISTS idx_rdeleted_at ON targets (deleted_at NULLS FIRST); -CREATE INDEX IF NOT EXISTS idxgin_rtype ON targets USING GIN (data JSONB_PATH_OPS); - CREATE TABLE IF NOT EXISTS workflow ( id UUID UNIQUE NOT NULL , template UUID NOT NULL - , target UUID NOT NULL + , devices JSONB NOT NULL , created_at TIMESTAMPTZ , updated_at TIMESTAMPTZ , deleted_at TIMESTAMPTZ @@ -84,4 +73,4 @@ CREATE TABLE IF NOT EXISTS workflow_data ( , version INT , metadata JSONB , data JSONB -); \ No newline at end of file +); diff --git a/go.mod b/go.mod index 72f7b2d05..6be635b12 100644 --- a/go.mod +++ b/go.mod @@ -3,56 +3,23 @@ module github.com/tinkerbell/tink go 1.13 require ( - github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect - github.com/Microsoft/go-winio v0.4.14 // indirect - github.com/containerd/containerd v1.3.2 // indirect github.com/docker/distribution v2.7.1+incompatible github.com/docker/docker v1.4.2-0.20191212201129-5f9f41018e9d - github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.4.0 // indirect - github.com/fsnotify/fsnotify v1.4.7 // indirect - github.com/go-openapi/strfmt v0.19.3 // indirect - github.com/gogo/protobuf v1.2.0 // indirect github.com/golang/protobuf v1.3.5 - github.com/google/go-cmp v0.3.1 // indirect - github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/mux v1.6.2 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20160910222444-6b7015e65d36 - github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jedib0t/go-pretty v4.3.0+incompatible - github.com/kr/pretty v0.2.0 // indirect github.com/lib/pq v1.2.1-0.20191011153232-f91d3411e481 - github.com/magiconair/properties v1.8.0 // indirect - github.com/mattn/go-runewidth v0.0.5 // indirect - github.com/morikuni/aec v1.0.0 // indirect - github.com/opencontainers/go-digest v1.0.0-rc1 // indirect - github.com/opencontainers/image-spec v1.0.1 // indirect github.com/packethost/pkg v0.0.0-20190410153520-e8e15f4ce770 - github.com/pelletier/go-toml v1.2.0 // indirect + github.com/packethost/tinkerbell v0.0.0-20200326045848-98d7d0594340 github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 - github.com/rollbar/rollbar-go v1.0.2 // indirect github.com/satori/go.uuid v1.2.0 github.com/sirupsen/logrus v1.4.1 - github.com/spf13/afero v1.1.1 // indirect - github.com/spf13/cast v1.2.0 // indirect github.com/spf13/cobra v0.0.3 - github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec // indirect - github.com/spf13/pflag v1.0.1 // indirect github.com/spf13/viper v1.0.2 - go.mongodb.org/mongo-driver v1.1.2 // indirect - go.uber.org/atomic v1.2.0 // indirect - go.uber.org/multierr v1.1.0 // indirect - go.uber.org/zap v1.7.1 // indirect golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect - golang.org/x/text v0.3.2 // indirect - golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940 // indirect google.golang.org/grpc v1.28.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v2 v2.2.2 - gotest.tools v2.2.0+incompatible // indirect ) diff --git a/go.sum b/go.sum index bc36ca833..f8420e78f 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,21 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/aws/aws-sdk-go v1.25.25/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -29,10 +34,14 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -48,13 +57,18 @@ github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2-0.20190318194812-d3c38a4eb497/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= @@ -69,13 +83,17 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmo github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20160910222444-6b7015e65d36 h1:cwTrrTEhz13khQS3/UZMLFWwiqlcsdp/2sxFmSjAWeQ= github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20160910222444-6b7015e65d36/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jedib0t/go-pretty v4.3.0+incompatible h1:CGs8AVhEKg/n9YbUenWmNStRW2PHJzaeDodcfvRAbIo= github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -88,23 +106,34 @@ github.com/lib/pq v1.2.1-0.20191011153232-f91d3411e481 h1:r9fnMM01mkhtfe6QfLrr/9 github.com/lib/pq v1.2.1-0.20191011153232-f91d3411e481/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-runewidth v0.0.5 h1:jrGtp51JOKTWgvLFzfG6OtZOJcK2sEnzc/U+zw7TtbA= github.com/mattn/go-runewidth v0.0.5/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/olivere/elastic/v7 v7.0.9/go.mod h1:2TeRd0vhLRTK9zqm5xP0uLiVeZ5yUoL7kZ+8SZA9r9Y= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/packethost/pkg v0.0.0-20190410153520-e8e15f4ce770 h1:M/ErkHz96yXYNdcu0G7kX5Qa1HUliL5QczNdA9/0k40= github.com/packethost/pkg v0.0.0-20190410153520-e8e15f4ce770/go.mod h1:cbOkI4WbX7B68Nj552pbadMrjVy2oMIVazIEo7z+qWQ= +github.com/packethost/tinkerbell v0.0.0-20200326045848-98d7d0594340 h1:C1q1GcTXpa08V4AuvW7dUX/2lnDaqyo2zkhOLKBdyjs= +github.com/packethost/tinkerbell v0.0.0-20200326045848-98d7d0594340/go.mod h1:wv8mKckUccJdXPHfUP6wmvx2RU5lccz0aEDrK6RzyJs= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= @@ -124,6 +153,7 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rollbar/rollbar-go v1.0.2 h1:uA3+z0jq6ka9WUUt9VX/xuiQZXZyWRoeKvkhVvLO9Jc= github.com/rollbar/rollbar-go v1.0.2/go.mod h1:AcFs5f0I+c71bpHlXNNDbOWJiKwjFDtISeXco0L5PKQ= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= @@ -132,6 +162,7 @@ github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/spf13/afero v1.1.1 h1:Lt3ihYMlE+lreX1GS4Qw4ZsNpYQLxIXKBTEOXm3nt6I= github.com/spf13/afero v1.1.1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg= @@ -155,6 +186,8 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.uber.org/atomic v1.2.0 h1:yVVGhClJ8Xi1y4TxhJZE6QFPrz76BrzhWA01n47mSFk= go.uber.org/atomic v1.2.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= @@ -167,24 +200,33 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -196,19 +238,26 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940 h1:MRHtG0U6SnaUb+s+LhNE1qt1FQ1wlhqr5E4usBKC0uA= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -219,11 +268,14 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/grpc-server/grpc-server.go b/grpc-server/grpc-server.go index f6346fbf8..fcbdeecd2 100644 --- a/grpc-server/grpc-server.go +++ b/grpc-server/grpc-server.go @@ -13,13 +13,12 @@ import ( grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/packethost/pkg/log" + "github.com/pkg/errors" "github.com/tinkerbell/tink/db" "github.com/tinkerbell/tink/metrics" "github.com/tinkerbell/tink/protos/hardware" - "github.com/tinkerbell/tink/protos/target" "github.com/tinkerbell/tink/protos/template" "github.com/tinkerbell/tink/protos/workflow" - "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -70,7 +69,6 @@ func SetupGRPC(ctx context.Context, log log.Logger, facility string, errCh chan< // register servers s := grpc.NewServer(params...) template.RegisterTemplateServer(s, server) - target.RegisterTargetServer(s, server) workflow.RegisterWorkflowSvcServer(s, server) hardware.RegisterHardwareServiceServer(s, server) diff --git a/grpc-server/target.go b/grpc-server/target.go deleted file mode 100644 index b389c2658..000000000 --- a/grpc-server/target.go +++ /dev/null @@ -1,147 +0,0 @@ -package grpcserver - -import ( - "context" - "encoding/json" - - "github.com/tinkerbell/tink/db" - "github.com/tinkerbell/tink/protos/target" - "github.com/pkg/errors" - uuid "github.com/satori/go.uuid" -) - -// TARGETS GRPC ENDPOINTS START -func (s *server) CreateTargets(ctx context.Context, in *target.PushRequest) (*target.UUID, error) { - logger.Info("create Targets") - - type machine map[string]string - - var h struct { - ID string - Targets map[string]machine - } - - uuid := uuid.NewV4().String() - err := json.Unmarshal([]byte(in.Data), &h) - if err != nil { - err = errors.Wrap(err, "unmarshal json") - logger.Error(err) - return &target.UUID{}, err - } - h.ID = uuid - if h.ID == "" { - err = errors.New("id must be set to a UUID") - logger.Error(err) - return &target.UUID{}, err - } - - var fn func() error - msg := "inserting into targets DB" - fn = func() error { return db.InsertIntoTargetDB(ctx, s.db, in.Data, uuid) } - logger.Info(msg) - - err = fn() - - logger.Info("done " + msg) - logger.With("id", h.ID).Info("data pushed") - if err != nil { - l := logger - if pqErr := db.Error(err); pqErr != nil { - l = l.With("detail", pqErr.Detail, "where", pqErr.Where) - } - l.Error(err) - } - return &target.UUID{Uuid: uuid}, err -} - -// This will give you the targets which belongs to the input id -func (s *server) TargetByID(ctx context.Context, in *target.GetRequest) (*target.Targets, error) { - j, err := db.TargetsByID(ctx, s.db, in.ID) - if err != nil { - return &target.Targets{}, err - } - return &target.Targets{JSON: j}, nil -} - -// This will update the targets values which belongs to the input id and data -func (s *server) UpdateTargetByID(ctx context.Context, in *target.UpdateRequest) (*target.Empty, error) { - logger.Info("Update Targets") - - type machine map[string]string - var t struct { - Targets map[string]machine - } - - err := json.Unmarshal([]byte(in.Data), &t) - if err != nil { - err = errors.Wrap(err, "unmarshal json") - logger.Error(err) - return &target.Empty{}, err - } - if in.ID == "" { - err = errors.New("id must be set to an existing UUID") - logger.Error(err) - return &target.Empty{}, err - } - - var fn func() error - msg := "Updating into targets DB for ID : " - fn = func() error { return db.InsertIntoTargetDB(ctx, s.db, in.Data, in.ID) } - logger.Info(msg + in.ID) - - err = fn() - - logger.Info("done " + msg + in.ID) - logger.With("id", in.ID).Info("data pushed") - if err != nil { - l := logger - if pqErr := db.Error(err); pqErr != nil { - l = l.With("detail", pqErr.Detail, "where", pqErr.Where) - } - l.Error(err) - } - return &target.Empty{}, err -} - -// This will delete (soft delete) the targets which belongs to the input id -func (s *server) DeleteTargetByID(ctx context.Context, in *target.GetRequest) (*target.Empty, error) { - logger.Info("Delete Targets") - - if in.ID == "" { - err := errors.New("id must be provided") - logger.Error(err) - return &target.Empty{}, err - } - - var fn func() error - msg := "Deleting into targets Table for ID : " - fn = func() error { return db.DeleteFromTargetDB(ctx, s.db, in.ID) } - logger.Info(msg + in.ID) - - err := fn() - - logger.Info("done " + msg + in.ID) - logger.With("id", in.ID).Info("data deleted") - if err != nil { - l := logger - if pqErr := db.Error(err); pqErr != nil { - l = l.With("detail", pqErr.Detail, "where", pqErr.Where) - } - l.Error(err) - } - return &target.Empty{}, err -} - -// ListTargets implements target.ListTargets -func (s *server) ListTargets(_ *target.Empty, stream target.Target_ListTargetsServer) error { - - logger.Info("list targets") - err := db.ListTargets(s.db, func(id, json string) error { - return stream.Send(&target.TargetList{ID: id, Data: json}) - }) - - if err != nil { - return err - } - return nil -} diff --git a/grpc-server/workflow.go b/grpc-server/workflow.go index 214fcc1c6..bb03e2492 100644 --- a/grpc-server/workflow.go +++ b/grpc-server/workflow.go @@ -5,15 +5,16 @@ import ( "context" "database/sql" "encoding/json" + "fmt" "text/template" + "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" + uuid "github.com/satori/go.uuid" "github.com/tinkerbell/tink/db" "github.com/tinkerbell/tink/metrics" "github.com/tinkerbell/tink/protos/workflow" workflowpb "github.com/tinkerbell/tink/protos/workflow" - "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" - uuid "github.com/satori/go.uuid" ) var state = map[int32]workflow.State{ @@ -267,35 +268,33 @@ func createYaml(ctx context.Context, sqlDB *sql.DB, temp string, tar string) (st if err != nil { return "", err } - tarData, err := db.TargetsByID(ctx, sqlDB, tar) - if err != nil { - return "", err - } - return renderTemplate(string(tempData), []byte(tarData)) + return renderTemplate(string(tempData), []byte(tar)) } func renderTemplate(tempData string, tarData []byte) (string, error) { - type machine map[string]string - type Environment struct { - Targets map[string]machine `json:"targets"` + type Target struct { + Hardware map[string]string `json:hardware` } + var target Target - var env Environment - t := template.New("workflow-template") - _, err := t.Parse(tempData) + err := json.Unmarshal(tarData, &target) if err != nil { logger.Error(err) return "", nil } - err = json.Unmarshal(tarData, &env) + + t := template.New("workflow-template") + _, err = t.Parse(string(tempData)) if err != nil { logger.Error(err) return "", nil } + buf := new(bytes.Buffer) - err = t.Execute(buf, env) + err = t.Execute(buf, target) if err != nil { return "", nil } + fmt.Println(buf.String()) return buf.String(), nil } diff --git a/protos/target/target.pb.go b/protos/target/target.pb.go deleted file mode 100644 index ec1d665f2..000000000 --- a/protos/target/target.pb.go +++ /dev/null @@ -1,596 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: target/target.proto - -package target - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type PushRequest struct { - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PushRequest) Reset() { *m = PushRequest{} } -func (m *PushRequest) String() string { return proto.CompactTextString(m) } -func (*PushRequest) ProtoMessage() {} -func (*PushRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{0} -} - -func (m *PushRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PushRequest.Unmarshal(m, b) -} -func (m *PushRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PushRequest.Marshal(b, m, deterministic) -} -func (m *PushRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PushRequest.Merge(m, src) -} -func (m *PushRequest) XXX_Size() int { - return xxx_messageInfo_PushRequest.Size(m) -} -func (m *PushRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PushRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PushRequest proto.InternalMessageInfo - -func (m *PushRequest) GetData() string { - if m != nil { - return m.Data - } - return "" -} - -type GetRequest struct { - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{1} -} - -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRequest.Unmarshal(m, b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return xxx_messageInfo_GetRequest.Size(m) -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -func (m *GetRequest) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -type UpdateRequest struct { - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpdateRequest) Reset() { *m = UpdateRequest{} } -func (m *UpdateRequest) String() string { return proto.CompactTextString(m) } -func (*UpdateRequest) ProtoMessage() {} -func (*UpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{2} -} - -func (m *UpdateRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateRequest.Unmarshal(m, b) -} -func (m *UpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateRequest.Marshal(b, m, deterministic) -} -func (m *UpdateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateRequest.Merge(m, src) -} -func (m *UpdateRequest) XXX_Size() int { - return xxx_messageInfo_UpdateRequest.Size(m) -} -func (m *UpdateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdateRequest proto.InternalMessageInfo - -func (m *UpdateRequest) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *UpdateRequest) GetData() string { - if m != nil { - return m.Data - } - return "" -} - -type UUID struct { - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UUID) Reset() { *m = UUID{} } -func (m *UUID) String() string { return proto.CompactTextString(m) } -func (*UUID) ProtoMessage() {} -func (*UUID) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{3} -} - -func (m *UUID) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UUID.Unmarshal(m, b) -} -func (m *UUID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UUID.Marshal(b, m, deterministic) -} -func (m *UUID) XXX_Merge(src proto.Message) { - xxx_messageInfo_UUID.Merge(m, src) -} -func (m *UUID) XXX_Size() int { - return xxx_messageInfo_UUID.Size(m) -} -func (m *UUID) XXX_DiscardUnknown() { - xxx_messageInfo_UUID.DiscardUnknown(m) -} - -var xxx_messageInfo_UUID proto.InternalMessageInfo - -func (m *UUID) GetUuid() string { - if m != nil { - return m.Uuid - } - return "" -} - -type Empty struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{4} -} - -func (m *Empty) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Empty.Unmarshal(m, b) -} -func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Empty.Marshal(b, m, deterministic) -} -func (m *Empty) XXX_Merge(src proto.Message) { - xxx_messageInfo_Empty.Merge(m, src) -} -func (m *Empty) XXX_Size() int { - return xxx_messageInfo_Empty.Size(m) -} -func (m *Empty) XXX_DiscardUnknown() { - xxx_messageInfo_Empty.DiscardUnknown(m) -} - -var xxx_messageInfo_Empty proto.InternalMessageInfo - -type Targets struct { - JSON string `protobuf:"bytes,1,opt,name=JSON,proto3" json:"JSON,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Targets) Reset() { *m = Targets{} } -func (m *Targets) String() string { return proto.CompactTextString(m) } -func (*Targets) ProtoMessage() {} -func (*Targets) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{5} -} - -func (m *Targets) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Targets.Unmarshal(m, b) -} -func (m *Targets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Targets.Marshal(b, m, deterministic) -} -func (m *Targets) XXX_Merge(src proto.Message) { - xxx_messageInfo_Targets.Merge(m, src) -} -func (m *Targets) XXX_Size() int { - return xxx_messageInfo_Targets.Size(m) -} -func (m *Targets) XXX_DiscardUnknown() { - xxx_messageInfo_Targets.DiscardUnknown(m) -} - -var xxx_messageInfo_Targets proto.InternalMessageInfo - -func (m *Targets) GetJSON() string { - if m != nil { - return m.JSON - } - return "" -} - -type TargetList struct { - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TargetList) Reset() { *m = TargetList{} } -func (m *TargetList) String() string { return proto.CompactTextString(m) } -func (*TargetList) ProtoMessage() {} -func (*TargetList) Descriptor() ([]byte, []int) { - return fileDescriptor_a1ead4a1d4fd21a0, []int{6} -} - -func (m *TargetList) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TargetList.Unmarshal(m, b) -} -func (m *TargetList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TargetList.Marshal(b, m, deterministic) -} -func (m *TargetList) XXX_Merge(src proto.Message) { - xxx_messageInfo_TargetList.Merge(m, src) -} -func (m *TargetList) XXX_Size() int { - return xxx_messageInfo_TargetList.Size(m) -} -func (m *TargetList) XXX_DiscardUnknown() { - xxx_messageInfo_TargetList.DiscardUnknown(m) -} - -var xxx_messageInfo_TargetList proto.InternalMessageInfo - -func (m *TargetList) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *TargetList) GetData() string { - if m != nil { - return m.Data - } - return "" -} - -func init() { - proto.RegisterType((*PushRequest)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.PushRequest") - proto.RegisterType((*GetRequest)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.GetRequest") - proto.RegisterType((*UpdateRequest)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.UpdateRequest") - proto.RegisterType((*UUID)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.UUID") - proto.RegisterType((*Empty)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.Empty") - proto.RegisterType((*Targets)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.Targets") - proto.RegisterType((*TargetList)(nil), "jackfan.us.kg.tinkerbell.tink.protos.target.TargetList") -} - -func init() { - proto.RegisterFile("target/target.proto", fileDescriptor_a1ead4a1d4fd21a0) -} - -var fileDescriptor_a1ead4a1d4fd21a0 = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x25, 0x21, 0xa6, 0x3a, 0xa5, 0x52, 0xd6, 0x8b, 0x04, 0x05, 0xdd, 0x53, 0x4f, 0xdb, 0x6a, - 0x2b, 0xde, 0x6b, 0x44, 0x22, 0xa2, 0x52, 0xcd, 0xc5, 0x5b, 0x62, 0x96, 0x36, 0x98, 0x9a, 0x98, - 0xcc, 0x16, 0x02, 0x7e, 0xb0, 0x9f, 0x21, 0xd9, 0x75, 0x35, 0x1e, 0x84, 0x8d, 0xa7, 0x0c, 0x99, - 0xf7, 0xe6, 0xcd, 0xbc, 0xb7, 0xb0, 0x87, 0x51, 0xb9, 0xe4, 0x38, 0x56, 0x1f, 0x56, 0x94, 0x39, - 0xe6, 0x64, 0xb4, 0x4c, 0x71, 0x25, 0x62, 0xf6, 0x9c, 0xaf, 0x19, 0xa6, 0xaf, 0x2f, 0xbc, 0x8c, - 0x79, 0x96, 0xc9, 0x52, 0x21, 0x2a, 0xa6, 0xf0, 0xf4, 0x18, 0xfa, 0xf7, 0xa2, 0x5a, 0x2d, 0xf8, - 0x9b, 0xe0, 0x15, 0x12, 0x02, 0x4e, 0x12, 0x61, 0xb4, 0x6f, 0x1d, 0x59, 0xa3, 0x9d, 0x85, 0xac, - 0xe9, 0x01, 0xc0, 0x15, 0x47, 0x8d, 0xd8, 0x05, 0x3b, 0xf0, 0xbf, 0xfa, 0x76, 0xe0, 0xd3, 0x29, - 0x0c, 0xc2, 0x22, 0x89, 0x90, 0xff, 0x01, 0xf8, 0x1e, 0x69, 0xb7, 0x46, 0x7a, 0xe0, 0x84, 0xa1, - 0xea, 0x09, 0x91, 0x26, 0x5a, 0xae, 0xa9, 0x69, 0x0f, 0xb6, 0x2e, 0xd7, 0x05, 0xd6, 0xf4, 0x10, - 0x7a, 0x8f, 0x72, 0xc9, 0xaa, 0xc1, 0x5d, 0x3f, 0xdc, 0xdd, 0x6a, 0x5c, 0x53, 0xd3, 0x09, 0x80, - 0x6a, 0xdf, 0xa4, 0x66, 0xaa, 0xa7, 0x1f, 0x0e, 0xb8, 0x8a, 0x42, 0x36, 0x30, 0xb8, 0x28, 0x79, - 0x84, 0x5c, 0x2b, 0x9c, 0x31, 0x53, 0xcb, 0x58, 0xcb, 0x2f, 0x8f, 0x99, 0xd3, 0xe4, 0xc1, 0x42, - 0x2f, 0x3d, 0xaf, 0x03, 0x9f, 0xcc, 0xcc, 0xd9, 0x3f, 0x09, 0x78, 0x27, 0xe6, 0x2c, 0x7d, 0xdd, - 0x3b, 0x0c, 0x55, 0x48, 0x2d, 0xf1, 0xf3, 0x0e, 0xab, 0xb7, 0x03, 0xf6, 0xc6, 0xe6, 0x44, 0x19, - 0x24, 0xa9, 0x61, 0xe8, 0xf3, 0x8c, 0xff, 0x52, 0xff, 0xdf, 0xe9, 0x9d, 0xa5, 0x37, 0xd0, 0x6f, - 0x9e, 0x87, 0xf6, 0xa1, 0x2b, 0xdf, 0x9b, 0x75, 0xf5, 0xba, 0x51, 0x9b, 0x58, 0xf3, 0xed, 0x27, - 0x57, 0xfd, 0x8e, 0x5d, 0x89, 0x9a, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xbf, 0x96, 0x01, - 0xa8, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// TargetClient is the client API for Target service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TargetClient interface { - CreateTargets(ctx context.Context, in *PushRequest, opts ...grpc.CallOption) (*UUID, error) - TargetByID(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Targets, error) - UpdateTargetByID(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) - DeleteTargetByID(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Empty, error) - ListTargets(ctx context.Context, in *Empty, opts ...grpc.CallOption) (Target_ListTargetsClient, error) -} - -type targetClient struct { - cc grpc.ClientConnInterface -} - -func NewTargetClient(cc grpc.ClientConnInterface) TargetClient { - return &targetClient{cc} -} - -func (c *targetClient) CreateTargets(ctx context.Context, in *PushRequest, opts ...grpc.CallOption) (*UUID, error) { - out := new(UUID) - err := c.cc.Invoke(ctx, "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/CreateTargets", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *targetClient) TargetByID(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Targets, error) { - out := new(Targets) - err := c.cc.Invoke(ctx, "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/TargetByID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *targetClient) UpdateTargetByID(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/UpdateTargetByID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *targetClient) DeleteTargetByID(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/DeleteTargetByID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *targetClient) ListTargets(ctx context.Context, in *Empty, opts ...grpc.CallOption) (Target_ListTargetsClient, error) { - stream, err := c.cc.NewStream(ctx, &_Target_serviceDesc.Streams[0], "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/ListTargets", opts...) - if err != nil { - return nil, err - } - x := &targetListTargetsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Target_ListTargetsClient interface { - Recv() (*TargetList, error) - grpc.ClientStream -} - -type targetListTargetsClient struct { - grpc.ClientStream -} - -func (x *targetListTargetsClient) Recv() (*TargetList, error) { - m := new(TargetList) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// TargetServer is the server API for Target service. -type TargetServer interface { - CreateTargets(context.Context, *PushRequest) (*UUID, error) - TargetByID(context.Context, *GetRequest) (*Targets, error) - UpdateTargetByID(context.Context, *UpdateRequest) (*Empty, error) - DeleteTargetByID(context.Context, *GetRequest) (*Empty, error) - ListTargets(*Empty, Target_ListTargetsServer) error -} - -// UnimplementedTargetServer can be embedded to have forward compatible implementations. -type UnimplementedTargetServer struct { -} - -func (*UnimplementedTargetServer) CreateTargets(ctx context.Context, req *PushRequest) (*UUID, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTargets not implemented") -} -func (*UnimplementedTargetServer) TargetByID(ctx context.Context, req *GetRequest) (*Targets, error) { - return nil, status.Errorf(codes.Unimplemented, "method TargetByID not implemented") -} -func (*UnimplementedTargetServer) UpdateTargetByID(ctx context.Context, req *UpdateRequest) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateTargetByID not implemented") -} -func (*UnimplementedTargetServer) DeleteTargetByID(ctx context.Context, req *GetRequest) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteTargetByID not implemented") -} -func (*UnimplementedTargetServer) ListTargets(req *Empty, srv Target_ListTargetsServer) error { - return status.Errorf(codes.Unimplemented, "method ListTargets not implemented") -} - -func RegisterTargetServer(s *grpc.Server, srv TargetServer) { - s.RegisterService(&_Target_serviceDesc, srv) -} - -func _Target_CreateTargets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TargetServer).CreateTargets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/CreateTargets", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TargetServer).CreateTargets(ctx, req.(*PushRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Target_TargetByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TargetServer).TargetByID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/TargetByID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TargetServer).TargetByID(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Target_UpdateTargetByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TargetServer).UpdateTargetByID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/UpdateTargetByID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TargetServer).UpdateTargetByID(ctx, req.(*UpdateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Target_DeleteTargetByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TargetServer).DeleteTargetByID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jackfan.us.kg.tinkerbell.tink.protos.target.Target/DeleteTargetByID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TargetServer).DeleteTargetByID(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Target_ListTargets_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(Empty) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(TargetServer).ListTargets(m, &targetListTargetsServer{stream}) -} - -type Target_ListTargetsServer interface { - Send(*TargetList) error - grpc.ServerStream -} - -type targetListTargetsServer struct { - grpc.ServerStream -} - -func (x *targetListTargetsServer) Send(m *TargetList) error { - return x.ServerStream.SendMsg(m) -} - -var _Target_serviceDesc = grpc.ServiceDesc{ - ServiceName: "jackfan.us.kg.tinkerbell.tink.protos.target.Target", - HandlerType: (*TargetServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateTargets", - Handler: _Target_CreateTargets_Handler, - }, - { - MethodName: "TargetByID", - Handler: _Target_TargetByID_Handler, - }, - { - MethodName: "UpdateTargetByID", - Handler: _Target_UpdateTargetByID_Handler, - }, - { - MethodName: "DeleteTargetByID", - Handler: _Target_DeleteTargetByID_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListTargets", - Handler: _Target_ListTargets_Handler, - ServerStreams: true, - }, - }, - Metadata: "target/target.proto", -} diff --git a/protos/target/target.proto b/protos/target/target.proto deleted file mode 100644 index 6dff6c3e6..000000000 --- a/protos/target/target.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; - -option go_package = "target"; - -package jackfan.us.kg.tinkerbell.tink.protos.target; - -service Target { - rpc CreateTargets(PushRequest) returns (UUID); - rpc TargetByID(GetRequest) returns (Targets); - rpc UpdateTargetByID(UpdateRequest) returns (Empty); - rpc DeleteTargetByID(GetRequest) returns (Empty); - rpc ListTargets(Empty) returns (stream TargetList); -} - -message PushRequest { - string data = 1; -} - -message GetRequest { - string ID = 1; -} - -message UpdateRequest { - string ID = 1; - string data = 2; -} - -message UUID { - string uuid = 1; -} - -message Empty { -} - -message Targets { - string JSON = 1; -} - -message TargetList { - string ID = 1; - string data = 2; -} diff --git a/test/framework/target.go b/test/framework/target.go deleted file mode 100644 index e0a7cf17f..000000000 --- a/test/framework/target.go +++ /dev/null @@ -1,35 +0,0 @@ -package framework - -import ( - "context" - "io/ioutil" - "os" - - "github.com/tinkerbell/tink/client" - "github.com/tinkerbell/tink/protos/target" -) - -func getTargets(file string) (string, error) { - f, err := os.Open(file) - if err != nil { - return "", err - } - defer f.Close() - - data, err := ioutil.ReadAll(f) - if err != nil { - return "", err - } - return string(data), nil -} - -// CreateTargets : create target in the database -func CreateTargets(tar string) (string, error) { - filepath := "data/target/" + tar - data, err := getTargets(filepath) - uuid, err := client.TargetClient.CreateTargets(context.Background(), &target.PushRequest{Data: data}) - if err != nil { - return "", err - } - return uuid.Uuid, nil -} diff --git a/test/framework/utils.go b/test/framework/utils.go index 682af3c88..ccfaa8f29 100644 --- a/test/framework/utils.go +++ b/test/framework/utils.go @@ -12,12 +12,7 @@ var Log = logger // SetupWorkflow ... Set up workflow func SetupWorkflow(tar string, tmpl string) (string, error) { - //Add target machine mac/ip addr into targets table - targetID, err := CreateTargets(tar) - if err != nil { - return "", err - } - logger.Infoln("Target Created : ", targetID) + targetID := "c9d6faa4-08a2-4285-ae6c-f3401211bd56" //Add template in template table templateID, err := CreateTemplate(tmpl) if err != nil { From e2ca1a7e14e1705054b17b54389f9fd2e2b4f1e8 Mon Sep 17 00:00:00 2001 From: Gaurav Gahlot Date: Mon, 27 Apr 2020 19:56:58 +0530 Subject: [PATCH 2/7] using hello-world as the first example Signed-off-by: Gaurav Gahlot --- docs/hello-world.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/hello-world.md b/docs/hello-world.md index b7d052cd2..05a69bf68 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -8,20 +8,20 @@ You have a setup ready with a provisioner and a worker node. If not, please foll ### Hardware Data -While the data model changes are in progress, the following data should be enough to get your workflow rolling at the moment: +While the data model changes are in progress, the following data should be enough to get your wofkflow rolling at the moment: ```json { - "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", + "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", // device UUID "arch": "x86_64", "allow_pxe": true, - "allow_workflow": true, + "allow_workflow": true, // to boot into workflow mode "facility_code": "onprem", "ip_addresses": [ { - "address": "192.168.1.5", + "address": "192.168.1.5", // IP to hand out "address_family": 4, "enabled": true, - "gateway": "192.168.1.1", + "gateway": "192.168.1.1", // gateway address "management": true, "netmask": "255.255.255.248", "public": false @@ -30,7 +30,7 @@ While the data model changes are in progress, the following data should be enoug "network_ports": [ { "data": { - "mac": "ec:0d:9a:bf:ff:dc" + "mac": "ec:0d:9a:bf:ff:dc" // worker mac address }, "name": "eth0", "type": "data" From a31da110ba1ecd1d10e75fef55fae93af5dd7e29 Mon Sep 17 00:00:00 2001 From: Gaurav Gahlot Date: Mon, 27 Apr 2020 20:47:23 +0530 Subject: [PATCH 3/7] fixes Signed-off-by: Gaurav Gahlot --- docs/hello-world.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hello-world.md b/docs/hello-world.md index 05a69bf68..f66284ee5 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -8,10 +8,10 @@ You have a setup ready with a provisioner and a worker node. If not, please foll ### Hardware Data -While the data model changes are in progress, the following data should be enough to get your wofkflow rolling at the moment: +While the data model changes are in progress, the following data should be enough to get your workflow rolling at the moment: ```json { - "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", // device UUID + "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", // hardware UUID "arch": "x86_64", "allow_pxe": true, "allow_workflow": true, // to boot into workflow mode From f6097d23a48409bcda0b5da46986481f150d35fd Mon Sep 17 00:00:00 2001 From: Gaurav Gahlot Date: Tue, 28 Apr 2020 20:52:56 +0530 Subject: [PATCH 4/7] moved comments out of data JSON Signed-off-by: Gaurav Gahlot --- docs/hello-world.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/hello-world.md b/docs/hello-world.md index f66284ee5..b7d052cd2 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -11,17 +11,17 @@ You have a setup ready with a provisioner and a worker node. If not, please foll While the data model changes are in progress, the following data should be enough to get your workflow rolling at the moment: ```json { - "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", // hardware UUID + "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", "arch": "x86_64", "allow_pxe": true, - "allow_workflow": true, // to boot into workflow mode + "allow_workflow": true, "facility_code": "onprem", "ip_addresses": [ { - "address": "192.168.1.5", // IP to hand out + "address": "192.168.1.5", "address_family": 4, "enabled": true, - "gateway": "192.168.1.1", // gateway address + "gateway": "192.168.1.1", "management": true, "netmask": "255.255.255.248", "public": false @@ -30,7 +30,7 @@ While the data model changes are in progress, the following data should be enoug "network_ports": [ { "data": { - "mac": "ec:0d:9a:bf:ff:dc" // worker mac address + "mac": "ec:0d:9a:bf:ff:dc" }, "name": "eth0", "type": "data" From 3aed670f0e015d51e8dd58a01ea9e8a89e18bee3 Mon Sep 17 00:00:00 2001 From: parauliya Date: Tue, 5 May 2020 12:12:20 +0530 Subject: [PATCH 5/7] Changed the way of writing template and creating workflow --- grpc-server/workflow.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/grpc-server/workflow.go b/grpc-server/workflow.go index bb03e2492..2d852bda3 100644 --- a/grpc-server/workflow.go +++ b/grpc-server/workflow.go @@ -272,12 +272,8 @@ func createYaml(ctx context.Context, sqlDB *sql.DB, temp string, tar string) (st } func renderTemplate(tempData string, tarData []byte) (string, error) { - type Target struct { - Hardware map[string]string `json:hardware` - } - var target Target - - err := json.Unmarshal(tarData, &target) + var hardware map[string]interface{} + err := json.Unmarshal(tarData, &hardware) if err != nil { logger.Error(err) return "", nil @@ -291,7 +287,7 @@ func renderTemplate(tempData string, tarData []byte) (string, error) { } buf := new(bytes.Buffer) - err = t.Execute(buf, target) + err = t.Execute(buf, hardware) if err != nil { return "", nil } From d6be5255aa9f79517365b308565cde36e0c57448 Mon Sep 17 00:00:00 2001 From: parauliya Date: Wed, 6 May 2020 17:40:22 +0530 Subject: [PATCH 6/7] Updating the docs with current implementation --- docs/cli/README.md | 4 +-- docs/cli/hardware.md | 1 - docs/cli/target.md | 34 ------------------------- docs/cli/template.md | 3 +-- docs/cli/workflow.md | 14 ++++++----- docs/components.md | 2 +- docs/concepts.md | 27 ++------------------ docs/examples/hello-world.tmpl | 2 +- docs/hello-world.md | 6 +---- docs/writing-workflow.md | 45 +++++++++++++--------------------- 10 files changed, 32 insertions(+), 106 deletions(-) delete mode 100644 docs/cli/target.md diff --git a/docs/cli/README.md b/docs/cli/README.md index fc1fd3c2d..056bfd9f2 100644 --- a/docs/cli/README.md +++ b/docs/cli/README.md @@ -6,14 +6,13 @@ Command line interface for Packet Workflow. ### Synopsis -Command line interface for Packet Workflow. The CLI allows you to update the hardware details with respect to a worker machine. It also enables you to create a template and a target which is eventually used to create a workflow. +Command line interface for Packet Workflow. The CLI allows you to update the hardware details with respect to a worker machine. It also enables you to create a template which is eventually used to create a workflow. ### Operations ```shell hardware tink hardware client help Help about any command - target tink target client template tink template client workflow tink workflow client ``` @@ -27,7 +26,6 @@ Command line interface for Packet Workflow. The CLI allows you to update the har ### See Also - [tink hardware](hardware.md) - Hardware (worker) data operations - - [tink target](target.md) - Target operations - [tink template](template.md) - Template operations - [tink workflow](workflow.md) - Workflow operations diff --git a/docs/cli/hardware.md b/docs/cli/hardware.md index cab8ebff0..484544b59 100644 --- a/docs/cli/hardware.md +++ b/docs/cli/hardware.md @@ -23,7 +23,6 @@ Hardware operations: ### See Also - - [tink target](target.md) - Target operations - [tink template](template.md) - Template operations - [tink workflow](workflow.md) - Workflow operations diff --git a/docs/cli/target.md b/docs/cli/target.md deleted file mode 100644 index 06933cb1b..000000000 --- a/docs/cli/target.md +++ /dev/null @@ -1,34 +0,0 @@ -## tink target - -Target operations. - -### Synopsis - -Target operations: -```shell - create create a target - delete delete a target - get get a target - list list all targets - update update a target -``` - -### Options - -``` - -h, --help help for target -``` - -### Examples - - - The command below creates a workflow target and returns its UUID. - ```shell - $ tink target create '{"targets": {"machine1": {"mac_addr": "98:03:9b:4b:c5:34"}}}' - ``` - -### See Also - - - [tink hardware](hardware.md) - Hardware (worker) data operations - - [tink template](template.md) - Template operations - - [tink workflow](workflow.md) - Workflow operations - diff --git a/docs/cli/template.md b/docs/cli/template.md index ba1077987..232de4578 100644 --- a/docs/cli/template.md +++ b/docs/cli/template.md @@ -16,7 +16,7 @@ Template operations: ### Options ``` - -h, --help help for target + -h, --help help for template ``` ### Examples @@ -47,6 +47,5 @@ Template operations: ### See Also - [tink hardware](hardware.md) - Hardware (worker) data operations - - [tink target](target.md) - Target operations - [tink workflow](workflow.md) - Workflow operations diff --git a/docs/cli/workflow.md b/docs/cli/workflow.md index ec577b528..40220dc73 100644 --- a/docs/cli/workflow.md +++ b/docs/cli/workflow.md @@ -18,20 +18,22 @@ Workflow operations: ### Options ``` - -h, --help help for target + -h, --help help for workflow ``` ### Examples - - Create a workflow using a template and a target + - Create a workflow using a template and hardware devices ```shell - $ tink workflow create -t -r - $ tink workflow create -t edb80a56-b1f2-4502-abf9-17326324192b -r 9356ae1d-6165-4890-908d-7860ed04b421 + $ tink workflow create -t -r + $ tink workflow create -t edb80a56-b1f2-4502-abf9-17326324192b -r {"device_1": "mac/IP"} ``` + #### Note: + 1. The key used in the above command which is "device_1" should be in sync with "worker" field in the template. Click [here](../concepts.md) to check the template structure. + 2. These keys can only contain letter, numbers and underscore. ### See Also - - [tink hardware](hardware.md) - Hardware (worker) data operations - - [tink target](target.md) - Target operations + - [tink hardware](hardware.md) - Hardware (worker) data operations - [tink template](template.md) - Template operations diff --git a/docs/components.md b/docs/components.md index ca44a8bee..3dfd8f279 100644 --- a/docs/components.md +++ b/docs/components.md @@ -10,7 +10,7 @@ Installs operating systems and handles deprovisioning. ### Tinkerbell -Service responsible for processing workflows. It is comprised of a server and a CLI, which communicate over gRPC. The CLI is used to create a workflow along with its building blocks, i.e., a template and a target. +Service responsible for processing workflows. It is comprised of a server and a CLI, which communicate over gRPC. The CLI is used to create a workflow along with its building blocks, i.e., a template hardware devices. ### Hegel diff --git a/docs/concepts.md b/docs/concepts.md index c04159b00..91bdce9d0 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -2,7 +2,7 @@ ### Template -A template is a Go template based definition that defines the overall flow of a workflow. A user must write a template based on a valid template format. Template can consist of custom variable which can be substituted before execution. For example, a target is defined separately and is substituted in a template at the time of creating a workflow. +A template is a Go template based definition that defines the overall flow of a workflow. A user must write a template based on a valid template format. Template can consist of custom variable which can be substituted before execution. For example, a hardware device is defined separately and is substituted in a template at the time of creating a workflow. A template is stored as a blob in the database and is parsed later during the creation of a worflow. A user can CRUD a template using the CLI (`tink template`). Here is a sample workflow template: @@ -12,7 +12,7 @@ name: ubuntu_provisioning global_timeout: 6000 tasks: - name: "os-installation" - worker: "{{index .Targets "machine1" "mac_addr"}}" + worker: "{{.device_1}}" volumes: - /dev:/dev - /dev/console:/dev/console @@ -45,28 +45,6 @@ A template comprises Tasks, which are executed in a sequential manner. A task ca It is important to note that an action can also have its own volumes and environment variables. Therefore, any entry at an action will overwrite the value defined at the task level. For example, in the above template the `MIRROR_HOST` environment variable defined at action `disk-partition` will overwrite the value defined at task level. However, the other actions will receive the original value defined at the task level. -### Targets - -Targets are mapping between the virtual worker name and the actual host. Currently we are refer targets with MAC or IP address. Here is a sample target definition: - -```json -{ - "machine1": { - "ip_addr": "192.168.1.2" - }, - "machine2" : { - "mac_addr": "ca:00:64:b8:2d:00" - } -} -``` - -A target can be accessed in template like (refer above template): - -``` -{{ index .Targets "machine1" "ip_addr"}} -{{ index .Targets "machine2" "mac_addr"}} -``` - ### Provisioner The provisioner machine is the main driver for executing a workflow. A provisioner houses the following components: @@ -104,4 +82,3 @@ The other worker may retrieve and use this data and eventually add some more: ``` ![](img/ephemeral-data.png) - diff --git a/docs/examples/hello-world.tmpl b/docs/examples/hello-world.tmpl index 482723f34..69709b1a4 100644 --- a/docs/examples/hello-world.tmpl +++ b/docs/examples/hello-world.tmpl @@ -3,7 +3,7 @@ name: hello_world_workflow global_timeout: 600 tasks: - name: "hello world" - worker: "{{index .Targets "machine1" "mac_addr"}}" + worker: "{{.device_1}}" actions: - name: "hello_world" image: hello-world diff --git a/docs/hello-world.md b/docs/hello-world.md index b7d052cd2..7c7889b62 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -67,10 +67,6 @@ $ docker push /hello-world ### Workflow We can now define a workflow with the following steps: - - Create a target: - ```shell - $ tink target create '{"targets": {"machine1": {"mac_addr": ""}}}' - ``` - Create a template: ```shell # get the template from examples/hello-world.tmpl and save it @@ -78,7 +74,7 @@ We can now define a workflow with the following steps: ``` - Create a workflow: ```shell - $ tink workflow create -t -r + $ tink workflow create -t -r '{"device_1":"mac/IP"}' ``` - Reboot the worker machine diff --git a/docs/writing-workflow.md b/docs/writing-workflow.md index 4704697fe..bd47798e9 100644 --- a/docs/writing-workflow.md +++ b/docs/writing-workflow.md @@ -1,25 +1,14 @@ # Writing a [Workflow](concepts.md#workflow) -Any workflow comprises two building blocks: target and template. +Any workflow comprises two building blocks: hardware device (worker) and a template. -### Creating a [target](concepts.md#target) +### Creating a [worker](concepts.md#worker) -A target is referred with MAC or IP address. Here is a sample target definition using the MAC address: - -```json -{ - "machine1" : { - "mac_addr": "98:03:9b:4b:c5:34" - } -} -``` - -The command below creates a workflow target and returns its UUID: +A hardware device is a worker machine on which workflow needs to run. +User need to push the hardware details as per the below command: ```shell - $ tink target create '{"targets": {"machine1": {"mac_addr": "98:03:9b:4b:c5:34"}}}' + $ tink hardware push "" ``` - - ### Creating a [template](concepts.md#template) Consider a sample template like the following saved as `/tmp/sample.tmpl`. @@ -30,18 +19,18 @@ name: ubuntu_provisioning global_timeout: 2500 tasks: - name: "os-installation" - worker: "{{index .Targets "machine1" "mac_addr"}}" + worker: "{{.device_1}}" volumes: - /dev:/dev - /lib/firmware:/lib/firmware:ro environment: - MIRROR_HOST: 192.168.1.2 + MIRROR_HOST: actions: - name: "disk-partition" image: disk-partition timeout: 600 environment: - MIRROR_HOST: 192.168.1.3 + MIRROR_HOST: volumes: - /statedir:/statedir - name: "install-root-fs" @@ -61,11 +50,11 @@ Key points: - An action cannot have space (` `) in its name. - Environment variables and volumes at action level overwrites the values for duplicate keys defined at task level. -A target can be accessed in a template like: +A worker can be accessed in a template like: ``` -{{ index .Targets "machine1" "ip_addr"}} -{{ index .Targets "machine2" "mac_addr"}} +{{.device_1}} +{{.device_2}} ``` The following command creates a workflow template and returns a UUID: @@ -76,17 +65,17 @@ The following command creates a workflow template and returns a UUID: ### Creating a [workflow](concepts.md#workflow) -We can create a workflow using the above created (or existing) template and target. +We can create a workflow using the above created (or existing) template and worker. ```shell - $ tink workflow create -t -r - $ tink workflow create -t edb80a56-b1f2-4502-abf9-17326324192b -r 9356ae1d-6165-4890-908d-7860ed04b421 + $ tink workflow create -t -r '{worker machines in json format}' + $ tink workflow create -t edb80a56-b1f2-4502-abf9-17326324192b -r '{"device_1":"mac/IP"}' ``` The above command returns a UUID for the workflow thus created. The workflow ID can be used for getting further details about a workflow. Please refer the [Tinkerbell CLI reference](cli/workflow.md) for the same. -It's a good practice to verify that the targets have been well substituted in the template. In order to do so, use the following command: +It's a good practice to verify that the worker have been well substituted in the template. In order to do so, use the following command: ```yaml - $ tink workflow get edb80a56-b1f2-4502-abf9-17326324192b + $ tink workflow get version: '0.1' name: ubuntu_provisioning @@ -117,5 +106,5 @@ tasks: - /statedir:/statedir ``` -Notice how `worker` is set to the MAC address we had defined in the target. +Notice how `worker` is set to the MAC address we had defined in the input while creating a workflow. From 5a9f4f10aa6ba3151d176fefd12514049117a742 Mon Sep 17 00:00:00 2001 From: parauliya Date: Wed, 6 May 2020 18:54:42 +0530 Subject: [PATCH 7/7] Incorporated some minor review comments --- cli/tink/cmd/workflow/create.go | 2 +- docs/concepts.md | 3 +++ docs/writing-workflow.md | 8 ++++---- grpc-server/workflow.go | 8 ++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cli/tink/cmd/workflow/create.go b/cli/tink/cmd/workflow/create.go index 4260bf0d1..fce3a38b7 100644 --- a/cli/tink/cmd/workflow/create.go +++ b/cli/tink/cmd/workflow/create.go @@ -35,7 +35,7 @@ var createCmd = &cobra.Command{ func addFlags() { flags := createCmd.PersistentFlags() flags.StringVarP(&template, "template", "t", "", "workflow template") - flags.StringVarP(&hardware, "hardware", "r", "", "workflow target hardwares") + flags.StringVarP(&hardware, "hardware", "r", "", "workflow targeted hardwares") createCmd.MarkPersistentFlagRequired(fHardware) createCmd.MarkPersistentFlagRequired(fTemplate) diff --git a/docs/concepts.md b/docs/concepts.md index 91bdce9d0..09aabb325 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -1,5 +1,8 @@ # Concepts +### Hardware +A *hardware device* is defined separately and is substituted in a template at the time of creating a workflow. + ### Template A template is a Go template based definition that defines the overall flow of a workflow. A user must write a template based on a valid template format. Template can consist of custom variable which can be substituted before execution. For example, a hardware device is defined separately and is substituted in a template at the time of creating a workflow. diff --git a/docs/writing-workflow.md b/docs/writing-workflow.md index bd47798e9..718f2478f 100644 --- a/docs/writing-workflow.md +++ b/docs/writing-workflow.md @@ -1,13 +1,13 @@ # Writing a [Workflow](concepts.md#workflow) -Any workflow comprises two building blocks: hardware device (worker) and a template. +Any workflow comprises two building blocks: worker (targeted hardware) and a template. ### Creating a [worker](concepts.md#worker) -A hardware device is a worker machine on which workflow needs to run. +A worker is targeted hardware on which workflow needs to run. User need to push the hardware details as per the below command: ```shell - $ tink hardware push "" + $ tink hardware push "" ``` ### Creating a [template](concepts.md#template) @@ -75,7 +75,7 @@ The above command returns a UUID for the workflow thus created. The workflow ID It's a good practice to verify that the worker have been well substituted in the template. In order to do so, use the following command: ```yaml - $ tink workflow get + $ tink workflow get version: '0.1' name: ubuntu_provisioning diff --git a/grpc-server/workflow.go b/grpc-server/workflow.go index 2d852bda3..85c3b2a2a 100644 --- a/grpc-server/workflow.go +++ b/grpc-server/workflow.go @@ -263,17 +263,17 @@ func (s *server) ShowWorkflowEvents(req *workflow.GetRequest, stream workflow.Wo return nil } -func createYaml(ctx context.Context, sqlDB *sql.DB, temp string, tar string) (string, error) { +func createYaml(ctx context.Context, sqlDB *sql.DB, temp string, devices string) (string, error) { tempData, err := db.GetTemplate(ctx, sqlDB, temp) if err != nil { return "", err } - return renderTemplate(string(tempData), []byte(tar)) + return renderTemplate(string(tempData), []byte(devices)) } -func renderTemplate(tempData string, tarData []byte) (string, error) { +func renderTemplate(tempData string, devices []byte) (string, error) { var hardware map[string]interface{} - err := json.Unmarshal(tarData, &hardware) + err := json.Unmarshal(devices, &hardware) if err != nil { logger.Error(err) return "", nil