Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stork version annotation for backup, backupschedule and restore CR. #724

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/applicationmanager/controllers/applicationbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/libopenstorage/stork/pkg/objectstore"
"github.com/libopenstorage/stork/pkg/resourcecollector"
"github.com/libopenstorage/stork/pkg/rule"
"github.com/libopenstorage/stork/pkg/version"
"github.com/portworx/sched-ops/k8s/apiextensions"
"github.com/portworx/sched-ops/k8s/core"
storkops "github.com/portworx/sched-ops/k8s/stork"
Expand Down Expand Up @@ -57,6 +58,7 @@ const (
backupVolumeBatchCount = 10
maxRetry = 10
retrySleep = 10 * time.Second
storkVersion = annotationPrefix + "storkVersion"
)

var (
Expand Down Expand Up @@ -206,6 +208,10 @@ func (a *ApplicationBackupController) createBackupLocationPath(backup *stork_api

// handle updates for ApplicationBackup objects
func (a *ApplicationBackupController) handle(ctx context.Context, backup *stork_api.ApplicationBackup) error {
if _, ok := backup.Annotations[storkVersion]; !ok {
siva-portworx marked this conversation as resolved.
Show resolved Hide resolved
backup.Annotations[storkVersion] = version.Version
}

if backup.DeletionTimestamp != nil {
if controllers.ContainsFinalizer(backup, controllers.FinalizerCleanup) {
if err := a.deleteBackup(backup); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/libopenstorage/stork/pkg/controllers"
"github.com/libopenstorage/stork/pkg/log"
"github.com/libopenstorage/stork/pkg/schedule"
"github.com/libopenstorage/stork/pkg/version"
"github.com/portworx/sched-ops/k8s/apiextensions"
storkops "github.com/portworx/sched-ops/k8s/stork"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -89,6 +90,10 @@ func (s *ApplicationBackupScheduleController) Reconcile(request reconcile.Reques

// Handle updates for ApplicationBackupSchedule objects
func (s *ApplicationBackupScheduleController) handle(ctx context.Context, backupSchedule *stork_api.ApplicationBackupSchedule) error {
if _, ok := backupSchedule.Annotations[storkVersion]; !ok {
backupSchedule.Annotations[storkVersion] = version.Version
}

if backupSchedule.DeletionTimestamp != nil {
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/applicationmanager/controllers/applicationrestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/libopenstorage/stork/pkg/log"
"github.com/libopenstorage/stork/pkg/objectstore"
"github.com/libopenstorage/stork/pkg/resourcecollector"
"github.com/libopenstorage/stork/pkg/version"
"github.com/portworx/sched-ops/k8s/apiextensions"
"github.com/portworx/sched-ops/k8s/core"
storkops "github.com/portworx/sched-ops/k8s/stork"
Expand Down Expand Up @@ -215,6 +216,10 @@ func (a *ApplicationRestoreController) Reconcile(request reconcile.Request) (rec

// Handle updates for ApplicationRestore objects
func (a *ApplicationRestoreController) handle(ctx context.Context, restore *storkapi.ApplicationRestore) error {
if _, ok := restore.Annotations[storkVersion]; !ok {
restore.Annotations[storkVersion] = version.Version
}

if restore.DeletionTimestamp != nil {
if controllers.ContainsFinalizer(restore, controllers.FinalizerCleanup) {
if err := a.cleanupRestore(restore); err != nil {
Expand Down