func migrate(name string, port uint64, peerListenUrls string, peerAdvertiseUrls string, binPath string, dataDirPath string, etcdDataPrefix string, ttlKeysDirectory string,
	initialCluster string, target *EtcdVersionPair, bundledVersions SupportedVersions, etcdServerArgs string) {

	dataDir, err := OpenOrCreateDataDirectory(dataDirPath)
	if err != nil {
		klog.Fatalf("Error opening or creating data directory %s: %v", dataDirPath, err)
	}

	cfg := &EtcdMigrateCfg{
		binPath:           binPath,
		name:              name,
		port:              port,
		peerListenUrls:    peerListenUrls,
		peerAdvertiseUrls: peerAdvertiseUrls,
		etcdDataPrefix:    etcdDataPrefix,
		ttlKeysDirectory:  ttlKeysDirectory,
		initialCluster:    initialCluster,
		supportedVersions: bundledVersions,
		dataDirectory:     dataDirPath,
		etcdServerArgs:    etcdServerArgs,
	}
	client, err := NewEtcdMigrateClient(cfg)
	if err != nil {
		klog.Fatalf("Migration failed: %v", err)
	}
	defer client.Close()

	migrator := &Migrator{cfg, dataDir, client}

	err = migrator.MigrateIfNeeded(target)
	if err != nil {
		klog.Fatalf("Migration failed: %v", err)
	}
}
// migrate opens or initializes the etcd data directory, configures the migrator, and starts the migration.
migrate opens or initializes the etcd data directory, configures the migrator, and starts the migration.
// migrate opens or initializes the etcd data directory configures the migrator and starts the migration .
func migrate(name string, port uint64, peerListenUrls string, peerAdvertiseUrls string, binPath string, dataDirPath string, etcdDataPrefix string, ttlKeysDirectory string,
	initialCluster string, target *EtcdVersionPair, bundledVersions SupportedVersions, etcdServerArgs string) {
	dataDir, err := OpenOrCreateDataDirectory(dataDirPath)
	if err != nil {
		klog.Fatalf("Error opening or creating data directory %s: %v", dataDirPath, err)
	}
	cfg := &EtcdMigrateCfg{
		binPath:           binPath,
		name:              name,
		port:              port,
		peerListenUrls:    peerListenUrls,
		peerAdvertiseUrls: peerAdvertiseUrls,
		etcdDataPrefix:    etcdDataPrefix,
		ttlKeysDirectory:  ttlKeysDirectory,
		initialCluster:    initialCluster,
		supportedVersions: bundledVersions,
		dataDirectory:     dataDirPath,
		etcdServerArgs:    etcdServerArgs,
	}
	client, err := NewEtcdMigrateClient(cfg)
	if err != nil {
		klog.Fatalf("Migration failed: %v", err)
	}
	defer client.Close()
	migrator := &Migrator{cfg, dataDir, client}
	err = migrator.MigrateIfNeeded(target)
	if err != nil {
		klog.Fatalf("Migration failed: %v", err)
	}
}
func migrate ( name string , port uint64 , peerListenUrls string , peerAdvertiseUrls string , binPath string , dataDirPath string , etcdDataPrefix string , ttlKeysDirectory string , initialCluster string , target * EtcdVersionPair , bundledVersions SupportedVersions , etcdServerArgs string ) { dataDir , err := OpenOrCreateDataDirectory ( dataDirPath ) if err != nil { klog . Fatalf ( " " , dataDirPath , err ) } cfg := & EtcdMigrateCfg { binPath : binPath , name : name , port : port , peerListenUrls : peerListenUrls , peerAdvertiseUrls : peerAdvertiseUrls , etcdDataPrefix : etcdDataPrefix , ttlKeysDirectory : ttlKeysDirectory , initialCluster : initialCluster , supportedVersions : bundledVersions , dataDirectory : dataDirPath , etcdServerArgs : etcdServerArgs , } client , err := NewEtcdMigrateClient ( cfg ) if err != nil { klog . Fatalf ( " " , err ) } defer client . Close ( ) migrator := & Migrator { cfg , dataDir , client } err = migrator . MigrateIfNeeded ( target ) if err != nil { klog . Fatalf ( " " , err ) } }
migrate opens or initializes the etcd data directory, configures the migrator, and starts the migration.
migrate opens or initializes the etcd data directory configures the migrator and starts the migration .