File tree 4 files changed +40
-16
lines changed
4 files changed +40
-16
lines changed Original file line number Diff line number Diff line change 7
7
"github.com/ramendr/ramen/e2e/config"
8
8
"github.com/ramendr/ramen/e2e/types"
9
9
"github.com/ramendr/ramen/e2e/util"
10
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
10
11
)
11
12
12
13
type ApplicationSet struct {}
@@ -58,11 +59,16 @@ func (a ApplicationSet) Undeploy(ctx types.Context) error {
58
59
59
60
clusterName , err := util .GetCurrentCluster (util .Ctx .Hub , managementNamespace , name )
60
61
if err != nil {
61
- return err
62
- }
62
+ if ! k8serrors .IsNotFound (err ) {
63
+ return err
64
+ }
63
65
64
- log .Infof ("Undeploying applicationset app \" %s/%s\" in cluster %q" ,
65
- ctx .AppNamespace (), ctx .Workload ().GetAppName (), clusterName )
66
+ log .Debugf ("Could not retrieve the cluster name: %s" , err )
67
+ log .Infof ("Undeploying applicationset app \" %s/%s\" " , ctx .AppNamespace (), ctx .Workload ().GetAppName ())
68
+ } else {
69
+ log .Infof ("Undeploying applicationset app \" %s/%s\" in cluster %q" ,
70
+ ctx .AppNamespace (), ctx .Workload ().GetAppName (), clusterName )
71
+ }
66
72
67
73
err = DeleteApplicationSet (ctx , a )
68
74
if err != nil {
Original file line number Diff line number Diff line change 7
7
"github.com/ramendr/ramen/e2e/config"
8
8
"github.com/ramendr/ramen/e2e/types"
9
9
"github.com/ramendr/ramen/e2e/util"
10
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
10
11
subscriptionv1 "open-cluster-management.io/multicloud-operators-subscription/pkg/apis/apps/v1"
11
12
)
12
13
@@ -80,12 +81,17 @@ func (s Subscription) Undeploy(ctx types.Context) error {
80
81
81
82
clusterName , err := util .GetCurrentCluster (util .Ctx .Hub , managementNamespace , name )
82
83
if err != nil {
83
- return err
84
+ if ! k8serrors .IsNotFound (err ) {
85
+ return err
86
+ }
87
+
88
+ log .Debugf ("Could not retrieve the cluster name: %s" , err )
89
+ log .Infof ("Undeploying subscription app \" %s/%s\" " , ctx .AppNamespace (), ctx .Workload ().GetAppName ())
90
+ } else {
91
+ log .Infof ("Undeploying subscription app \" %s/%s\" in cluster %q" ,
92
+ ctx .AppNamespace (), ctx .Workload ().GetAppName (), clusterName )
84
93
}
85
94
86
- log .Infof ("Undeploying subscription app \" %s/%s\" in cluster %q" ,
87
- ctx .AppNamespace (), ctx .Workload ().GetAppName (), clusterName )
88
-
89
95
err = DeleteSubscription (ctx , s )
90
96
if err != nil {
91
97
return err
Original file line number Diff line number Diff line change 8
8
"github.com/ramendr/ramen/e2e/config"
9
9
"github.com/ramendr/ramen/e2e/types"
10
10
"github.com/ramendr/ramen/e2e/util"
11
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
11
12
"k8s.io/client-go/util/retry"
12
13
)
13
14
@@ -108,11 +109,16 @@ func DisableProtection(ctx types.Context) error {
108
109
109
110
clusterName , err := util .GetCurrentCluster (util .Ctx .Hub , managementNamespace , placementName )
110
111
if err != nil {
111
- return err
112
- }
112
+ if ! k8serrors .IsNotFound (err ) {
113
+ return err
114
+ }
113
115
114
- log .Infof ("Unprotecting workload \" %s/%s\" in cluster %q" ,
115
- appNamespace , ctx .Workload ().GetAppName (), clusterName )
116
+ log .Debugf ("Could not retrieve the cluster name: %s" , err )
117
+ log .Infof ("Unprotecting workload \" %s/%s\" " , appNamespace , ctx .Workload ().GetAppName ())
118
+ } else {
119
+ log .Infof ("Unprotecting workload \" %s/%s\" in cluster %q" ,
120
+ appNamespace , ctx .Workload ().GetAppName (), clusterName )
121
+ }
116
122
117
123
drpcName := name
118
124
Original file line number Diff line number Diff line change 9
9
"github.com/ramendr/ramen/e2e/deployers"
10
10
"github.com/ramendr/ramen/e2e/types"
11
11
"github.com/ramendr/ramen/e2e/util"
12
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
12
13
)
13
14
14
15
func EnableProtectionDiscoveredApps (ctx types.Context ) error {
@@ -73,11 +74,16 @@ func DisableProtectionDiscoveredApps(ctx types.Context) error {
73
74
74
75
clusterName , err := util .GetCurrentCluster (util .Ctx .Hub , managementNamespace , placementName )
75
76
if err != nil {
76
- return err
77
- }
77
+ if ! k8serrors .IsNotFound (err ) {
78
+ return err
79
+ }
78
80
79
- log .Infof ("Unprotecting workload \" %s/%s\" in cluster %q" ,
80
- appNamespace , ctx .Workload ().GetAppName (), clusterName )
81
+ log .Debugf ("Could not retrieve the cluster name: %s" , err )
82
+ log .Infof ("Unprotecting workload \" %s/%s\" " , appNamespace , ctx .Workload ().GetAppName ())
83
+ } else {
84
+ log .Infof ("Unprotecting workload \" %s/%s\" in cluster %q" ,
85
+ appNamespace , ctx .Workload ().GetAppName (), clusterName )
86
+ }
81
87
82
88
if err := deleteDRPC (ctx , util .Ctx .Hub , managementNamespace , drpcName ); err != nil {
83
89
return err
You can’t perform that action at this time.
0 commit comments