Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nsurfer committed Sep 4, 2020
1 parent a8fd64b commit 303b67d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pkg/apis/nats/v1alpha2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ type RemoteGatewayOpts struct {

// LeafNodeRemote is the URL for remote NATS system.
type LeafNodeRemote struct {
URL string `json:"url,omitempty"`
Credentials string `json:"credentials,omitempty"`
URL string `json:"url,omitempty"`
URLs []string `json:"urls,omitempty"`
Credentials string `json:"credentials,omitempty"`
}

// LeafNodeConfig is the configuration for leafnodes.
Expand Down
9 changes: 8 additions & 1 deletion pkg/apis/nats/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/conf/natsconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ type GatewayConfig struct {

// LeafNodeRemote is the URL for remote NATS system.
type LeafNodeRemote struct {
URL string `json:"url,omitempty"`
Credentials string `json:"credentials,omitempty"`
URLs []string `json:"urls,omitempty"`
Credentials string `json:"credentials,omitempty"`
}

type LeafNodeServerConfig struct {
Expand Down
10 changes: 9 additions & 1 deletion pkg/util/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,16 @@ func addGatewayConfig(sconfig *natsconf.ServerConfig, cluster v1alpha2.ClusterSp
Port: cluster.LeafNodeConfig.Port,
}
for _, r := range cluster.LeafNodeConfig.Remotes {
var urls []string
if r.URL != "" {
urls = append(urls, r.URL)
}
if len(r.URLs) > 0 {
urls = append(urls, r.URLs...)
}

sconfig.LeafNode.Remotes = append(sconfig.LeafNode.Remotes, natsconf.LeafNodeRemote{
URL: r.URL,
URLs: urls,
Credentials: r.Credentials,
})
}
Expand Down

0 comments on commit 303b67d

Please sign in to comment.