forked from TrueCloudLab/frostfs-node
[#1170] morph: Support mTLS
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
68ac490729
commit
42ecc2f2b9
5 changed files with 42 additions and 12 deletions
|
@ -11,8 +11,9 @@ import (
|
|||
|
||||
// Endpoint represents morph endpoint together with its priority.
|
||||
type Endpoint struct {
|
||||
Address string
|
||||
Priority int
|
||||
Address string
|
||||
Priority int
|
||||
MTLSConfig *MTLSConfig
|
||||
}
|
||||
|
||||
type endpoints struct {
|
||||
|
@ -38,11 +39,11 @@ func (c *Client) SwitchRPC(ctx context.Context) bool {
|
|||
|
||||
// Iterate endpoints in the order of decreasing priority.
|
||||
for c.endpoints.curr = range c.endpoints.list {
|
||||
newEndpoint := c.endpoints.list[c.endpoints.curr].Address
|
||||
newEndpoint := c.endpoints.list[c.endpoints.curr]
|
||||
cli, act, err := c.newCli(ctx, newEndpoint)
|
||||
if err != nil {
|
||||
c.logger.Warn(logs.ClientCouldNotEstablishConnectionToTheSwitchedRPCNode,
|
||||
zap.String("endpoint", newEndpoint),
|
||||
zap.String("endpoint", newEndpoint.Address),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
||||
|
@ -52,7 +53,7 @@ func (c *Client) SwitchRPC(ctx context.Context) bool {
|
|||
c.cache.invalidate()
|
||||
|
||||
c.logger.Info(logs.ClientConnectionToTheNewRPCNodeHasBeenEstablished,
|
||||
zap.String("endpoint", newEndpoint))
|
||||
zap.String("endpoint", newEndpoint.Address))
|
||||
|
||||
c.client = cli
|
||||
c.setActor(act)
|
||||
|
@ -119,7 +120,7 @@ mainLoop:
|
|||
|
||||
tryE := e.Address
|
||||
|
||||
cli, act, err := c.newCli(ctx, tryE)
|
||||
cli, act, err := c.newCli(ctx, e)
|
||||
if err != nil {
|
||||
c.logger.Warn(logs.ClientCouldNotCreateClientToTheHigherPriorityNode,
|
||||
zap.String("endpoint", tryE),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue