diff --git a/pkg/cmd/backuprestore/backupserver.go b/pkg/cmd/backuprestore/backupserver.go index 75acb9c78..95a08f480 100644 --- a/pkg/cmd/backuprestore/backupserver.go +++ b/pkg/cmd/backuprestore/backupserver.go @@ -28,6 +28,7 @@ type backupRunner interface { type backupRunnerImpl struct{} func (b backupRunnerImpl) runBackup(backupOpts *backupOptions, pruneOpts *prune.PruneOpts) error { + klog.Infof("@Mustafa: being runBackup() - backupOpts are [%v] - pruneOpts are [%v] ", backupOpts, pruneOpts) dateString := time.Now().Format("2006-01-02_150405") backupOpts.backupDir = path.Join(backupVolume, dateString) err := backup(backupOpts) diff --git a/pkg/cmd/backuprestore/backuputils.go b/pkg/cmd/backuprestore/backuputils.go index 391c8b631..09104f04f 100644 --- a/pkg/cmd/backuprestore/backuputils.go +++ b/pkg/cmd/backuprestore/backuputils.go @@ -18,6 +18,7 @@ var backupResourcePodList = []string{ } func archiveLatestResources(configDir, backupFile string) error { + klog.Infof("@Mustafa: being archiveLatestResources() - configDir are [%v] - backupFile are [%v]", configDir, backupFile) klog.Info("Static Pod Resources are being stored in: ", backupFile) paths := []string{} @@ -38,6 +39,7 @@ func archiveLatestResources(configDir, backupFile string) error { } func backup(r *backupOptions) error { + klog.Infof("@Mustafa: being backup() - backupOpts are [%v] - endpoints are [%v]", r, r.endpoints) cli, err := getEtcdClient(r.endpoints) if err != nil { return fmt.Errorf("backup: failed to get etcd client: %w", err) diff --git a/pkg/cmd/backuprestore/etcdclientutils.go b/pkg/cmd/backuprestore/etcdclientutils.go index 37a970da9..23e2d7ef7 100644 --- a/pkg/cmd/backuprestore/etcdclientutils.go +++ b/pkg/cmd/backuprestore/etcdclientutils.go @@ -16,11 +16,13 @@ import ( ) func getEtcdClient(endpoints []string) (*clientv3.Client, error) { + klog.Infof("@Mustafa: being getEtcdClient() - endpoints are [%v]", endpoints) grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, os.Stderr)) dialOptions := []grpc.DialOption{ grpc.WithBlock(), // block until the underlying connection is up } + klog.Infof("@Mustafa: before tlsInfo in getEtcdClient()") tlsInfo := transport.TLSInfo{ CertFile: os.Getenv("ETCDCTL_CERT"), KeyFile: os.Getenv("ETCDCTL_KEY"), @@ -28,6 +30,8 @@ func getEtcdClient(endpoints []string) (*clientv3.Client, error) { } tlsConfig, err := tlsInfo.ClientConfig() if err != nil { + klog.Infof("@Mustafa: before tlsInfo in getEtcdClient() - tlsConfig are [%v]", tlsConfig) + klog.Infof("@Mustafa: before tlsInfo in getEtcdClient() - err is [%v]", err) return nil, fmt.Errorf("failed to generate tls client config endpoints %v and env %v: %w", endpoints, os.Environ(), err) } @@ -38,14 +42,18 @@ func getEtcdClient(endpoints []string) (*clientv3.Client, error) { TLS: tlsConfig, } + klog.Infof("@Mustafa: after tlsInfo in getEtcdClient()") cli, err := clientv3.New(*cfg) if err != nil { + klog.Infof("@Mustafa: after tlsInfo in getEtcdClient() - cli are [%v]", cli) + klog.Infof("@Mustafa: after tlsInfo in getEtcdClient() - err is [%v]", err) return nil, fmt.Errorf("failed to make etcd client for endpoints %v and env %v: %w", endpoints, os.Environ(), err) } return cli, nil } func saveSnapshot(cli *clientv3.Client, dbPath string) error { + klog.Infof("@Mustafa: being saveSnapshot() - cli are [%v] - dbPath are [%v]", cli, dbPath) partpath := dbPath + ".part" defer os.RemoveAll(partpath) diff --git a/pkg/cmd/backuprestore/fileioutils.go b/pkg/cmd/backuprestore/fileioutils.go index 11115e857..b881e9ec8 100644 --- a/pkg/cmd/backuprestore/fileioutils.go +++ b/pkg/cmd/backuprestore/fileioutils.go @@ -4,6 +4,7 @@ import ( "fmt" "io" "io/ioutil" + "k8s.io/klog/v2" "os" "path/filepath" "strings" @@ -71,12 +72,15 @@ func findTheLatestRevision(dir, filePrefix string, isDir bool) (string, error) { } func checkAndCreateDir(dirName string) error { + klog.Infof("@Mustafa: being checkAndCreateDir() - dirName are [%v]", dirName) _, err := os.Stat(dirName) if err != nil && !os.IsNotExist(err) { + klog.Infof("@Mustafa: being checkAndCreateDir() - err are [%v]", err) return fmt.Errorf("checkAndCreateDir failed: %w", err) } // If dirName already exists, remove it if err == nil { + klog.Infof("@Mustafa: being checkAndCreateDir() - err are [%v]", err) if err := os.RemoveAll(dirName); err != nil { return fmt.Errorf("checkAndCreateDir failed to remove %s: %w", dirName, err) }