Skip to content

Add ETCD_ENDPOINTS env var support#60

Merged
GeorgeZhai merged 1 commit into
mainfrom
fix/etcd-endpoints-loader
Jan 14, 2026
Merged

Add ETCD_ENDPOINTS env var support#60
GeorgeZhai merged 1 commit into
mainfrom
fix/etcd-endpoints-loader

Conversation

@TejasNaikk
Copy link
Copy Markdown
Owner

@TejasNaikk TejasNaikk commented Jan 14, 2026

Test :

NODE_NAME=controller-1 RUNTIME_ENV=gating ETCD_ENDPOINTS=http://localhost:2379 mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8081"
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< io.clustercontroller:cluster-controller >---------------
[INFO] Building cluster-controller 0.1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot:3.1.5:run (default-cli) > test-compile @ cluster-controller >>>
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ cluster-controller ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ cluster-controller ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ cluster-controller ---
[INFO] skip non existing resourceDirectory /Users/tjnaik/Uber/cluster-controller/src/test/resources
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ cluster-controller ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot:3.1.5:run (default-cli) < test-compile @ cluster-controller <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.1.5:run (default-cli) @ cluster-controller ---
[INFO] Attaching agents: []
11:29:22.700 [main] INFO io.clustercontroller.ClusterControllerApplication -- Starting Multi-Cluster Controller Application with REST APIs

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.5)

2026-01-14T11:29:22.900-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Starting ClusterControllerApplication using Java 21.0.7 with PID 84491 (/Users/tjnaik/Uber/cluster-controller/target/classes started by tjnaik in /Users/tjnaik/Uber/cluster-controller)
2026-01-14T11:29:22.901-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : No active profile set, falling back to 1 default profile: "default"
2026-01-14T11:29:23.403-08:00  INFO 84491 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2026-01-14T11:29:23.407-08:00  INFO 84491 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2026-01-14T11:29:23.407-08:00  INFO 84491 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.15]
2026-01-14T11:29:23.448-08:00  INFO 84491 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2026-01-14T11:29:23.448-08:00  INFO 84491 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 523 ms
2026-01-14T11:29:23.520-08:00  INFO 84491 --- [           main] i.c.config.ClusterControllerConfig       : Loading config from classpath: application.yml
2026-01-14T11:29:23.530-08:00  INFO 84491 --- [           main] i.c.config.ClusterControllerConfig       : Successfully loaded configuration from classpath (application.yml)
2026-01-14T11:29:23.530-08:00  WARN 84491 --- [           main] i.c.config.ClusterControllerConfig       : Failed to get etcd.endpoints from config: EnvironmentUtils not initialized yet
2026-01-14T11:29:23.530-08:00  INFO 84491 --- [           main] i.c.config.ClusterControllerConfig       : Loaded cluster controller config - etcd endpoints: http://localhost:2379, task interval: 30s
2026-01-14T11:29:23.530-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Loaded configuration
2026-01-14T11:29:23.532-08:00  INFO 84491 --- [           main] i.c.store.EtcdPathResolver               : EtcdPathResolver initialized
2026-01-14T11:29:23.532-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing cluster-agnostic MetadataStore connection to etcd
2026-01-14T11:29:23.631-08:00  WARN 84491 --- [           main] i.n.r.d.DnsServerAddressStreamProviders  : Can not find io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the classpath, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
2026-01-14T11:29:23.686-08:00  INFO 84491 --- [           main] i.c.store.EtcdMetadataStore              : EtcdMetadataStore initialized with endpoints: http://localhost:2379 and nodeId: controller-1
2026-01-14T11:29:23.686-08:00  INFO 84491 --- [           main] i.c.store.EtcdMetadataStore              : Coordinator goal state path configured to group='coordinators', unit='default-coordinator'
2026-01-14T11:29:23.686-08:00  INFO 84491 --- [           main] i.c.store.EtcdMetadataStore              : Initialize called - already done in constructor
2026-01-14T11:29:23.686-08:00  INFO 84491 --- [           main] i.c.store.EtcdMetadataStore              : Skipping single-cluster leader election - using MultiClusterManager for distributed coordination
2026-01-14T11:29:23.686-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : MetadataStore initialized successfully
2026-01-14T11:29:23.694-08:00  INFO 84491 --- [           main] i.c.m.lock.DistributedLockManager        : DistributedLockManager initialized
2026-01-14T11:29:23.696-08:00  INFO 84491 --- [           main] i.c.m.registry.ControllerRegistry        : ControllerRegistry initialized
2026-01-14T11:29:23.696-08:00  INFO 84491 --- [           main] i.c.m.registry.ClusterRegistry           : ClusterRegistry initialized
2026-01-14T11:29:23.698-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing TemplateManager for multi-cluster support
2026-01-14T11:29:23.699-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing IndexManager for multi-cluster support with template support
2026-01-14T11:29:23.701-08:00  INFO 84491 --- [           main] i.c.metrics.MetricsProvider              : MetricsProvider initialized for the controller: controller-1
2026-01-14T11:29:23.701-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing ShardAllocator
2026-01-14T11:29:23.704-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing ActualAllocationUpdater
2026-01-14T11:29:23.705-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing GoalStateOrchestrator with RollingUpdateOrchestrationStrategy
2026-01-14T11:29:23.705-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing Discovery for multi-cluster support
2026-01-14T11:29:23.706-08:00  INFO 84491 --- [           main] i.c.ClusterControllerApplication         : Initializing shared TaskContext for multi-cluster support
2026-01-14T11:29:23.708-08:00  INFO 84491 --- [           main] i.c.m.lifecycle.ClusterLifecycleManager  : ClusterLifecycleManager initialized (controller: controller-1, health check interval: 10s)
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : MultiClusterManager initialized: controllerId=controller-1
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : ========================================
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : Starting MultiClusterManager
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : Controller ID: controller-1
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : ========================================
2026-01-14T11:29:23.710-08:00  INFO 84491 --- [           main] i.c.m.registry.ControllerRegistry        : Registering controller: controller-1
2026-01-14T11:29:23.846-08:00  INFO 84491 --- [           main] i.c.m.registry.ControllerRegistry        : ✓ Controller registered: controller-1 (leaseId: 7587892186338506205)
2026-01-14T11:29:23.852-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : Discovered 3 clusters: [cluster-gamma, cluster-alpha, cluster-beta]
2026-01-14T11:29:23.852-08:00  INFO 84491 --- [           main] i.clustercontroller.MultiClusterManager  : Discovered 1 controllers: [controller-1]

Copy link
Copy Markdown
Collaborator

@GeorgeZhai GeorgeZhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe as a follow up change.
I think we should abstract the config parsing into a separate class. but doing this field by field as using environment variable is a common pattern

}
// Get from EnvironmentUtils (reads from Spring Environment with env var support)
// Supports comma-separated endpoints: "http://etcd1:2379,http://etcd2:2379"
String endpointsStr = EnvironmentUtils.get("etcd.endpoints");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe as a follow up change.
I think we should abstract the config parsing into a separate class. but doing this field by field as using environment variable is a common pattern

@GeorgeZhai GeorgeZhai merged commit 761351e into main Jan 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants