Prevent GC from wiping artifacts in the same NS

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2020-11-18 22:56:08 +01:00
parent d326ae4547
commit 93d1559b50
4 changed files with 4 additions and 4 deletions

View File

@ -352,7 +352,7 @@ func (r *BucketReconciler) resetStatus(bucket sourcev1.Bucket) (sourcev1.Bucket,
// gc performs a garbage collection on all but current artifacts of the given bucket.
func (r *BucketReconciler) gc(bucket sourcev1.Bucket, all bool) error {
if all {
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(bucket.Kind, bucket.GetObjectMeta(), "", ""))
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(bucket.Kind, bucket.GetObjectMeta(), "", "*"))
}
if bucket.GetArtifact() != nil {
return r.Storage.RemoveAllButCurrent(*bucket.GetArtifact())

View File

@ -312,7 +312,7 @@ func (r *GitRepositoryReconciler) resetStatus(repository sourcev1.GitRepository)
// the given repository.
func (r *GitRepositoryReconciler) gc(repository sourcev1.GitRepository, all bool) error {
if all {
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), "", ""))
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), "", "*"))
}
if repository.GetArtifact() != nil {
return r.Storage.RemoveAllButCurrent(*repository.GetArtifact())

View File

@ -628,7 +628,7 @@ func (r *HelmChartReconciler) resetStatus(chart sourcev1.HelmChart) (sourcev1.He
// the given chart.
func (r *HelmChartReconciler) gc(chart sourcev1.HelmChart, all bool) error {
if all {
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(chart.Kind, chart.GetObjectMeta(), "", ""))
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(chart.Kind, chart.GetObjectMeta(), "", "*"))
}
if chart.GetArtifact() != nil {
return r.Storage.RemoveAllButCurrent(*chart.GetArtifact())

View File

@ -286,7 +286,7 @@ func (r *HelmRepositoryReconciler) resetStatus(repository sourcev1.HelmRepositor
// the given repository.
func (r *HelmRepositoryReconciler) gc(repository sourcev1.HelmRepository, all bool) error {
if all {
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), "", ""))
return r.Storage.RemoveAll(r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), "", "*"))
}
if repository.GetArtifact() != nil {
return r.Storage.RemoveAllButCurrent(*repository.GetArtifact())