Skip to content

Commit

Permalink
Progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Aug 25, 2023
1 parent fe57f79 commit 9b5b626
Show file tree
Hide file tree
Showing 15 changed files with 754 additions and 409 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ LINKMODE := -extldflags '-static -s -w' \
-X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
-X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'

KUBECONFIG := $(shell pwd)/.kubeconfig

.PHONY: all
all:
go mod tidy
go build -ldflags "$(LINKMODE)" -tags 'osusergo netgo static_build' -o bin/backup-restore-sidecar github.com/metal-stack/backup-restore-sidecar/cmd
strip bin/backup-restore-sidecar

.PHONY: test-integration
test-integration:
kind --name backup-restore-sidecar load docker-image ghcr.io/metal-stack/backup-restore-sidecar:latest
KUBECONFIG=$(KUBECONFIG) go test -v -p 1 -timeout 10m ./integration/...

.PHONY: proto
proto:
make -C proto protoc
Expand All @@ -28,16 +35,10 @@ proto:
dockerimage: all
docker build -t ghcr.io/metal-stack/backup-restore-sidecar:${DOCKER_TAG} .

.PHONY: dockerpush
dockerpush:
docker push ghcr.io/metal-stack/backup-restore-sidecar:${DOCKER_TAG}

# # #
# the following tasks can be used to set up a development environment
# # #

KUBECONFIG := $(shell pwd)/.kubeconfig

.PHONY: start-postgres
start-postgres:
$(MAKE) start DB=postgres
Expand Down
164 changes: 143 additions & 21 deletions api/v1/backup.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion api/v1/backup_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions cmd/internal/backup/providers/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ func New(log *zap.SugaredLogger, config *BackupProviderConfigLocal) (*BackupProv
// EnsureBackupBucket ensures a backup bucket at the backup provider
func (b *BackupProviderLocal) EnsureBackupBucket() error {
b.log.Infow("ensuring backup bucket called for provider local")
if err := os.RemoveAll(b.config.LocalBackupPath); err != nil {
return fmt.Errorf("could not clean local backup directory: %w", err)
}

if err := os.MkdirAll(b.config.LocalBackupPath, 0777); err != nil {
return fmt.Errorf("could not create local backup directory: %w", err)
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/initializer/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (i *Initializer) Start(ctx context.Context) {
grpcServer := grpc.NewServer(opts...)

initializerService := newInitializerService(i.currentStatus)
backupService := newBackupProviderService(i.bp)
backupService := newBackupProviderService(i.bp, i.Restore)

v1.RegisterInitializerServiceServer(grpcServer, initializerService)
v1.RegisterBackupServiceServer(grpcServer, backupService)
Expand Down
Loading

0 comments on commit 9b5b626

Please sign in to comment.