Skip to content

Commit

Permalink
Merge pull request tinkerbell#22 from packethost/rover_to_tinkerbell
Browse files Browse the repository at this point in the history
Changes everything from rover to tinkerbell
  • Loading branch information
nathangoulding authored Mar 18, 2020
2 parents 1769b47 + 05bff50 commit bb59924
Show file tree
Hide file tree
Showing 79 changed files with 329 additions and 319 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.7

ENTRYPOINT [ "/rover" ]
ENTRYPOINT [ "/tinkerbell" ]
EXPOSE 42113
EXPOSE 42114

RUN apk add --no-cache --update --upgrade ca-certificates postgresql-client
RUN apk add --no-cache --update --upgrade --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing cfssl
COPY deploy/migrate /migrate
COPY deploy/docker-entrypoint-initdb.d/rover-init.sql /init.sql
COPY rover-server /rover
COPY deploy/docker-entrypoint-initdb.d/tinkerbell-init.sql /init.sql
COPY tinkerbell-server /tinkerbell
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server := rover-server
cli := rover-cli
worker := rover-worker
server := tinkerbell-server
cli := tinkerbell-cli
worker := tinkerbell-worker
binaries := ${server} ${cli} ${worker}
all: ${binaries}

Expand All @@ -16,14 +16,14 @@ ${server}:
CGO_ENABLED=0 go build -o $@ .

${cli}:
CGO_ENABLED=0 go build -o ./cmd/rover/$@ ./cmd/rover
CGO_ENABLED=0 go build -o ./cmd/tinkerbell/$@ ./cmd/tinkerbell

${worker}:
CGO_ENABLED=0 go build -o ./worker/$@ ./worker/

run: ${binaries}
docker-compose up -d --build db
docker-compose up --build server cli
docker-compose up --build tinkerbell boots
test:
go clean -testcache
go test ./test -v
18 changes: 13 additions & 5 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"net/http"
"os"

"github.com/packethost/rover/protos/hardware"
"github.com/packethost/rover/protos/target"
"github.com/packethost/rover/protos/template"
"github.com/packethost/rover/protos/workflow"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/packethost/tinkerbell/protos/target"
"github.com/packethost/tinkerbell/protos/template"
"github.com/packethost/tinkerbell/protos/workflow"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
Expand Down Expand Up @@ -54,7 +54,7 @@ func GetConnection() (*grpc.ClientConn, error) {
creds := credentials.NewClientTLSFromCert(cp, "")
conn, err := grpc.Dial(grpcAuthority, grpc.WithTransportCredentials(creds))
if err != nil {
return nil, errors.Wrap(err, "connect to rover server")
return nil, errors.Wrap(err, "connect to tinkerbell server")
}
return conn, nil
}
Expand All @@ -70,3 +70,11 @@ func Setup() {
WorkflowClient = workflow.NewWorkflowSvcClient(conn)
HardwareClient = hardware.NewHardwareServiceClient(conn)
}

func NewTinkerbellClient() (hardware.HardwareServiceClient, error) {
conn, err := GetConnection()
if err != nil {
log.Fatal(err)
}
return hardware.NewHardwareServiceClient(conn), nil
}
7 changes: 0 additions & 7 deletions cmd/rover/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/rover/Dockerfile → cmd/tinkerbell/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ FROM alpine:3.7
CMD sleep 60d

RUN apk add --no-cache --update --upgrade ca-certificates
COPY rover-cli /bin/rover
COPY tinkerbell-cli /bin/tinkerbell
COPY sample.tmpl /tmp
6 changes: 3 additions & 3 deletions cmd/rover/cmd/hardware.go → cmd/tinkerbell/cmd/hardware.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package cmd
import (
"fmt"

"github.com/packethost/rover/cmd/rover/cmd/hardware"
"github.com/packethost/tinkerbell/cmd/tinkerbell/cmd/hardware"
"github.com/spf13/cobra"
)

var hardwareCmd = &cobra.Command{
Use: "hardware",
Short: "rover hardware client",
Example: "rover hardware [command]",
Short: "tinkerbell hardware client",
Example: "tinkerbell hardware [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"io"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// SubCommands holds the sub commands for template command
// Example: rover template [subcommand]
// Example: tinkerbell template [subcommand]
var SubCommands []*cobra.Command

func verifyUUIDs(args []string) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"fmt"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var idCmd = &cobra.Command{
Use: "id",
Short: "Get hardware by id",
Example: "rover hardware id 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tinkerbell hardware id 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"fmt"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// ingestCmd represents the ingest command
var ingestCmd = &cobra.Command{
Use: "ingest",
Short: "Trigger rover to ingest",
Long: "This command only signals rover to ingest if it has not already done so.",
Short: "Trigger tinkerbell to ingest",
Long: "This command only signals tinkerbell to ingest if it has not already done so.",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("ingest called")
_, err := client.HardwareClient.Ingest(context.Background(), &hardware.Empty{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"log"
"net"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// ipCmd represents the ip command
var ipCmd = &cobra.Command{
Use: "ip",
Short: "Get hardware by any associated ip",
Example: "rover hardware ip 10.0.0.2 10.0.0.3",
Example: "tinkerbell hardware ip 10.0.0.2 10.0.0.3",
Args: func(_ *cobra.Command, args []string) error {
for _, arg := range args {
if net.ParseIP(arg) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"log"
"net"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// macCmd represents the mac command
var macCmd = &cobra.Command{
Use: "mac",
Short: "Get hardware by any associated mac",
Example: "rover hardware mac 00:00:00:00:00:01 00:00:00:00:00:02",
Example: "tinkerbell hardware mac 00:00:00:00:00:01 00:00:00:00:00:02",
Args: func(_ *cobra.Command, args []string) error {
for _, arg := range args {
if _, err := net.ParseMAC(arg); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"log"
"strings"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// pushCmd represents the push command
var pushCmd = &cobra.Command{
Use: "push",
Short: "Push new hardware to rover",
Example: `rover hardware push '{"id":"2a1519e5-781c-4251-a979-3a6bedb8ba59", ...}' '{"id:"315169a4-a863-43ef-8817-2b6a57bd1eef", ...}'`,
Short: "Push new hardware to tinkerbell",
Example: `tinkerbell hardware push '{"id":"2a1519e5-781c-4251-a979-3a6bedb8ba59", ...}' '{"id:"315169a4-a863-43ef-8817-2b6a57bd1eef", ...}'`,
Args: func(_ *cobra.Command, args []string) error {
s := struct {
ID string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"log"
"sync"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/hardware"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/hardware"
"github.com/spf13/cobra"
)

// watchCmd represents the watch command
var watchCmd = &cobra.Command{
Use: "watch",
Short: "Register to watch an id for any changes",
Example: "rover hardware watch 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tinkerbell hardware watch 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/rover/cmd/root.go → cmd/tinkerbell/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/packethost/rover/client"
"github.com/packethost/tinkerbell/client"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand All @@ -13,8 +13,8 @@ var cfgFile string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "rover",
Short: "rover client",
Use: "tinkerbell",
Short: "tinkerbell client",
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
6 changes: 3 additions & 3 deletions cmd/rover/cmd/target.go → cmd/tinkerbell/cmd/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package cmd
import (
"fmt"

"github.com/packethost/rover/cmd/rover/cmd/target"
"github.com/packethost/tinkerbell/cmd/tinkerbell/cmd/target"
"github.com/spf13/cobra"
)

// templateCmd represents the template sub-command
var targetCmd = &cobra.Command{
Use: "target",
Short: "rover target client",
Example: "rover target [command]",
Short: "tinkerbell target client",
Example: "tinkerbell target [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// SubCommands holds the sub commands for targets command
// Example: rover targets [subcommand]
// Example: tinkerbell targets [subcommand]
var SubCommands []*cobra.Command

func verifyUUIDs(args []string) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"fmt"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/target"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/target"
"github.com/spf13/cobra"
)

// pushCmd represents the push command
var createTargets = &cobra.Command{
Use: "create",
Short: "create a target",
Example: `rover target create '{"targets": {"machine1": {"mac_addr": "02:42:db:98:4b:1e"},"machine2": {"ipv4_addr": "192.168.1.5"}}}'`,
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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"context"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/target"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/target"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "delete a target",
Example: "rover target delete 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tinkerbell target delete 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"fmt"
"log"

"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/target"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/target"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var getCmd = &cobra.Command{
Use: "get",
Short: "get a target",
Example: "rover target get 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tinkerbell target get 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"os"

"github.com/jedib0t/go-pretty/table"
"github.com/packethost/rover/client"
"github.com/packethost/rover/protos/target"
"github.com/packethost/tinkerbell/client"
"github.com/packethost/tinkerbell/protos/target"
"github.com/spf13/cobra"
)

// listCmd represents the list subcommand for target command
var listCmd = &cobra.Command{
Use: "list",
Short: "list all targets",
Example: "rover target list",
Example: "tinkerbell target list",
Args: func(c *cobra.Command, args []string) error {
if len(args) != 0 {
return fmt.Errorf("%v takes no arguments", c.UseLine())
Expand Down
Loading

0 comments on commit bb59924

Please sign in to comment.