Worker set its working directory (#8461)
* set working directory * consolidate to worker directory * working directory * correct directory name * refactoring to use wildcard matcher * simplify * cleaning ec working directory * fix reference * clean * adjust test
This commit is contained in:
@@ -728,6 +728,7 @@ func saveMiniConfiguration(dataFolder string) error {
|
||||
}
|
||||
|
||||
func runMini(cmd *Command, args []string) bool {
|
||||
*miniDataFolders = util.ResolvePath(*miniDataFolders)
|
||||
|
||||
// Capture which port flags were explicitly passed on CLI BEFORE config file is applied
|
||||
// This is necessary to distinguish user-specified ports from defaults or config file options
|
||||
@@ -1030,9 +1031,15 @@ func startMiniAdminWithWorker(allServicesReady chan struct{}) {
|
||||
glog.Fatalf("Admin server readiness check failed: %v", err)
|
||||
}
|
||||
|
||||
// Start worker after admin server is ready
|
||||
startMiniWorker()
|
||||
startMiniPluginWorker(ctx)
|
||||
// Start consolidated worker runtime (both standard and plugin runtimes)
|
||||
workerDir := filepath.Join(*miniDataFolders, "worker")
|
||||
if err := os.MkdirAll(workerDir, 0755); err != nil {
|
||||
glog.Fatalf("Failed to create unified worker directory: %v", err)
|
||||
}
|
||||
|
||||
glog.Infof("Starting consolidated maintenance worker system (directory: %s)", workerDir)
|
||||
startMiniWorker(workerDir)
|
||||
startMiniPluginWorker(ctx, workerDir)
|
||||
|
||||
// Wait for worker to be ready by polling its gRPC port
|
||||
workerGrpcAddr := fmt.Sprintf("%s:%d", bindIp, *miniAdminOptions.grpcPort)
|
||||
@@ -1091,17 +1098,13 @@ func waitForWorkerReady(workerGrpcAddr string) {
|
||||
}
|
||||
|
||||
// startMiniWorker starts a single worker for the admin server
|
||||
func startMiniWorker() {
|
||||
glog.Infof("Starting maintenance worker for admin server")
|
||||
func startMiniWorker(workerDir string) {
|
||||
glog.V(1).Infof("Initializing standard worker runtime")
|
||||
|
||||
adminAddr := fmt.Sprintf("%s:%d", *miniIp, *miniAdminOptions.port)
|
||||
capabilities := "vacuum,ec,balance"
|
||||
|
||||
// Use worker directory under main data folder
|
||||
workerDir := filepath.Join(*miniDataFolders, "worker")
|
||||
if err := os.MkdirAll(workerDir, 0755); err != nil {
|
||||
glog.Fatalf("Failed to create worker directory: %v", err)
|
||||
}
|
||||
// Use common worker directory
|
||||
|
||||
glog.Infof("Worker connecting to admin server: %s", adminAddr)
|
||||
glog.Infof("Worker capabilities: %s", capabilities)
|
||||
@@ -1170,7 +1173,7 @@ func startMiniWorker() {
|
||||
glog.Infof("Maintenance worker %s started successfully", workerInstance.ID())
|
||||
}
|
||||
|
||||
func startMiniPluginWorker(ctx context.Context) {
|
||||
func startMiniPluginWorker(ctx context.Context, workerDir string) {
|
||||
glog.Infof("Starting plugin worker for admin server")
|
||||
|
||||
adminAddr := fmt.Sprintf("%s:%d", *miniIp, *miniAdminOptions.port)
|
||||
@@ -1179,10 +1182,7 @@ func startMiniPluginWorker(ctx context.Context) {
|
||||
glog.Infof("Resolved mini plugin worker admin endpoint: %s -> %s", adminAddr, resolvedAdminAddr)
|
||||
}
|
||||
|
||||
workerDir := filepath.Join(*miniDataFolders, "plugin_worker")
|
||||
if err := os.MkdirAll(workerDir, 0755); err != nil {
|
||||
glog.Fatalf("Failed to create plugin worker directory: %v", err)
|
||||
}
|
||||
// Use common worker directory
|
||||
|
||||
util.LoadConfiguration("security", false)
|
||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.worker")
|
||||
|
||||
Reference in New Issue
Block a user