mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 06:54:32 +00:00
Merge pull request #3172 from carlisia/c-bsl-imp
Improvements to BSL logic
This commit is contained in:
@@ -182,20 +182,19 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
|
||||
|
||||
if o.DefaultBackupStorageLocation {
|
||||
// There is one and only one default backup storage location.
|
||||
// Disable the origin default backup storage location.
|
||||
// Disable any existing default backup storage location.
|
||||
locations := new(velerov1api.BackupStorageLocationList)
|
||||
if err := kbClient.List(context.Background(), locations, &kbclient.ListOptions{Namespace: f.Namespace()}); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
for _, location := range locations.Items {
|
||||
if !location.Spec.Default {
|
||||
continue
|
||||
if location.Spec.Default {
|
||||
location.Spec.Default = false
|
||||
if err := kbClient.Update(context.Background(), &location, &kbclient.UpdateOptions{}); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
break
|
||||
}
|
||||
location.Spec.Default = false
|
||||
if err := kbClient.Update(context.Background(), &location, &kbclient.UpdateOptions{}); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
|
||||
if showDefaultOnly {
|
||||
if location.Spec.Default {
|
||||
locations.Items = append(locations.Items, *location)
|
||||
break
|
||||
}
|
||||
} else {
|
||||
locations.Items = append(locations.Items, *location)
|
||||
|
||||
@@ -36,7 +36,7 @@ func NewSetCommand(f client.Factory, use string) *cobra.Command {
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: use + " NAME",
|
||||
Short: "Set a backup storage location",
|
||||
Short: "Set specific features for a backup storage location",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
cmd.CheckError(o.Complete(args, f))
|
||||
|
||||
@@ -101,6 +101,7 @@ const (
|
||||
)
|
||||
|
||||
type serverConfig struct {
|
||||
// TODO(2.0) Deprecate defaultBackupLocation
|
||||
pluginDir, metricsAddress, defaultBackupLocation string
|
||||
backupSyncPeriod, podVolumeOperationTimeout, resourceTerminatingTimeout time.Duration
|
||||
defaultBackupTTL, storeValidationFrequency time.Duration
|
||||
@@ -830,8 +831,8 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string
|
||||
Client: s.mgr.GetClient(),
|
||||
Scheme: s.mgr.GetScheme(),
|
||||
DefaultBackupLocationInfo: storage.DefaultBackupLocationInfo{
|
||||
StorageLocation: s.config.defaultBackupLocation,
|
||||
StoreValidationFrequency: s.config.storeValidationFrequency,
|
||||
StorageLocation: s.config.defaultBackupLocation,
|
||||
ServerValidationFrequency: s.config.storeValidationFrequency,
|
||||
},
|
||||
NewPluginManager: newPluginManager,
|
||||
NewBackupStore: persistence.NewObjectBackupStore,
|
||||
|
||||
Reference in New Issue
Block a user