Skip to content

Add runtime_env isolation for multi-cluster coordination paths#58

Merged
TejasNaikk merged 3 commits into
mainfrom
feature/runtime-env-isolation
Jan 11, 2026
Merged

Add runtime_env isolation for multi-cluster coordination paths#58
TejasNaikk merged 3 commits into
mainfrom
feature/runtime-env-isolation

Conversation

@TejasNaikk
Copy link
Copy Markdown
Owner

@TejasNaikk TejasNaikk commented Jan 8, 2026

Controllers in different environments (staging, production) now use isolated etcd paths for multi-cluster coordination, preventing cross-environment interference.

Changes:

  • Add runtime_env config to ClusterControllerConfig (default: staging)
  • Multi-cluster paths now include env: /multi-cluster/<env>/controllers/...
  • Fix path parsing in ClusterRegistry and ControllerRegistry
  • Add unit tests

Example:
Staging controller → /multi-cluster/staging/controllers/controller-1/heartbeat
Production controller → /multi-cluster/production/controllers/controller-1/heartbeat

Test Plan

Unit Tests
Local Tests:

After starting 3 controllers simultaneously with 3 os clusters

etcdctl get --prefix /multi-cluster/staging
/multi-cluster/staging/clusters/cluster-alpha/assigned-to
{"controller":"controller-2","cluster":"cluster-alpha","timestamp":1767898843994,"lease":"694d9b9ef15130ee"}
/multi-cluster/staging/clusters/cluster-alpha/metadata
{"clusterId":"cluster-alpha","endpoint":"http://cluster-alpha:9200"}
/multi-cluster/staging/clusters/cluster-beta/assigned-to
{"controller":"controller-2","cluster":"cluster-beta","timestamp":1767898776586,"lease":"694d9b9ef151305b"}
/multi-cluster/staging/clusters/cluster-beta/metadata
{"clusterId":"cluster-beta","endpoint":"http://cluster-beta:9200"}
/multi-cluster/staging/clusters/cluster-gamma/assigned-to
{"controller":"controller-3","cluster":"cluster-gamma","timestamp":1767898844022,"lease":"694d9b9ef15130ec"}
/multi-cluster/staging/clusters/cluster-gamma/metadata
{"clusterId":"cluster-gamma","endpoint":"http://cluster-gamma:9200"}
/multi-cluster/staging/controllers/controller-2/assigned/cluster-alpha
{"controller":"controller-2","cluster":"cluster-alpha","timestamp":1767898843994,"lease":"694d9b9ef15130ee"}
/multi-cluster/staging/controllers/controller-2/assigned/cluster-beta
{"controller":"controller-2","cluster":"cluster-beta","timestamp":1767898776586,"lease":"694d9b9ef151305b"}
/multi-cluster/staging/controllers/controller-2/heartbeat
1767898776505
/multi-cluster/staging/controllers/controller-3/assigned/cluster-gamma
{"controller":"controller-3","cluster":"cluster-gamma","timestamp":1767898844022,"lease":"694d9b9ef15130ec"}
/multi-cluster/staging/controllers/controller-3/heartbeat
1767898778490
/multi-cluster/staging/locks/clusters/cluster-alpha/694d9b9ef15130ee

/multi-cluster/staging/locks/clusters/cluster-beta/694d9b9ef151305b

/multi-cluster/staging/locks/clusters/cluster-gamma/694d9b9ef15130ec

@TejasNaikk TejasNaikk force-pushed the feature/runtime-env-isolation branch from 0160edd to 096a5cf Compare January 8, 2026 19:45
log.info("Initializing cluster-agnostic MetadataStore connection to etcd");
try {
// Configure EtcdPathResolver with runtime environment for path isolation
EtcdPathResolver.getInstance().setRuntimeEnv(config.getRuntimeEnv());
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.

i think normally config yml is seen as build time config (static), run time is normally set by environment variables.
maybe we can make the value in application.yml as a default value to be overridden by a environment variables?

GeorgeZhai
GeorgeZhai previously approved these changes Jan 8, 2026
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.

LGTM

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.

LGTM

@TejasNaikk TejasNaikk merged commit 14cb87c into main Jan 11, 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