mirror of
https://github.com/hanzo-ml/katib.git
synced 2026-09-24 00:31:27 +00:00
chore: supporting the listen-address parameter on db-manager (#2465)
Signed-off-by: Caio Almeida <[email protected]>
This commit is contained in:
+4
-3
@@ -88,9 +88,10 @@ Below is a list of command-line flags accepted by Katib controller:
|
||||
|
||||
Below is a list of command-line flags accepted by Katib DB Manager:
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --------------- | ------------- | ------- | ------------------------------------------------------- |
|
||||
| connect-timeout | time.Duration | 60s | Timeout before calling error during database connection |
|
||||
| Name | Type | Default | Description |
|
||||
| --------------- | ------------- | -------------| ------------------------------------------------------------------- |
|
||||
| connect-timeout | time.Duration | 60s | Timeout before calling error during database connection |
|
||||
| listen-address | string | 0.0.0.0:6789 | The network interface or IP address to receive incoming connections |
|
||||
|
||||
## Katib admission webhooks
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
port = "0.0.0.0:6789"
|
||||
defaultListenAddress = "0.0.0.0:6789"
|
||||
defaultConnectTimeout = time.Second * 60
|
||||
)
|
||||
|
||||
@@ -90,7 +90,9 @@ func (s *server) Check(ctx context.Context, in *health_pb.HealthCheckRequest) (*
|
||||
|
||||
func main() {
|
||||
var connectTimeout time.Duration
|
||||
var listenAddress string
|
||||
flag.DurationVar(&connectTimeout, "connect-timeout", defaultConnectTimeout, "Timeout before calling error during database connection. (e.g. 120s)")
|
||||
flag.StringVar(&listenAddress, "listen-address", defaultListenAddress, "The network interface or IP address to receive incoming connections. (e.g. 0.0.0.0:6789)")
|
||||
flag.Parse()
|
||||
|
||||
var err error
|
||||
@@ -104,13 +106,13 @@ func main() {
|
||||
klog.Fatalf("Failed to open db connection: %v", err)
|
||||
}
|
||||
dbIf.DBInit()
|
||||
listener, err := net.Listen("tcp", port)
|
||||
listener, err := net.Listen("tcp", listenAddress)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed to listen: %v", err)
|
||||
}
|
||||
|
||||
size := 1<<31 - 1
|
||||
klog.Infof("Start Katib manager: %s", port)
|
||||
klog.Infof("Start Katib manager: %s", listenAddress)
|
||||
s := grpc.NewServer(grpc.MaxRecvMsgSize(size), grpc.MaxSendMsgSize(size))
|
||||
api_pb.RegisterDBManagerServer(s, &server{})
|
||||
health_pb.RegisterHealthServer(s, &server{})
|
||||
|
||||
Reference in New Issue
Block a user