Skip to content

Commit

Permalink
clustermesh: Introduce CiliumClusterConfig
Browse files Browse the repository at this point in the history
Add a new type CiliumClusterConfig which represents a cluster
configuration. This will be serialized and stored into kvstore during
the clustermesh-apiserver startup time. Later on, cilium-agent on each
node reads it when connecting to new clusters.

The current use case of this is getting ClusterID at connect time, but by
exposing the cluster configuration, we can also do some useful validation
such as

- Make sure the cluster id is not conflicting with existing clusters.
- Make sure the new cluster doesn't have any capability mismatch.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
  • Loading branch information
YutaroHayakawa authored and pchaigno committed Dec 12, 2022
1 parent 7bd7656 commit 857060b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/clustermesh/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ const (
// ClusterIDMax is the maximum value of the cluster ID
ClusterIDMax = 255
)

type CiliumClusterConfig struct {
ID uint32 `json:"id,omitempty"`
}
3 changes: 3 additions & 0 deletions pkg/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const (
// the heartbeat
HeartbeatPath = BaseKeyPrefix + "/.heartbeat"

// ClusterConfigPrefix is the kvstore prefix to cluster configuration
ClusterConfigPrefix = BaseKeyPrefix + "/cluster-config"

// HeartbeatWriteInterval is the interval in which the heartbeat key at
// HeartbeatPath is updated
HeartbeatWriteInterval = time.Minute
Expand Down

0 comments on commit 857060b

Please sign in to comment.