-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for SRV discovery for permissions-api host (#98)
To better support failover to other regions without adding load balancer hops and latency, permissions hosts can now support SRV record discovery to discover additional hosts which can serve requests. SRV records are looked up host configured for the permissions client. The SRV service looked up is `permissions-api` with protocol `tcp`. An example SRV lookup request would be for `_permissions-api._tcp.iam.example.com`. Where `iam.example.com` is the host configured for `permissions.host`. For best backwards compatibility, these SRV records are optional and will fallback to using the value provided in `permissions.host`. Additionally, to support retrying on failure, the permissions client was updated to support retrying auth checks if the response was not successful. This ensures a seamless transition when a host has failed between health checks. Signed-off-by: Mike Mason <[email protected]>
- Loading branch information
Showing
18 changed files
with
2,703 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package permissions | ||
|
||
import ( | ||
"github.com/hashicorp/go-retryablehttp" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var _ retryablehttp.LeveledLogger = (*retryableLogger)(nil) | ||
|
||
type retryableLogger struct { | ||
logger *zap.SugaredLogger | ||
} | ||
|
||
// Error implements retryablehttp.LeveledLogger | ||
func (l *retryableLogger) Error(msg string, keysAndValues ...any) { | ||
l.logger.Errorw(msg, keysAndValues...) | ||
} | ||
|
||
// Info implements retryablehttp.LeveledLogger | ||
func (l *retryableLogger) Info(msg string, keysAndValues ...any) { | ||
l.logger.Infow(msg, keysAndValues...) | ||
} | ||
|
||
// Debug implements retryablehttp.LeveledLogger | ||
func (l *retryableLogger) Debug(msg string, keysAndValues ...any) { | ||
l.logger.Debugw(msg, keysAndValues...) | ||
} | ||
|
||
// Warn implements retryablehttp.LeveledLogger | ||
func (l *retryableLogger) Warn(msg string, keysAndValues ...any) { | ||
l.logger.Warnw(msg, keysAndValues...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Package selecthost handles host discovery via DNS SRV records, keeps track of healthy | ||
// and selects the most optimal host for use. | ||
// | ||
// An HTTP [Transport] is provided which simplifies using this package with any http client. | ||
package selecthost |
Oops, something went wrong.