Skip to content

Commit

Permalink
add ramenutils.DoNotDeleteLabelKey
Browse files Browse the repository at this point in the history
Signed-off-by: youhangwang <[email protected]>
  • Loading branch information
youhangwang committed Jun 12, 2024
1 parent 59e89be commit f8c0fa4
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 6 deletions.
16 changes: 11 additions & 5 deletions controllers/util/cephfs_cg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

volsyncv1alpha1 "github.com/backube/volsync/api/v1alpha1"
ramenutils "github.com/backube/volsync/controllers/utils"
"github.com/go-logr/logr"
groupsnapv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumegroupsnapshot/v1alpha1"
vsv1 "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1"
Expand All @@ -22,11 +23,14 @@ import (
)

const (
ManualStringAnnotaion = "ramendr.openshift.io/manual-string"
SkipDeleteAnnotaion = "ramendr.openshift.io/do-not-delete"
RGDOwnerLabel = "ramendr.openshift.io/rgd"
CleanupLabelKey = "volsync.backube/cleanup"
RGSOwnerLabel string = "ramendr.openshift.io/rgs"
ManualStringAnnotaion = "ramendr.openshift.io/manual-string"

// do not delete the vs in a vgs, only for testing
SkipDeleteAnnotaion = "rgd.ramendr.openshift.io/do-not-delete"

RGDOwnerLabel = "ramendr.openshift.io/rgd"
CleanupLabelKey = "volsync.backube/cleanup"
RGSOwnerLabel string = "ramendr.openshift.io/rgs"
)

func IsFSCGSupport(mgr manager.Manager) (bool, error) {
Expand Down Expand Up @@ -266,6 +270,8 @@ func DeferDeleteImage(ctx context.Context,
}

delete(labels, CleanupLabelKey)
labels[ramenutils.DoNotDeleteLabelKey] = "true"

labels[RGDOwnerLabel] = rgdName
volumeSnapshot.SetLabels(labels)

Expand Down
13 changes: 12 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require (
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/time v0.3.0
k8s.io/api v0.29.0
k8s.io/apiextensions-apiserver v0.28.3
k8s.io/apimachinery v0.29.0
k8s.io/client-go v12.0.0+incompatible
k8s.io/component-base v0.29.0
Expand Down Expand Up @@ -59,21 +60,31 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
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/kubernetes-csi/external-snapshotter/client/v6 v6.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
Expand All @@ -87,9 +98,9 @@ require (
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.28.3 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
open-cluster-management.io/api v0.11.1-0.20230905055724-cf1ead467a83 // indirect
Expand Down
Loading

0 comments on commit f8c0fa4

Please sign in to comment.