@@ -18,19 +18,15 @@ package cmds
18
18
19
19
import (
20
20
"fmt"
21
- "strings"
22
21
"time"
23
22
24
23
"stash.appscode.dev/stash/apis"
25
24
api_v1beta1 "stash.appscode.dev/stash/apis/stash/v1beta1"
26
25
cs "stash.appscode.dev/stash/client/clientset/versioned"
27
26
v1beta1_util "stash.appscode.dev/stash/client/clientset/versioned/typed/stash/v1beta1/util"
28
- "stash.appscode.dev/stash/pkg/eventer"
29
- "stash.appscode.dev/stash/pkg/util"
30
27
31
28
"github.com/appscode/go/log"
32
29
"github.com/spf13/cobra"
33
- core "k8s.io/api/core/v1"
34
30
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
35
31
"k8s.io/client-go/kubernetes"
36
32
"k8s.io/client-go/tools/clientcmd"
@@ -106,24 +102,6 @@ func (opt *options) createBackupSession() error {
106
102
OwnerReferences : []metav1.OwnerReference {},
107
103
}
108
104
109
- wc := util.WorkloadClients {
110
- KubeClient : opt .k8sClient ,
111
- StashClient : opt .stashClient ,
112
- AppCatalogClient : opt .appcatalogClient ,
113
- OcClient : opt .ocClient ,
114
- }
115
-
116
- for _ , targetInfo := range invoker .TargetsInfo {
117
- if targetInfo .Target != nil && ! wc .IsTargetExist (targetInfo .Target .Ref , opt .namespace ) {
118
- msg := fmt .Sprintf ("Skipping creating BackupSession. Reason: Target workload %s/%s does not exist." ,
119
- strings .ToLower (targetInfo .Target .Ref .Kind ), targetInfo .Target .Ref .Name )
120
- log .Infoln (msg )
121
-
122
- // write event to backup invoker denoting that backup session has been skipped
123
- return writeBackupSessionSkippedEvent (opt .k8sClient , invoker .ObjectRef , msg )
124
- }
125
- }
126
-
127
105
// create BackupSession
128
106
_ , _ , err = v1beta1_util .CreateOrPatchBackupSession (opt .stashClient .StashV1beta1 (), bsMeta , func (in * api_v1beta1.BackupSession ) * api_v1beta1.BackupSession {
129
107
// Set BackupConfiguration as BackupSession Owner
@@ -143,15 +121,3 @@ func (opt *options) createBackupSession() error {
143
121
})
144
122
return err
145
123
}
146
-
147
- func writeBackupSessionSkippedEvent (kubeClient kubernetes.Interface , invokerRef * core.ObjectReference , msg string ) error {
148
- _ , err := eventer .CreateEvent (
149
- kubeClient ,
150
- eventer .EventSourceBackupTriggeringCronJob ,
151
- invokerRef ,
152
- core .EventTypeNormal ,
153
- eventer .EventReasonBackupSkipped ,
154
- msg ,
155
- )
156
- return err
157
- }
0 commit comments