Skip to content

Commit

Permalink
Add a secret for all-sharded cluster if there is a one defined for the
Browse files Browse the repository at this point in the history
first one.
  • Loading branch information
alex-zaitsev committed Jan 21, 2025
1 parent 9a5a18d commit 8f51051
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/model/chi/config/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ func (c *Generator) getRemoteServers(selector *config.HostSelector) string {
// <all-sharded>
clusterName = AllShardsOneReplicaClusterName
util.Iline(b, 8, "<%s>", clusterName)

// Add secret to all-sharded from the first cluster if present
cluster := c.cr.FindCluster(0)
// <secret>VALUE</secret>
switch cluster.GetSecret().Source() {
case chi.ClusterSecretSourcePlaintext:
// Secret value is explicitly specified
util.Iline(b, 12, "<secret>%s</secret>", cluster.GetSecret().Value)
case chi.ClusterSecretSourceSecretRef, chi.ClusterSecretSourceAuto:
// Use secret via ENV var from secret
util.Iline(b, 12, `<secret from_env="%s" />`, InternodeClusterSecretEnvName)
}

c.cr.WalkHosts(func(host *chi.Host) error {
if selector.Include(host) {
// <shard>
Expand Down

0 comments on commit 8f51051

Please sign in to comment.