chore: supporting the listen-address parameter on db-manager (#2465)

Signed-off-by: Caio Almeida <[email protected]>
This commit is contained in:
Caio Almeida
2025-01-22 00:03:41 +00:00
committed by GitHub
parent 956f49ff87
commit 9c8c4e0c66
2 changed files with 9 additions and 6 deletions
+4 -3
View File
@@ -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
+5 -3
View File
@@ -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{})