Rename Ark to Velero!!!

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
This commit is contained in:
Nolan Brubaker
2019-02-04 17:35:22 -05:00
committed by Andy Goldstein
parent bbc6caf7fe
commit 43714caaec
411 changed files with 12857 additions and 3522 deletions
+13 -13
View File
@@ -19,7 +19,7 @@ package plugin
import (
"encoding/json"
"github.com/hashicorp/go-plugin"
plugin "github.com/hashicorp/go-plugin"
"github.com/pkg/errors"
"golang.org/x/net/context"
"google.golang.org/grpc"
@@ -27,9 +27,9 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
api "github.com/heptio/ark/pkg/apis/ark/v1"
arkbackup "github.com/heptio/ark/pkg/backup"
proto "github.com/heptio/ark/pkg/plugin/generated"
api "github.com/heptio/velero/pkg/apis/velero/v1"
velerobackup "github.com/heptio/velero/pkg/backup"
proto "github.com/heptio/velero/pkg/plugin/generated"
)
// BackupItemActionPlugin is an implementation of go-plugin's Plugin
@@ -70,13 +70,13 @@ func newBackupItemActionGRPCClient(base *clientBase, clientConn *grpc.ClientConn
}
}
func (c *BackupItemActionGRPCClient) AppliesTo() (arkbackup.ResourceSelector, error) {
func (c *BackupItemActionGRPCClient) AppliesTo() (velerobackup.ResourceSelector, error) {
res, err := c.grpcClient.AppliesTo(context.Background(), &proto.AppliesToRequest{Plugin: c.plugin})
if err != nil {
return arkbackup.ResourceSelector{}, err
return velerobackup.ResourceSelector{}, err
}
return arkbackup.ResourceSelector{
return velerobackup.ResourceSelector{
IncludedNamespaces: res.IncludedNamespaces,
ExcludedNamespaces: res.ExcludedNamespaces,
IncludedResources: res.IncludedResources,
@@ -85,7 +85,7 @@ func (c *BackupItemActionGRPCClient) AppliesTo() (arkbackup.ResourceSelector, er
}, nil
}
func (c *BackupItemActionGRPCClient) Execute(item runtime.Unstructured, backup *api.Backup) (runtime.Unstructured, []arkbackup.ResourceIdentifier, error) {
func (c *BackupItemActionGRPCClient) Execute(item runtime.Unstructured, backup *api.Backup) (runtime.Unstructured, []velerobackup.ResourceIdentifier, error) {
itemJSON, err := json.Marshal(item.UnstructuredContent())
if err != nil {
return nil, nil, err
@@ -112,10 +112,10 @@ func (c *BackupItemActionGRPCClient) Execute(item runtime.Unstructured, backup *
return nil, nil, err
}
var additionalItems []arkbackup.ResourceIdentifier
var additionalItems []velerobackup.ResourceIdentifier
for _, itm := range res.AdditionalItems {
newItem := arkbackup.ResourceIdentifier{
newItem := velerobackup.ResourceIdentifier{
GroupResource: schema.GroupResource{
Group: itm.Group,
Resource: itm.Resource,
@@ -146,13 +146,13 @@ type BackupItemActionGRPCServer struct {
mux *serverMux
}
func (s *BackupItemActionGRPCServer) getImpl(name string) (arkbackup.ItemAction, error) {
func (s *BackupItemActionGRPCServer) getImpl(name string) (velerobackup.ItemAction, error) {
impl, err := s.mux.getHandler(name)
if err != nil {
return nil, err
}
itemAction, ok := impl.(arkbackup.ItemAction)
itemAction, ok := impl.(velerobackup.ItemAction)
if !ok {
return nil, errors.Errorf("%T is not a backup item action", impl)
}
@@ -224,7 +224,7 @@ func (s *BackupItemActionGRPCServer) Execute(ctx context.Context, req *proto.Exe
return res, nil
}
func backupResourceIdentifierToProto(id arkbackup.ResourceIdentifier) *proto.ResourceIdentifier {
func backupResourceIdentifierToProto(id velerobackup.ResourceIdentifier) *proto.ResourceIdentifier {
return &proto.ResourceIdentifier{
Group: id.Group,
Resource: id.Resource,
+7 -7
View File
@@ -28,11 +28,11 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/backup"
"github.com/heptio/ark/pkg/backup/mocks"
proto "github.com/heptio/ark/pkg/plugin/generated"
arktest "github.com/heptio/ark/pkg/util/test"
v1 "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/backup"
"github.com/heptio/velero/pkg/backup/mocks"
proto "github.com/heptio/velero/pkg/plugin/generated"
velerotest "github.com/heptio/velero/pkg/util/test"
)
func TestBackupItemActionGRPCServerExecute(t *testing.T) {
@@ -72,7 +72,7 @@ func TestBackupItemActionGRPCServerExecute(t *testing.T) {
invalidBackup := []byte("this is gibberish json")
validBackup := []byte(`
{
"apiVersion": "ark.heptio.com/v1",
"apiVersion": "velero.io/v1",
"kind": "Backup",
"metadata": {
"namespace": "myns",
@@ -154,7 +154,7 @@ func TestBackupItemActionGRPCServerExecute(t *testing.T) {
}
s := &BackupItemActionGRPCServer{mux: &serverMux{
serverLog: arktest.NewLogger(),
serverLog: velerotest.NewLogger(),
handlers: map[string]interface{}{
"xyz": itemAction,
},
+2 -2
View File
@@ -26,8 +26,8 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"github.com/heptio/ark/pkg/cloudprovider"
proto "github.com/heptio/ark/pkg/plugin/generated"
"github.com/heptio/velero/pkg/cloudprovider"
proto "github.com/heptio/velero/pkg/plugin/generated"
)
// BlockStorePlugin is an implementation of go-plugin's Plugin
+3 -3
View File
@@ -33,7 +33,7 @@ type clientBuilder struct {
}
// newClientBuilder returns a new clientBuilder with commandName to name. If the command matches the currently running
// process (i.e. ark), this also sets commandArgs to the internal Ark command to run plugins.
// process (i.e. velero), this also sets commandArgs to the internal Velero command to run plugins.
func newClientBuilder(command string, logger logrus.FieldLogger, logLevel logrus.Level) *clientBuilder {
b := &clientBuilder{
commandName: command,
@@ -41,7 +41,7 @@ func newClientBuilder(command string, logger logrus.FieldLogger, logLevel logrus
pluginLogger: newLogrusAdapter(logger, logLevel),
}
if command == os.Args[0] {
// For plugins compiled into the ark executable, we need to run "ark run-plugins"
// For plugins compiled into the velero executable, we need to run "velero run-plugins"
b.commandArgs = []string{"run-plugins"}
}
return b
@@ -67,7 +67,7 @@ func (b *clientBuilder) clientConfig() *hcplugin.ClientConfig {
}
}
// client creates a new go-plugin Client with support for all of Ark's plugin kinds (BackupItemAction, BlockStore,
// client creates a new go-plugin Client with support for all of Velero's plugin kinds (BackupItemAction, BlockStore,
// ObjectStore, PluginLister, RestoreItemAction).
func (b *clientBuilder) client() *hcplugin.Client {
return hcplugin.NewClient(b.clientConfig())
+4 -4
View File
@@ -24,14 +24,14 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/heptio/ark/pkg/util/test"
"github.com/heptio/velero/pkg/util/test"
)
func TestNewClientBuilder(t *testing.T) {
logger := test.NewLogger()
logLevel := logrus.InfoLevel
cb := newClientBuilder("ark", logger, logLevel)
assert.Equal(t, cb.commandName, "ark")
cb := newClientBuilder("velero", logger, logLevel)
assert.Equal(t, cb.commandName, "velero")
assert.Empty(t, cb.commandArgs)
assert.Equal(t, newLogrusAdapter(logger, logLevel), cb.pluginLogger)
@@ -44,7 +44,7 @@ func TestNewClientBuilder(t *testing.T) {
func TestClientConfig(t *testing.T) {
logger := test.NewLogger()
logLevel := logrus.InfoLevel
cb := newClientBuilder("ark", logger, logLevel)
cb := newClientBuilder("velero", logger, logLevel)
expected := &hcplugin.ClientConfig{
HandshakeConfig: Handshake,
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"github.com/heptio/ark/pkg/util/test"
"github.com/heptio/velero/pkg/util/test"
)
type fakeClient struct {
+1 -1
View File
@@ -18,7 +18,7 @@ package plugin
import plugin "github.com/hashicorp/go-plugin"
// Interface represents an Ark plugin.
// Interface represents a Velero plugin.
type Interface interface {
plugin.Plugin
+6 -6
View File
@@ -19,11 +19,11 @@ package plugin
import (
"github.com/sirupsen/logrus"
"github.com/heptio/ark/pkg/util/logging"
"github.com/heptio/velero/pkg/util/logging"
)
// NewLogger returns a logger that is suitable for use within an
// Ark plugin.
// Velero plugin.
func NewLogger() logrus.FieldLogger {
logger := logrus.New()
/*
@@ -31,7 +31,7 @@ func NewLogger() logrus.FieldLogger {
go-plugin uses stdout for a communications protocol between client and server.
stderr is used for log messages from server to client. The ark server makes sure they are logged to stdout.
stderr is used for log messages from server to client. The velero server makes sure they are logged to stdout.
*/
// we use the JSON formatter because go-plugin will parse incoming
@@ -41,18 +41,18 @@ func NewLogger() logrus.FieldLogger {
// this is the hclog-compatible message field
logrus.FieldKeyMsg: "@message",
},
// Ark server already adds timestamps when emitting logs, so
// Velero server already adds timestamps when emitting logs, so
// don't do it within the plugin.
DisableTimestamp: true,
}
// set a logger name for the location hook which will signal to the Ark
// set a logger name for the location hook which will signal to the Velero
// server logger that the location has been set within a hook.
logger.Hooks.Add((&logging.LogLocationHook{}).WithLoggerName("plugin"))
// this hook adjusts the string representation of WarnLevel to "warn"
// rather than "warning" to make it parseable by go-plugin within the
// Ark server code
// Velero server code
logger.Hooks.Add(&logging.HcLogLevelHook{})
return logger
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/heptio/ark/pkg/util/logging"
"github.com/heptio/velero/pkg/util/logging"
)
func TestNewLogger(t *testing.T) {
+2 -2
View File
@@ -43,10 +43,10 @@ func argsToFields(args ...interface{}) logrus.Fields {
switch args[i] {
case "time", "timestamp", "level":
// remove `time` & `timestamp` because this info will be added
// by the Ark logger and we don't want to have duplicated
// by the Velero logger and we don't want to have duplicated
// fields.
//
// remove `level` because it'll be added by the Ark logger based
// remove `level` because it'll be added by the Velero logger based
// on the call we make (and go-plugin is determining which level
// to log at based on the hclog-compatible `@level` field which
// we're adding via HcLogLevelHook).
+3 -3
View File
@@ -21,9 +21,9 @@ import (
"github.com/sirupsen/logrus"
"github.com/heptio/ark/pkg/backup"
"github.com/heptio/ark/pkg/cloudprovider"
"github.com/heptio/ark/pkg/restore"
"github.com/heptio/velero/pkg/backup"
"github.com/heptio/velero/pkg/cloudprovider"
"github.com/heptio/velero/pkg/restore"
)
// Manager manages the lifecycles of plugins.
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/heptio/ark/pkg/util/test"
"github.com/heptio/velero/pkg/util/test"
)
type mockRegistry struct {
+3 -3
View File
@@ -16,11 +16,11 @@ limitations under the License.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import backup "github.com/heptio/ark/pkg/backup"
import cloudprovider "github.com/heptio/ark/pkg/cloudprovider"
import backup "github.com/heptio/velero/pkg/backup"
import cloudprovider "github.com/heptio/velero/pkg/cloudprovider"
import mock "github.com/stretchr/testify/mock"
import restore "github.com/heptio/ark/pkg/restore"
import restore "github.com/heptio/velero/pkg/restore"
// Manager is an autogenerated mock type for the Manager type
type Manager struct {
+1 -1
View File
@@ -18,7 +18,7 @@ package mocks
import logrus "github.com/sirupsen/logrus"
import mock "github.com/stretchr/testify/mock"
import plugin "github.com/heptio/ark/pkg/plugin"
import plugin "github.com/heptio/velero/pkg/plugin"
// ProcessFactory is an autogenerated mock type for the ProcessFactory type
type ProcessFactory struct {
+2 -2
View File
@@ -25,8 +25,8 @@ import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/heptio/ark/pkg/cloudprovider"
proto "github.com/heptio/ark/pkg/plugin/generated"
"github.com/heptio/velero/pkg/cloudprovider"
proto "github.com/heptio/velero/pkg/plugin/generated"
)
const byteChunkSize = 16384
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/heptio/ark/pkg/util/test"
"github.com/heptio/velero/pkg/util/test"
)
func TestClientLogger(t *testing.T) {
+3 -3
View File
@@ -20,7 +20,7 @@ import (
)
// PluginKind is a type alias for a string that describes
// the kind of an Ark-supported plugin.
// the kind of a Velero-supported plugin.
type PluginKind string
// String returns the string for k.
@@ -45,8 +45,8 @@ const (
PluginKindPluginLister PluginKind = "PluginLister"
)
// allPluginKinds contains all the valid plugin kinds that Ark supports, excluding PluginLister because that is not a
// kind that a developer would ever need to implement (it's handled by Ark and the Ark plugin library code).
// allPluginKinds contains all the valid plugin kinds that Velero supports, excluding PluginLister because that is not a
// kind that a developer would ever need to implement (it's handled by Velero and the Velero plugin library code).
var allPluginKinds = sets.NewString(
PluginKindObjectStore.String(),
PluginKindBlockStore.String(),
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"google.golang.org/grpc"
proto "github.com/heptio/ark/pkg/plugin/generated"
proto "github.com/heptio/velero/pkg/plugin/generated"
)
// PluginIdenitifer uniquely identifies a plugin by command, kind, and name.
+2 -2
View File
@@ -23,7 +23,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/heptio/ark/pkg/util/filesystem"
"github.com/heptio/velero/pkg/util/filesystem"
)
// Registry manages information about available plugins.
@@ -75,7 +75,7 @@ func (r *registry) DiscoverPlugins() error {
return err
}
// Start by adding ark's internal plugins
// Start by adding velero's internal plugins
commands := []string{os.Args[0]}
// Then add the discovered plugin executables
commands = append(commands, plugins...)
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/heptio/ark/pkg/util/test"
"github.com/heptio/velero/pkg/util/test"
)
func TestNewRegistry(t *testing.T) {
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
api "github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/backup"
api "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/backup"
)
// restartableBackupItemAction is a backup item action for a given implementation (such as "pod"). It is associated with
@@ -25,9 +25,9 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/backup"
"github.com/heptio/ark/pkg/backup/mocks"
v1 "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/backup"
"github.com/heptio/velero/pkg/backup/mocks"
)
func TestRestartableGetBackupItemAction(t *testing.T) {
@@ -115,7 +115,7 @@ func TestRestartableBackupItemActionDelegatedFunctions(t *testing.T) {
additionalItems := []backup.ResourceIdentifier{
{
GroupResource: schema.GroupResource{Group: "ark.heptio.com", Resource: "backups"},
GroupResource: schema.GroupResource{Group: "velero.io", Resource: "backups"},
},
}
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"github.com/heptio/ark/pkg/cloudprovider"
"github.com/heptio/velero/pkg/cloudprovider"
)
// restartableBlockStore is an object store for a given implementation (such as "aws"). It is associated with
+1 -1
View File
@@ -25,7 +25,7 @@ import (
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"github.com/heptio/ark/pkg/cloudprovider/mocks"
"github.com/heptio/velero/pkg/cloudprovider/mocks"
)
func TestRestartableGetBlockStore(t *testing.T) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/pkg/errors"
"github.com/heptio/ark/pkg/cloudprovider"
"github.com/heptio/velero/pkg/cloudprovider"
)
// restartableObjectStore is an object store for a given implementation (such as "aws"). It is associated with
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cloudprovidermocks "github.com/heptio/ark/pkg/cloudprovider/mocks"
cloudprovidermocks "github.com/heptio/velero/pkg/cloudprovider/mocks"
)
func TestRestartableGetObjectStore(t *testing.T) {
@@ -19,8 +19,8 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
api "github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/restore"
api "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/restore"
)
// restartableRestoreItemAction is a restore item action for a given implementation (such as "pod"). It is associated with
@@ -24,9 +24,9 @@ import (
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/restore"
"github.com/heptio/ark/pkg/restore/mocks"
v1 "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/restore"
"github.com/heptio/velero/pkg/restore/mocks"
)
func TestRestartableGetRestoreItemAction(t *testing.T) {
+4 -4
View File
@@ -19,16 +19,16 @@ package plugin
import (
"encoding/json"
"github.com/hashicorp/go-plugin"
plugin "github.com/hashicorp/go-plugin"
"github.com/pkg/errors"
"golang.org/x/net/context"
"google.golang.org/grpc"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
api "github.com/heptio/ark/pkg/apis/ark/v1"
proto "github.com/heptio/ark/pkg/plugin/generated"
"github.com/heptio/ark/pkg/restore"
api "github.com/heptio/velero/pkg/apis/velero/v1"
proto "github.com/heptio/velero/pkg/plugin/generated"
"github.com/heptio/velero/pkg/restore"
)
// RestoreItemActionPlugin is an implementation of go-plugin's Plugin
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
)
// HandlerInitializer is a function that initializes and returns a new instance of one of Ark's plugin interfaces
// HandlerInitializer is a function that initializes and returns a new instance of one of Velero's plugin interfaces
// (ObjectStore, BlockStore, BackupItemAction, RestoreItemAction).
type HandlerInitializer func(logger logrus.FieldLogger) (interface{}, error)