Skip to content

Commit f628dc7

Browse files
Change managed backup repo to volume repo. (#368)
1 parent 90f10f3 commit f628dc7

20 files changed

+411
-407
lines changed

api/v1beta1/solrbackup_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type SolrBackupSpec struct {
4141
// +optional
4242
RepositoryName string `json:"repositoryName,omitempty"`
4343

44-
// The list of collections to backup. If empty, all collections in the cloud will be backed up.
44+
// The list of collections to backup.
4545
// +optional
4646
Collections []string `json:"collections,omitempty"`
4747

api/v1beta1/solrcloud_types.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const (
5454

5555
DefaultBasicAuthUsername = "k8s-oper"
5656

57-
LegacyBackupRepositoryName = "legacy_local_repository"
57+
LegacyBackupRepositoryName = "legacy_volume_repository"
5858
)
5959

6060
// SolrCloudSpec defines the desired state of SolrCloud
@@ -192,8 +192,8 @@ func (spec *SolrCloudSpec) withDefaults() (changed bool) {
192192
if spec.StorageOptions.BackupRestoreOptions != nil {
193193
spec.BackupRepositories = append(spec.BackupRepositories, SolrBackupRepository{
194194
Name: LegacyBackupRepositoryName,
195-
Managed: &ManagedRepository{
196-
Volume: spec.StorageOptions.BackupRestoreOptions.Volume,
195+
Volume: &VolumeRepository{
196+
Source: spec.StorageOptions.BackupRestoreOptions.Volume,
197197
Directory: spec.StorageOptions.BackupRestoreOptions.Directory,
198198
},
199199
})
@@ -253,7 +253,7 @@ type SolrDataStorageOptions struct {
253253
EphemeralStorage *SolrEphemeralDataStorageOptions `json:"ephemeral,omitempty"`
254254

255255
// Options required for backups to be enabled for this solrCloud.
256-
// Deprecated: Use a SolrBackupRepository with a ManagedRepository instead
256+
// Deprecated: Use a SolrBackupRepository with a VolumeRepository instead
257257
// TODO: Remove in v0.6.0
258258
// +optional
259259
BackupRestoreOptions *SolrBackupRestoreOptions `json:"backupRestoreOptions,omitempty"`
@@ -362,19 +362,19 @@ type SolrEphemeralDataStorageOptions struct {
362362
EmptyDir *corev1.EmptyDirVolumeSource `json:"emptyDir,omitempty"`
363363
}
364364

365-
// Deprecated: Use a SolrBackupRepository with a ManagedRepository instead
365+
// Deprecated: Use a SolrBackupRepository with a VolumeRepository instead
366366
type SolrBackupRestoreOptions struct {
367367
// This is a volumeSource for a volume that will be mounted to all solrNodes to store backups and load restores.
368368
// The data within the volume will be namespaces for this instance, so feel free to use the same volume for multiple clouds.
369369
// Since the volume will be mounted to all solrNodes, it must be able to be written from multiple pods.
370370
// If a PVC reference is given, the PVC must have `accessModes: - ReadWriteMany`.
371371
// Other options are to use a NFS volume.
372-
// Deprecated: Create an explicit 'managedRepositories' entry instead.
372+
// Deprecated: Create an explicit 'backupRepositories' entry instead.
373373
Volume corev1.VolumeSource `json:"volume"`
374374

375375
// Select a custom directory name to mount the backup/restore data from the given volume.
376376
// If not specified, then the name of the solrcloud will be used by default.
377-
// Deprecated: Create an explicit 'managedRepositories' entry instead.
377+
// Deprecated: Create an explicit 'backupRepositories' entry instead.
378378
// +optional
379379
Directory string `json:"directory,omitempty"`
380380
}
@@ -402,7 +402,7 @@ type SolrBackupRepository struct {
402402
// Repositories defined here are considered "managed" and can take advantage of special operator features, such as
403403
// post-backup compression.
404404
//+optional
405-
Managed *ManagedRepository `json:"managed,omitempty"`
405+
Volume *VolumeRepository `json:"volume,omitempty"`
406406
}
407407

408408
type GcsRepository struct {
@@ -465,15 +465,15 @@ type S3Credentials struct {
465465
CredentialsFileSecret *corev1.SecretKeySelector `json:"credentialsFileSecret,omitempty"`
466466
}
467467

468-
type ManagedRepository struct {
468+
type VolumeRepository struct {
469469
// This is a volumeSource for a volume that will be mounted to all solrNodes to store backups and load restores.
470470
// The data within the volume will be namespaced for this instance, so feel free to use the same volume for multiple clouds.
471471
// Since the volume will be mounted to all solrNodes, it must be able to be written from multiple pods.
472472
// If a PVC reference is given, the PVC must have `accessModes: - ReadWriteMany`.
473473
// Other options are to use a NFS volume.
474-
Volume corev1.VolumeSource `json:"volume"`
474+
Source corev1.VolumeSource `json:"source"`
475475

476-
// Select a custom directory name to mount the backup/restore data from the given volume.
476+
// Select a custom directory name to mount the backup/restore data in the given volume.
477477
// If not specified, then the name of the solrcloud will be used by default.
478478
// +optional
479479
Directory string `json:"directory,omitempty"`

api/v1beta1/solrcloud_with_defaults_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func TestDeprecatedBackupRepo(t *testing.T) {
4646
var solrCloudTest *SolrCloud
4747
backupRepos := []SolrBackupRepository{
4848
{
49-
Name: "managedrepository1",
50-
Managed: &ManagedRepository{
51-
Volume: corev1.VolumeSource{},
49+
Name: "volumerepository1",
50+
Volume: &VolumeRepository{
51+
Source: corev1.VolumeSource{},
5252
},
5353
},
5454
{
@@ -99,7 +99,7 @@ func TestDeprecatedBackupRepo(t *testing.T) {
9999
func assertLegacyBackupRepo(t *testing.T, repository SolrBackupRepository, volume corev1.VolumeSource, dir string) {
100100
assert.Equal(t, LegacyBackupRepositoryName, repository.Name, "Wrong name for the legacy backup repo")
101101
assert.Nil(t, repository.GCS, "Legacy backup repo should not have GCS specs")
102-
assert.NotNil(t, repository.Managed, "Legacy backup repo must have Managed specs")
103-
assert.EqualValuesf(t, volume, repository.Managed.Volume, "Volume incorrectly copied over for legacy backup repo")
104-
assert.Equal(t, dir, repository.Managed.Directory, "Directory incorrectly copied over for legacy backup repo")
102+
assert.NotNil(t, repository.Volume, "Legacy backup repo must have Volume specs")
103+
assert.EqualValuesf(t, volume, repository.Volume.Source, "Volume Source incorrectly copied over for legacy backup repo")
104+
assert.Equal(t, dir, repository.Volume.Directory, "Directory incorrectly copied over for legacy backup repo")
105105
}

api/v1beta1/zz_generated.deepcopy.go

+19-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/solr.apache.org_solrbackups.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
description: SolrBackupSpec defines the desired state of SolrBackup
7373
properties:
7474
collections:
75-
description: The list of collections to backup. If empty, all collections in the cloud will be backed up.
75+
description: The list of collections to backup.
7676
items:
7777
type: string
7878
type: array

0 commit comments

Comments
 (0)