From bf401eb51ae995d49a70d584038f0066f4715b10 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 12 Jun 2024 16:19:33 +0200 Subject: [PATCH] Factor out duplicate code in the backup-providers (#90) --- api/v1/backup.pb.go | 14 ++-- api/v1/database.pb.go | 8 +-- api/v1/initializer.pb.go | 8 +-- .../backup/providers/common/common.go | 34 +++++++++ .../backup/providers/common/common_test.go | 71 +++++++++++++++++++ cmd/internal/backup/providers/contract.go | 4 +- cmd/internal/backup/providers/gcp/gcp.go | 2 +- cmd/internal/backup/providers/gcp/versions.go | 37 +++------- cmd/internal/backup/providers/local/local.go | 2 +- .../backup/providers/local/local_test.go | 6 +- .../backup/providers/local/versions.go | 36 +++------- cmd/internal/backup/providers/s3/s3.go | 2 +- cmd/internal/backup/providers/s3/versions.go | 39 +++------- cmd/internal/initializer/initializer.go | 9 +-- cmd/internal/initializer/service.go | 4 +- cmd/main.go | 4 +- go.mod | 14 ++-- go.sum | 30 ++++---- proto/buf.gen.yaml | 2 +- 19 files changed, 189 insertions(+), 137 deletions(-) create mode 100644 cmd/internal/backup/providers/common/common.go create mode 100644 cmd/internal/backup/providers/common/common_test.go diff --git a/api/v1/backup.pb.go b/api/v1/backup.pb.go index 5c4d27f..ab51dca 100644 --- a/api/v1/backup.pb.go +++ b/api/v1/backup.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: v1/backup.proto @@ -309,7 +309,7 @@ func file_v1_backup_proto_rawDescGZIP() []byte { } var file_v1_backup_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_v1_backup_proto_goTypes = []interface{}{ +var file_v1_backup_proto_goTypes = []any{ (*ListBackupsRequest)(nil), // 0: v1.ListBackupsRequest (*BackupListResponse)(nil), // 1: v1.BackupListResponse (*Backup)(nil), // 2: v1.Backup @@ -337,7 +337,7 @@ func file_v1_backup_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_v1_backup_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_v1_backup_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ListBackupsRequest); i { case 0: return &v.state @@ -349,7 +349,7 @@ func file_v1_backup_proto_init() { return nil } } - file_v1_backup_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_backup_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*BackupListResponse); i { case 0: return &v.state @@ -361,7 +361,7 @@ func file_v1_backup_proto_init() { return nil } } - file_v1_backup_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_v1_backup_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Backup); i { case 0: return &v.state @@ -373,7 +373,7 @@ func file_v1_backup_proto_init() { return nil } } - file_v1_backup_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_v1_backup_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*RestoreBackupRequest); i { case 0: return &v.state @@ -385,7 +385,7 @@ func file_v1_backup_proto_init() { return nil } } - file_v1_backup_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_v1_backup_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*RestoreBackupResponse); i { case 0: return &v.state diff --git a/api/v1/database.pb.go b/api/v1/database.pb.go index 6279a9a..965b12a 100644 --- a/api/v1/database.pb.go +++ b/api/v1/database.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: v1/database.proto @@ -131,7 +131,7 @@ func file_v1_database_proto_rawDescGZIP() []byte { } var file_v1_database_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_v1_database_proto_goTypes = []interface{}{ +var file_v1_database_proto_goTypes = []any{ (*CreateBackupRequest)(nil), // 0: v1.CreateBackupRequest (*CreateBackupResponse)(nil), // 1: v1.CreateBackupResponse } @@ -151,7 +151,7 @@ func file_v1_database_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_v1_database_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_v1_database_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*CreateBackupRequest); i { case 0: return &v.state @@ -163,7 +163,7 @@ func file_v1_database_proto_init() { return nil } } - file_v1_database_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_database_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*CreateBackupResponse); i { case 0: return &v.state diff --git a/api/v1/initializer.pb.go b/api/v1/initializer.pb.go index a8e111f..791dc15 100644 --- a/api/v1/initializer.pb.go +++ b/api/v1/initializer.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: v1/initializer.proto @@ -210,7 +210,7 @@ func file_v1_initializer_proto_rawDescGZIP() []byte { var file_v1_initializer_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_v1_initializer_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_v1_initializer_proto_goTypes = []interface{}{ +var file_v1_initializer_proto_goTypes = []any{ (StatusResponse_InitializerStatus)(0), // 0: v1.StatusResponse.InitializerStatus (*StatusRequest)(nil), // 1: v1.StatusRequest (*StatusResponse)(nil), // 2: v1.StatusResponse @@ -232,7 +232,7 @@ func file_v1_initializer_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_v1_initializer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_v1_initializer_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*StatusRequest); i { case 0: return &v.state @@ -244,7 +244,7 @@ func file_v1_initializer_proto_init() { return nil } } - file_v1_initializer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_initializer_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*StatusResponse); i { case 0: return &v.state diff --git a/cmd/internal/backup/providers/common/common.go b/cmd/internal/backup/providers/common/common.go new file mode 100644 index 0000000..11917ab --- /dev/null +++ b/cmd/internal/backup/providers/common/common.go @@ -0,0 +1,34 @@ +package common + +import ( + "fmt" + "sort" + + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" +) + +// Sort the given list of backup versions +func Sort(versions []*providers.BackupVersion) { + sort.Slice(versions, func(i, j int) bool { + return versions[i].Date.After(versions[j].Date) + }) +} + +// Latest returns latest backup version +func Latest(versions []*providers.BackupVersion) *providers.BackupVersion { + Sort(versions) + if len(versions) == 0 { + return nil + } + return versions[0] +} + +// Latest returns the backup version at given version +func Get(versions []*providers.BackupVersion, version string) (*providers.BackupVersion, error) { + for _, backup := range versions { + if version == backup.Version { + return backup, nil + } + } + return nil, fmt.Errorf("version %q not found", version) +} diff --git a/cmd/internal/backup/providers/common/common_test.go b/cmd/internal/backup/providers/common/common_test.go new file mode 100644 index 0000000..5d161cf --- /dev/null +++ b/cmd/internal/backup/providers/common/common_test.go @@ -0,0 +1,71 @@ +package common + +import ( + "reflect" + "testing" + "time" + + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" + "github.com/stretchr/testify/require" +) + +func TestSort(t *testing.T) { + now := time.Now() + tests := []struct { + name string + versions []*providers.BackupVersion + wantedVersions []*providers.BackupVersion + }{ + { + name: "mixed", + versions: []*providers.BackupVersion{ + {Name: "2.tgz", Date: now.Add(2 * time.Hour)}, + {Name: "1.tgz", Date: now.Add(1 * time.Hour)}, + {Name: "5.tgz", Date: now.Add(5 * time.Hour)}, + {Name: "0.tgz", Date: now}, + {Name: "3.tgz", Date: now.Add(3 * time.Hour)}, + }, + wantedVersions: []*providers.BackupVersion{ + {Name: "0.tgz", Date: now}, + {Name: "1.tgz", Date: now.Add(1 * time.Hour)}, + {Name: "2.tgz", Date: now.Add(2 * time.Hour)}, + {Name: "3.tgz", Date: now.Add(3 * time.Hour)}, + {Name: "5.tgz", Date: now.Add(5 * time.Hour)}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + Sort(tt.versions) + require.ElementsMatch(t, tt.versions, tt.wantedVersions) + }) + } +} + +func TestLatest(t *testing.T) { + now := time.Now() + newestBackup := &providers.BackupVersion{Name: "5.tgz", Date: now.Add(5 * time.Hour)} + tests := []struct { + name string + versions []*providers.BackupVersion + want *providers.BackupVersion + }{ + { + versions: []*providers.BackupVersion{ + {Name: "2.tgz", Date: now.Add(2 * time.Hour)}, + {Name: "0.tgz", Date: now}, + {Name: "1.tgz", Date: now.Add(1 * time.Hour)}, + newestBackup, + {Name: "3.tgz", Date: now.Add(3 * time.Hour)}, + }, + want: newestBackup, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := Latest(tt.versions); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Latest() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/cmd/internal/backup/providers/contract.go b/cmd/internal/backup/providers/contract.go index 9ed47fb..30604d7 100644 --- a/cmd/internal/backup/providers/contract.go +++ b/cmd/internal/backup/providers/contract.go @@ -15,9 +15,11 @@ type BackupProvider interface { } type BackupVersions interface { + // Latest returns the most recent backup Latest() *BackupVersion - Sort(versions []*BackupVersion, asc bool) + // List returns all backups sorted by date descending, e.g. the newest backup comes first List() []*BackupVersion + // Get a backup at the specified version Get(version string) (*BackupVersion, error) } diff --git a/cmd/internal/backup/providers/gcp/gcp.go b/cmd/internal/backup/providers/gcp/gcp.go index 99e47db..89cae60 100644 --- a/cmd/internal/backup/providers/gcp/gcp.go +++ b/cmd/internal/backup/providers/gcp/gcp.go @@ -242,7 +242,7 @@ func (b *BackupProviderGCP) ListBackups(ctx context.Context) (providers.BackupVe objectAttrs = append(objectAttrs, attrs) } - return BackupVersionsGCP{ + return backupVersionsGCP{ objectAttrs: objectAttrs, }, nil } diff --git a/cmd/internal/backup/providers/gcp/versions.go b/cmd/internal/backup/providers/gcp/versions.go index e4b7bee..3904533 100644 --- a/cmd/internal/backup/providers/gcp/versions.go +++ b/cmd/internal/backup/providers/gcp/versions.go @@ -1,30 +1,25 @@ package gcp import ( - "fmt" - "sort" "strconv" "cloud.google.com/go/storage" "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers/common" ) -type BackupVersionsGCP struct { +type backupVersionsGCP struct { objectAttrs []*storage.ObjectAttrs } -func (b BackupVersionsGCP) Latest() *providers.BackupVersion { - result := b.List() - if len(result) == 0 { - return nil - } - return result[0] +func (b backupVersionsGCP) Latest() *providers.BackupVersion { + return common.Latest(b.List()) } -func (b BackupVersionsGCP) List() []*providers.BackupVersion { +func (b backupVersionsGCP) List() []*providers.BackupVersion { var result []*providers.BackupVersion - tmp := make(map[int64]bool) + tmp := make(map[int64]bool, len(result)) for _, attr := range b.objectAttrs { ok := tmp[attr.Generation] if !ok { @@ -37,25 +32,11 @@ func (b BackupVersionsGCP) List() []*providers.BackupVersion { } } - b.Sort(result, false) + common.Sort(result) return result } -func (b BackupVersionsGCP) Sort(versions []*providers.BackupVersion, asc bool) { - sort.Slice(versions, func(i, j int) bool { - if asc { - return versions[i].Date.Before(versions[j].Date) - } - return versions[i].Date.After(versions[j].Date) - }) -} - -func (b BackupVersionsGCP) Get(version string) (*providers.BackupVersion, error) { - for _, backup := range b.List() { - if version == backup.Version { - return backup, nil - } - } - return nil, fmt.Errorf("version %q not found", version) +func (b backupVersionsGCP) Get(version string) (*providers.BackupVersion, error) { + return common.Get(b.List(), version) } diff --git a/cmd/internal/backup/providers/local/local.go b/cmd/internal/backup/providers/local/local.go index 3de0c75..8c2a7f4 100644 --- a/cmd/internal/backup/providers/local/local.go +++ b/cmd/internal/backup/providers/local/local.go @@ -145,7 +145,7 @@ func (b *BackupProviderLocal) ListBackups(_ context.Context) (providers.BackupVe files = append(files, info) } - return BackupVersionsLocal{ + return backupVersionsLocal{ files: files, }, nil } diff --git a/cmd/internal/backup/providers/local/local_test.go b/cmd/internal/backup/providers/local/local_test.go index 58cde7c..44d528d 100644 --- a/cmd/internal/backup/providers/local/local_test.go +++ b/cmd/internal/backup/providers/local/local_test.go @@ -49,7 +49,7 @@ func Test_BackupProviderLocal(t *testing.T) { for i := range backupAmount { backupName := p.GetNextBackupName(ctx) + ".tar.gz" backupPath := path.Join(constants.UploadDir, backupName) - backupContent := fmt.Sprintf("precious data %d", i) + backupContent := fmt.Sprintf("precious data %d", i+1) err = afero.WriteFile(fs, backupPath, []byte(backupContent), 0600) require.NoError(t, err) @@ -102,8 +102,6 @@ func Test_BackupProviderLocal(t *testing.T) { require.Len(t, allVersions, amount) for i, v := range allVersions { - v := v - assert.True(t, strings.HasSuffix(v.Name, ".tar.gz")) assert.NotZero(t, v.Date) @@ -139,7 +137,7 @@ func Test_BackupProviderLocal(t *testing.T) { gotContent, err := afero.ReadFile(fs, downloadPath) require.NoError(t, err) - require.Equal(t, fmt.Sprintf("precious data %d", backupAmount-1), string(gotContent)) + require.Equal(t, fmt.Sprintf("precious data %d", backupAmount), string(gotContent)) // cleaning up after test err = fs.Remove(downloadPath) diff --git a/cmd/internal/backup/providers/local/versions.go b/cmd/internal/backup/providers/local/versions.go index 064d94c..8eea41d 100644 --- a/cmd/internal/backup/providers/local/versions.go +++ b/cmd/internal/backup/providers/local/versions.go @@ -1,28 +1,22 @@ package local import ( - "fmt" "os" - "sort" "strconv" "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers/common" ) -type BackupVersionsLocal struct { +type backupVersionsLocal struct { files []os.FileInfo } -func (b BackupVersionsLocal) Latest() *providers.BackupVersion { - result := b.List() - if len(result) == 0 { - return nil - } - b.Sort(result, false) - return result[0] +func (b backupVersionsLocal) Latest() *providers.BackupVersion { + return common.Latest(b.List()) } -func (b BackupVersionsLocal) List() []*providers.BackupVersion { +func (b backupVersionsLocal) List() []*providers.BackupVersion { var result []*providers.BackupVersion for _, file := range b.files { @@ -32,7 +26,7 @@ func (b BackupVersionsLocal) List() []*providers.BackupVersion { }) } - b.Sort(result, false) + common.Sort(result) for i, backup := range result { backup.Version = strconv.FormatInt(int64(i), 10) @@ -41,20 +35,6 @@ func (b BackupVersionsLocal) List() []*providers.BackupVersion { return result } -func (b BackupVersionsLocal) Sort(versions []*providers.BackupVersion, oldestFirst bool) { - sort.Slice(versions, func(i, j int) bool { - if oldestFirst { - return versions[i].Date.Before(versions[j].Date) - } - return versions[i].Date.After(versions[j].Date) - }) -} - -func (b BackupVersionsLocal) Get(version string) (*providers.BackupVersion, error) { - for _, backup := range b.List() { - if version == backup.Version { - return backup, nil - } - } - return nil, fmt.Errorf("version %q not found", version) +func (b backupVersionsLocal) Get(version string) (*providers.BackupVersion, error) { + return common.Get(b.List(), version) } diff --git a/cmd/internal/backup/providers/s3/s3.go b/cmd/internal/backup/providers/s3/s3.go index 2be03ac..10200cd 100644 --- a/cmd/internal/backup/providers/s3/s3.go +++ b/cmd/internal/backup/providers/s3/s3.go @@ -271,7 +271,7 @@ func (b *BackupProviderS3) ListBackups(ctx context.Context) (providers.BackupVer return nil, err } - return BackupVersionsS3{ + return backupVersionsS3{ objectAttrs: it.Versions, }, nil } diff --git a/cmd/internal/backup/providers/s3/versions.go b/cmd/internal/backup/providers/s3/versions.go index 21947ca..2e84142 100644 --- a/cmd/internal/backup/providers/s3/versions.go +++ b/cmd/internal/backup/providers/s3/versions.go @@ -1,29 +1,23 @@ package s3 import ( - "fmt" - "sort" - "github.com/aws/aws-sdk-go/service/s3" "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers/common" ) -// BackupVersionsS3 contains the list of available backup versions -type BackupVersionsS3 struct { +// backupVersionsS3 contains the list of available backup versions +type backupVersionsS3 struct { objectAttrs []*s3.ObjectVersion } // Latest returns latest backup version -func (b BackupVersionsS3) Latest() *providers.BackupVersion { - result := b.List() - if len(result) == 0 { - return nil - } - return result[0] +func (b backupVersionsS3) Latest() *providers.BackupVersion { + return common.Latest(b.List()) } // List return a list of all backup versions -func (b BackupVersionsS3) List() []*providers.BackupVersion { +func (b backupVersionsS3) List() []*providers.BackupVersion { var result []*providers.BackupVersion for _, attr := range b.objectAttrs { @@ -34,27 +28,12 @@ func (b BackupVersionsS3) List() []*providers.BackupVersion { }) } - b.Sort(result, false) + common.Sort(result) return result } -// Sort returns the backup versions sorted by date -func (b BackupVersionsS3) Sort(versions []*providers.BackupVersion, asc bool) { - sort.Slice(versions, func(i, j int) bool { - if asc { - return versions[i].Date.Before(versions[j].Date) - } - return versions[i].Date.After(versions[j].Date) - }) -} - // Get returns the backup entry of the given version -func (b BackupVersionsS3) Get(version string) (*providers.BackupVersion, error) { - for _, backup := range b.List() { - if version == backup.Version { - return backup, nil - } - } - return nil, fmt.Errorf("version %q not found", version) +func (b backupVersionsS3) Get(version string) (*providers.BackupVersion, error) { + return common.Get(b.List(), version) } diff --git a/cmd/internal/initializer/initializer.go b/cmd/internal/initializer/initializer.go index 10dadd5..a24f3ea 100644 --- a/cmd/internal/initializer/initializer.go +++ b/cmd/internal/initializer/initializer.go @@ -53,7 +53,7 @@ func New(log *slog.Logger, addr string, db database.Database, bp providers.Backu } // Start starts the initializer, which includes a server component and the initializer itself, which is potentially restoring a backup -func (i *Initializer) Start(ctx context.Context) { +func (i *Initializer) Start(ctx context.Context) error { opts := []grpc.ServerOption{ grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( grpc_ctxtags.StreamServerInterceptor(), @@ -92,7 +92,7 @@ func (i *Initializer) Start(ctx context.Context) { lis, err := net.Listen("tcp", i.addr) if err != nil { i.log.Error("failed to listen", "error", err) - panic(err) + return err } go func() { @@ -111,7 +111,7 @@ func (i *Initializer) Start(ctx context.Context) { err = i.initialize(ctx) if err != nil { i.log.Error("error initializing database, shutting down", "error", err) - panic(err) + return err } i.currentStatus.Status = v1.StatusResponse_UPGRADING @@ -119,12 +119,13 @@ func (i *Initializer) Start(ctx context.Context) { err = i.db.Upgrade(ctx) if err != nil { i.log.Error("upgrade database failed", "error", err) - panic(err) + return err } i.log.Info("initializer done") i.currentStatus.Status = v1.StatusResponse_DONE i.currentStatus.Message = "done" + return nil } func (i *Initializer) initialize(ctx context.Context) error { diff --git a/cmd/internal/initializer/service.go b/cmd/internal/initializer/service.go index 5a9b9fc..df8c7b2 100644 --- a/cmd/internal/initializer/service.go +++ b/cmd/internal/initializer/service.go @@ -6,6 +6,7 @@ import ( v1 "github.com/metal-stack/backup-restore-sidecar/api/v1" "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers" + "github.com/metal-stack/backup-restore-sidecar/cmd/internal/backup/providers/common" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" @@ -43,8 +44,9 @@ func (s *backupService) ListBackups(ctx context.Context, _ *v1.ListBackupsReques return nil, status.Error(codes.Internal, err.Error()) } + // List internally sorts the backups backups := versions.List() - versions.Sort(backups, false) + common.Sort(backups) response := &v1.BackupListResponse{} for _, b := range backups { diff --git a/cmd/main.go b/cmd/main.go index 0474072..1f3c6f4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -150,7 +150,9 @@ var startCmd = &cobra.Command{ metrics := metrics.New() metrics.Start(logger.WithGroup("metrics")) - initializer.New(logger.WithGroup("initializer"), addr, db, bp, comp, metrics, viper.GetString(databaseDatadirFlg)).Start(stop) + if err := initializer.New(logger.WithGroup("initializer"), addr, db, bp, comp, metrics, viper.GetString(databaseDatadirFlg)).Start(stop); err != nil { + return err + } if err := probe.Start(stop, logger.WithGroup("probe"), db); err != nil { return err diff --git a/go.mod b/go.mod index 3fe984e..33a5376 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/metal-stack/backup-restore-sidecar go 1.22 require ( - cloud.google.com/go/storage v1.41.0 + cloud.google.com/go/storage v1.42.0 github.com/Masterminds/semver/v3 v3.2.1 github.com/avast/retry-go/v4 v4.6.0 - github.com/aws/aws-sdk-go v1.53.19 + github.com/aws/aws-sdk-go v1.53.21 github.com/docker/docker v26.1.4+incompatible github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/lib/pq v1.10.9 @@ -27,7 +27,7 @@ require ( golang.org/x/sync v0.7.0 google.golang.org/api v0.183.0 google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.2 k8s.io/api v0.29.3 k8s.io/apimachinery v0.29.3 @@ -91,7 +91,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -156,9 +156,9 @@ require ( golang.org/x/term v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect gopkg.in/cenkalti/backoff.v2 v2.2.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index f8f2692..7aacbcc 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,10 @@ cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2Qx cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= -cloud.google.com/go/storage v1.41.0 h1:RusiwatSu6lHeEXe3kglxakAmAbfV+rhtPqA6i8RBx0= -cloud.google.com/go/storage v1.41.0/go.mod h1:J1WCa/Z2FcgdEDuPUY8DxT5I+d9mFKsCepp5vR6Sq80= +cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= +cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= +cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= @@ -32,8 +34,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/avast/retry-go/v4 v4.6.0 h1:K9xNA+KeB8HHc2aWFuLb25Offp+0iVRXEvFx8IinRJA= github.com/avast/retry-go/v4 v4.6.0/go.mod h1:gvWlPhBVsvBbLkVGDg/KwvBv0bEkCOLRRSHKIr2PyOE= -github.com/aws/aws-sdk-go v1.53.19 h1:WEuWc918RXlIaPCyU11F7hH9H1ItK+8m2c/uoQNRUok= -github.com/aws/aws-sdk-go v1.53.19/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.53.21 h1:vAXk3mJQqveg1H3uZaUBaGXrKWa97hc9zBhudsDZugA= +github.com/aws/aws-sdk-go v1.53.21/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -209,8 +211,8 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= @@ -524,12 +526,12 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20240604185151-ef581f913117 h1:HCZ6DlkKtCDAtD8ForECsY3tKuaR+p4R3grlK80uCCc= -google.golang.org/genproto v0.0.0-20240604185151-ef581f913117/go.mod h1:lesfX/+9iA+3OdqeCpoDddJaNxVB1AB6tD7EfqMmprc= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 h1:8RTI1cmuvdY9J7q/jpJWEj5UfgWjhV5MCoXaYmwLBYQ= +google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3/go.mod h1:qb66gsewNb7Ghv1enkhJiRfYGWUklv3n6G8UvprOhzA= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -547,8 +549,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII= gopkg.in/cenkalti/backoff.v2 v2.2.1/go.mod h1:S0QdOvT2AlerfSBkp0O+dk+bbIMaNbEmVk876gPCthU= diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 22eb00a..01d9855 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -5,7 +5,7 @@ managed: - file_option: go_package_prefix value: github.com/metal-stack/droptailer/api plugins: - - remote: buf.build/protocolbuffers/go:v1.34.1 + - remote: buf.build/protocolbuffers/go:v1.34.2 out: ../api opt: paths=source_relative - remote: buf.build/grpc/go:v1.3.0