mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 02:19:28 +00:00
Rename bootcfg code references to matchbox
* Change config drectory to /etc/matchbox * Change data-path to /var/lib/matchbox * Change assets-path to /var/lib/matchbox/assets
This commit is contained in:
@@ -41,17 +41,17 @@ func main() {
|
||||
}{}
|
||||
flag.StringVar(&flags.address, "address", "127.0.0.1:8080", "HTTP listen address")
|
||||
flag.StringVar(&flags.rpcAddress, "rpc-address", "", "RPC listen address")
|
||||
flag.StringVar(&flags.dataPath, "data-path", "/var/lib/bootcfg", "Path to data directory")
|
||||
flag.StringVar(&flags.assetsPath, "assets-path", "/var/lib/bootcfg/assets", "Path to static assets")
|
||||
flag.StringVar(&flags.dataPath, "data-path", "/var/lib/matchbox", "Path to data directory")
|
||||
flag.StringVar(&flags.assetsPath, "assets-path", "/var/lib/matchbox/assets", "Path to static assets")
|
||||
|
||||
// Log levels https://github.com/Sirupsen/logrus/blob/master/logrus.go#L36
|
||||
flag.StringVar(&flags.logLevel, "log-level", "info", "Set the logging level")
|
||||
|
||||
// gRPC Server TLS
|
||||
flag.StringVar(&flags.certFile, "cert-file", "/etc/bootcfg/server.crt", "Path to the server TLS certificate file")
|
||||
flag.StringVar(&flags.keyFile, "key-file", "/etc/bootcfg/server.key", "Path to the server TLS key file")
|
||||
flag.StringVar(&flags.certFile, "cert-file", "/etc/matchbox/server.crt", "Path to the server TLS certificate file")
|
||||
flag.StringVar(&flags.keyFile, "key-file", "/etc/matchbox/server.key", "Path to the server TLS key file")
|
||||
// TLS Client Authentication
|
||||
flag.StringVar(&flags.caFile, "ca-file", "/etc/bootcfg/ca.crt", "Path to the CA verify and authenticate client certificates")
|
||||
flag.StringVar(&flags.caFile, "ca-file", "/etc/matchbox/ca.crt", "Path to the CA verify and authenticate client certificates")
|
||||
|
||||
// Signing
|
||||
flag.StringVar(&flags.keyRingPath, "key-ring-path", "", "Path to a private keyring file")
|
||||
@@ -62,11 +62,11 @@ func main() {
|
||||
|
||||
// parse command-line and environment variable arguments
|
||||
flag.Parse()
|
||||
if err := flagutil.SetFlagsFromEnv(flag.CommandLine, "BOOTCFG"); err != nil {
|
||||
if err := flagutil.SetFlagsFromEnv(flag.CommandLine, "MATCHBOX"); err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
// restrict OpenPGP passphrase to pass via environment variable only
|
||||
passphrase := os.Getenv("BOOTCFG_PASSPHRASE")
|
||||
passphrase := os.Getenv("MATCHBOX_PASSPHRASE")
|
||||
|
||||
if flags.version {
|
||||
fmt.Println(version.Version)
|
||||
@@ -132,7 +132,7 @@ func main() {
|
||||
|
||||
// gRPC Server (feature disabled by default)
|
||||
if flags.rpcAddress != "" {
|
||||
log.Infof("Starting bootcfg gRPC server on %s", flags.rpcAddress)
|
||||
log.Infof("Starting matchbox gRPC server on %s", flags.rpcAddress)
|
||||
log.Infof("Using TLS server certificate: %s", flags.certFile)
|
||||
log.Infof("Using TLS server key: %s", flags.keyFile)
|
||||
log.Infof("Using CA certificate: %s to authenticate client certificates", flags.caFile)
|
||||
@@ -163,7 +163,7 @@ func main() {
|
||||
ArmoredSigner: armoredSigner,
|
||||
}
|
||||
httpServer := web.NewServer(config)
|
||||
log.Infof("Starting bootcfg HTTP server on %s", flags.address)
|
||||
log.Infof("Starting matchbox HTTP server on %s", flags.address)
|
||||
err = http.ListenAndServe(flags.address, httpServer.HTTPHandler())
|
||||
if err != nil {
|
||||
log.Fatalf("failed to start listening: %v", err)
|
||||
|
||||
@@ -14,8 +14,8 @@ var (
|
||||
// RootCmd is the base bootcmd command.
|
||||
RootCmd = &cobra.Command{
|
||||
Use: "bootcmd",
|
||||
Short: "A command line client for the bootcfg service.",
|
||||
Long: `A CLI for the bootcfg Service
|
||||
Short: "A command line client for the matchbox service.",
|
||||
Long: `A CLI for the matchbox Service
|
||||
|
||||
To get help about a resource or command, run "bootcmd help resource"`,
|
||||
}
|
||||
@@ -32,10 +32,10 @@ To get help about a resource or command, run "bootcmd help resource"`,
|
||||
func init() {
|
||||
RootCmd.PersistentFlags().StringSliceVar(&globalFlags.endpoints, "endpoints", []string{"127.0.0.1:8081"}, "gRPC Endpoints")
|
||||
// gRPC TLS Server Verification
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.caFile, "ca-file", "/etc/bootcfg/ca.crt", "Path to the CA bundle to verify certificates of TLS servers")
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.caFile, "ca-file", "/etc/matchbox/ca.crt", "Path to the CA bundle to verify certificates of TLS servers")
|
||||
// gRPC TLS Client Authentication
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.certFile, "cert-file", "/etc/bootcfg/client.crt", "Path to the client TLS certificate file")
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.keyFile, "key-file", "/etc/bootcfg/client.key", "Path to the client TLS key file")
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.certFile, "cert-file", "/etc/matchbox/client.crt", "Path to the client TLS certificate file")
|
||||
RootCmd.PersistentFlags().StringVar(&globalFlags.keyFile, "key-file", "/etc/matchbox/client.key", "Path to the client TLS key file")
|
||||
cobra.EnablePrefixMatching = true
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ type Config struct {
|
||||
TLS *tls.Config
|
||||
}
|
||||
|
||||
// Client provides a bootcfg client RPC session.
|
||||
// Client provides a matchbox client RPC session.
|
||||
type Client struct {
|
||||
Groups rpcpb.GroupsClient
|
||||
Profiles rpcpb.ProfilesClient
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Package client provides the bootcfg gRPC client.
|
||||
// Package client provides the matchbox gRPC client.
|
||||
//
|
||||
// Create a bootcfg gRPC client using `client.New`:
|
||||
// Create a matchbox gRPC client using `client.New`:
|
||||
//
|
||||
// cfg := &client.Config{
|
||||
// Endpoints: []string{"127.0.0.1:8081"},
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package http provides the bootcfg HTTP server
|
||||
// Package http provides the matchbox HTTP server
|
||||
package http
|
||||
|
||||
@@ -18,7 +18,7 @@ func homeHandler() http.Handler {
|
||||
http.NotFound(w, req)
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(w, "bootcfg\n")
|
||||
fmt.Fprintf(w, "matchbox\n")
|
||||
}
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||
chain := func(next ContextHandler) http.Handler {
|
||||
return s.logRequest(NewHandler(next))
|
||||
}
|
||||
// bootcfg version
|
||||
// matchbox version
|
||||
mux.Handle("/", s.logRequest(homeHandler()))
|
||||
// Boot via GRUB
|
||||
mux.Handle("/grub", chain(s.selectProfile(s.core, s.grubHandler())))
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package rpc provides the bootcfg gRPC server
|
||||
// Package rpc provides the matchbox gRPC server
|
||||
package rpc
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
var (
|
||||
// work around go vet false positive https://github.com/grpc/grpc-go/issues/90
|
||||
grpcErrorf = grpc.Errorf
|
||||
errNoMatchingGroup = grpcErrorf(codes.NotFound, "bootcfg: No matching Group")
|
||||
errNoMatchingProfile = grpcErrorf(codes.NotFound, "bootcfg: No matching Profile")
|
||||
errNoMatchingGroup = grpcErrorf(codes.NotFound, "matchbox: No matching Group")
|
||||
errNoMatchingProfile = grpcErrorf(codes.NotFound, "matchbox: No matching Profile")
|
||||
)
|
||||
|
||||
// grpcError transforms an error into a gRPC errors with canonical error codes.
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pb "github.com/coreos/coreos-baremetal/matchbox/server/serverpb"
|
||||
)
|
||||
|
||||
// groupServer takes a bootcfg Server and implements a gRPC GroupsServer.
|
||||
// groupServer takes a matchbox Server and implements a gRPC GroupsServer.
|
||||
type groupServer struct {
|
||||
srv server.Server
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/coreos/coreos-baremetal/matchbox/server"
|
||||
)
|
||||
|
||||
// NewServer wraps the bootcfg Server to return a new gRPC Server.
|
||||
// NewServer wraps the matchbox Server to return a new gRPC Server.
|
||||
func NewServer(s server.Server, tls *tls.Config) *grpc.Server {
|
||||
var opts []grpc.ServerOption
|
||||
if tls != nil {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pb "github.com/coreos/coreos-baremetal/matchbox/server/serverpb"
|
||||
)
|
||||
|
||||
// ignitionServer takes a bootcfg Server and implements a gRPC IgnitionServer.
|
||||
// ignitionServer takes a matchbox Server and implements a gRPC IgnitionServer.
|
||||
type ignitionServer struct {
|
||||
srv server.Server
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pb "github.com/coreos/coreos-baremetal/matchbox/server/serverpb"
|
||||
)
|
||||
|
||||
// profileServer takes a bootcfg Server and implements a gRPC ProfilesServer.
|
||||
// profileServer takes a matchbox Server and implements a gRPC ProfilesServer.
|
||||
type profileServer struct {
|
||||
srv server.Server
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package rpcpb;
|
||||
|
||||
import "github.com/coreos/coreos-baremetal/bootcfg/server/serverpb/messages.proto";
|
||||
import "github.com/coreos/coreos-baremetal/matchbox/server/serverpb/messages.proto";
|
||||
|
||||
service Groups {
|
||||
// Create a Group.
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pb "github.com/coreos/coreos-baremetal/matchbox/server/serverpb"
|
||||
)
|
||||
|
||||
// selectServer wraps a bootcfg Server to be suitable for gRPC registration.
|
||||
// selectServer wraps a matchbox Server to be suitable for gRPC registration.
|
||||
type selectServer struct {
|
||||
srv server.Server
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package server is a bootcfg library package for implementing servers.
|
||||
// Package server is a matchbox library package for implementing servers.
|
||||
package server
|
||||
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
|
||||
// Possible service errors
|
||||
var (
|
||||
ErrNoMatchingGroup = errors.New("bootcfg: No matching Group")
|
||||
ErrNoMatchingProfile = errors.New("bootcfg: No matching Profile")
|
||||
ErrNoMatchingGroup = errors.New("matchbox: No matching Group")
|
||||
ErrNoMatchingProfile = errors.New("matchbox: No matching Profile")
|
||||
)
|
||||
|
||||
// Server defines a bootcfg server lib.
|
||||
// Server defines the matchbox server interface.
|
||||
type Server interface {
|
||||
// SelectGroup returns the Group matching the given labels.
|
||||
SelectGroup(context.Context, *pb.SelectGroupRequest) (*storagepb.Group, error)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package serverpb provides bootcfg message types.
|
||||
// Package serverpb provides matchbox message types.
|
||||
package serverpb
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package serverpb;
|
||||
|
||||
import "github.com/coreos/coreos-baremetal/bootcfg/storage/storagepb/storage.proto";
|
||||
import "github.com/coreos/coreos-baremetal/matchbox/storage/storagepb/storage.proto";
|
||||
|
||||
message SelectGroupRequest {
|
||||
map<string, string> labels = 1;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package sign adds signatures to bootcfg responses.
|
||||
// Package sign adds signatures to matchbox responses.
|
||||
package sign
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Package storage defines bootcfg's storage and object types.
|
||||
// Package storage defines matchbox's storage and object types.
|
||||
package storage
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestDir(t *testing.T) {
|
||||
{"d/e/ff", "d/e/ff"},
|
||||
{"d/e/ff/../gg", "d/e/gg"},
|
||||
}
|
||||
tdir, err := ioutil.TempDir("", "bootcfg")
|
||||
tdir, err := ioutil.TempDir("", "matchbox")
|
||||
assert.Nil(t, err)
|
||||
defer os.RemoveAll(tdir)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Package version provides the bootcfg version.
|
||||
// Package version provides the matchbox version.
|
||||
package version
|
||||
|
||||
// Version provided by compile time -ldflags.
|
||||
|
||||
Reference in New Issue
Block a user