func handleABS(kubecli kubernetes.Interface, s *api.ABSBackupSource, sch api.BackupSchedule, endpoints []string, clientTLSSecret, namespace string) (*api.BackupStatus, error) {
	cli, err := absfactory.NewClientFromSecret(kubecli, namespace, s.ABSSecret)
	if err != nil {
		return nil, err
	}

	var tlsConfig *tls.Config
	if len(clientTLSSecret) != 0 {
		d, err := k8sutil.GetTLSDataFromSecret(kubecli, namespace, clientTLSSecret)
		if err != nil {
			return nil, fmt.Errorf("failed to get TLS data from secret (%v): %v", clientTLSSecret, err)
		}
		tlsConfig, err = etcdutil.NewTLSConfig(d.CertData, d.KeyData, d.CAData)
		if err != nil {
			return nil, fmt.Errorf("failed to constructs tls config: %v", err)
		}
	}

	bm := backup.NewBackupManagerFromWriter(kubecli, writer.NewABSWriter(cli.ABS), tlsConfig, endpoints, namespace)
	appendRev := false
	if sch.BackupIntervalInSecond > 0 {
		appendRev = true
	}
	rev, etcdVersion, err := bm.SaveSnap(s.Path, appendRev)
	if err != nil {
		return nil, fmt.Errorf("failed to save snapshot (%v)", err)
	}

	err = bm.PurgeBackup(s.Path, sch.MaxBackups)
	if err != nil {
		return nil, fmt.Errorf("failed to purge backups (%v)", err)
	}
	return &api.BackupStatus{EtcdVersion: etcdVersion, EtcdRevision: rev}, nil
}
// TODO: replace this with generic backend interface for other options (PV, Azure)
// handleABS saves etcd cluster's backup to specificed ABS path.
replace this with generic backend interface for other options (PV, Azure)
handleABS saves etcd cluster's backup to specificed ABS path.
// TODO : replace this with generic backend interface for other options ( PV Azure ) // handleABS saves etcd cluster ' s backup to specificed ABS path .
func handleABS(kubecli kubernetes.Interface, s *api.ABSBackupSource, sch api.BackupSchedule, endpoints []string, clientTLSSecret, namespace string) (*api.BackupStatus, error) {
	cli, err := absfactory.NewClientFromSecret(kubecli, namespace, s.ABSSecret)
	if err != nil {
		return nil, err
	}
	var tlsConfig *tls.Config
	if len(clientTLSSecret) != 0 {
		d, err := k8sutil.GetTLSDataFromSecret(kubecli, namespace, clientTLSSecret)
		if err != nil {
			return nil, fmt.Errorf("failed to get TLS data from secret (%v): %v", clientTLSSecret, err)
		}
		tlsConfig, err = etcdutil.NewTLSConfig(d.CertData, d.KeyData, d.CAData)
		if err != nil {
			return nil, fmt.Errorf("failed to constructs tls config: %v", err)
		}
	}
	bm := backup.NewBackupManagerFromWriter(kubecli, writer.NewABSWriter(cli.ABS), tlsConfig, endpoints, namespace)
	appendRev := false
	if sch.BackupIntervalInSecond > 0 {
		appendRev = true
	}
	rev, etcdVersion, err := bm.SaveSnap(s.Path, appendRev)
	if err != nil {
		return nil, fmt.Errorf("failed to save snapshot (%v)", err)
	}
	err = bm.PurgeBackup(s.Path, sch.MaxBackups)
	if err != nil {
		return nil, fmt.Errorf("failed to purge backups (%v)", err)
	}
	return &api.BackupStatus{EtcdVersion: etcdVersion, EtcdRevision: rev}, nil
}
func handleABS ( kubecli kubernetes . Interface , s * api . ABSBackupSource , sch api . BackupSchedule , endpoints [ ] string , clientTLSSecret , namespace string ) ( * api . BackupStatus , error ) { cli , err := absfactory . NewClientFromSecret ( kubecli , namespace , s . ABSSecret ) if err != nil { return nil , err } var tlsConfig * tls . Config if len ( clientTLSSecret ) != 0 { d , err := k8sutil . GetTLSDataFromSecret ( kubecli , namespace , clientTLSSecret ) if err != nil { return nil , fmt . Errorf ( " " , clientTLSSecret , err ) } tlsConfig , err = etcdutil . NewTLSConfig ( d . CertData , d . KeyData , d . CAData ) if err != nil { return nil , fmt . Errorf ( " " , err ) } } bm := backup . NewBackupManagerFromWriter ( kubecli , writer . NewABSWriter ( cli . ABS ) , tlsConfig , endpoints , namespace ) appendRev := false if sch . BackupIntervalInSecond > 0 { appendRev = true } rev , etcdVersion , err := bm . SaveSnap ( s . Path , appendRev ) if err != nil { return nil , fmt . Errorf ( " " , err ) } err = bm . PurgeBackup ( s . Path , sch . MaxBackups ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return & api . BackupStatus { EtcdVersion : etcdVersion , EtcdRevision : rev } , nil }
replace this with generic backend interface for other options (PV, Azure)
handleABS saves etcd cluster's backup to specificed ABS path.
replace this with generic backend interface for other options ( PV Azure ) handleABS saves etcd cluster ' s backup to specificed ABS path .