Skip to content

Commit

Permalink
Prepend velero.io to non-namespaced names
Browse files Browse the repository at this point in the history
Prior to 1.0, user-provided values such as cloud provider names didn't
need to be namespaced. This change allows those values to continue
working without the user editing the fields manually.

Fixes #1363

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
  • Loading branch information
nrb committed Apr 12, 2019
1 parent abee09a commit bdc20f8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/plugin/clientmgmt/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package clientmgmt

import (
"strings"
"sync"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -124,6 +125,10 @@ func (m *manager) getRestartableProcess(kind framework.PluginKind, name string)

// GetObjectStore returns a restartableObjectStore for name.
func (m *manager) GetObjectStore(name string) (velero.ObjectStore, error) {
// Backwards compatibility with non-namespaced, built-in plugins.
if !strings.Contains(name, "/") {
name = "velero.io/" + name
}
restartableProcess, err := m.getRestartableProcess(framework.PluginKindObjectStore, name)
if err != nil {
return nil, err
Expand All @@ -136,6 +141,10 @@ func (m *manager) GetObjectStore(name string) (velero.ObjectStore, error) {

// GetVolumeSnapshotter returns a restartableVolumeSnapshotter for name.
func (m *manager) GetVolumeSnapshotter(name string) (velero.VolumeSnapshotter, error) {
// Backwards compatibility with non-namespaced, built-in plugins.
if !strings.Contains(name, "/") {
name = "velero.io/" + name
}
restartableProcess, err := m.getRestartableProcess(framework.PluginKindVolumeSnapshotter, name)
if err != nil {
return nil, err
Expand Down Expand Up @@ -168,6 +177,10 @@ func (m *manager) GetBackupItemActions() ([]velero.BackupItemAction, error) {

// GetBackupItemAction returns a restartableBackupItemAction for name.
func (m *manager) GetBackupItemAction(name string) (velero.BackupItemAction, error) {
// Backwards compatibility with non-namespaced, built-in plugins.
if !strings.Contains(name, "/") {
name = "velero.io/" + name
}
restartableProcess, err := m.getRestartableProcess(framework.PluginKindBackupItemAction, name)
if err != nil {
return nil, err
Expand Down Expand Up @@ -199,6 +212,10 @@ func (m *manager) GetRestoreItemActions() ([]velero.RestoreItemAction, error) {

// GetRestoreItemAction returns a restartableRestoreItemAction for name.
func (m *manager) GetRestoreItemAction(name string) (velero.RestoreItemAction, error) {
// Backwards compatibility with non-namespaced, built-in plugins.
if !strings.Contains(name, "/") {
name = "velero.io/" + name
}
restartableProcess, err := m.getRestartableProcess(framework.PluginKindRestoreItemAction, name)
if err != nil {
return nil, err
Expand Down

0 comments on commit bdc20f8

Please sign in to comment.