Skip to content

Commit

Permalink
Always register finalizer for Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Apr 21, 2018
1 parent 9da28e1 commit 50d0f01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions pkg/controller/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,14 @@ func (c *StashController) runRepositoryInjector(key string) error {
in.ObjectMeta = core_util.RemoveFinalizer(in.ObjectMeta, util.RepositoryFinalizer)
return in
})
if err != nil {
return err
}
return err
}
} else {
if repo.Spec.WipeOut {
_, _, err = stash_util.PatchRepository(c.stashClient.StashV1alpha1(), repo, func(in *api.Repository) *api.Repository {
in.ObjectMeta = core_util.AddFinalizer(in.ObjectMeta, util.RepositoryFinalizer)
return in
})
}
_, _, err = stash_util.PatchRepository(c.stashClient.StashV1alpha1(), repo, func(in *api.Repository) *api.Repository {
in.ObjectMeta = core_util.AddFinalizer(in.ObjectMeta, util.RepositoryFinalizer)
return in
})
return err
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
AppLabelStash = "stash"
OperationScaleDown = "scale-down"

RepositoryFinalizer = "wipeOut-repository"
RepositoryFinalizer = "stash"
SnapshotIDLength = 8
SnapshotIDLengthWithDashPrefix = 9
)
Expand Down Expand Up @@ -584,9 +584,9 @@ func FixBackendPrefix(backend *api.Backend, autoPrefix string) *api.Backend {
backend.B2.Prefix = strings.TrimSuffix(backend.B2.Prefix, autoPrefix)
backend.B2.Prefix = strings.TrimSuffix(backend.B2.Prefix, "/")
}

return backend
}

func GetBucketAndPrefix(backend *api.Backend) (string, string, error) {
if backend.S3 != nil {
return backend.S3.Bucket, strings.TrimPrefix(backend.S3.Prefix, backend.S3.Bucket+"/"), nil
Expand Down

0 comments on commit 50d0f01

Please sign in to comment.