Skip to content

Commit 59af784

Browse files
chore: supporting the listen-address parameter on db-manager (#2465)
Signed-off-by: Caio Almeida <[email protected]>
1 parent 224aa9d commit 59af784

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CONTRIBUTING.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ Below is a list of command-line flags accepted by Katib controller:
8888

8989
Below is a list of command-line flags accepted by Katib DB Manager:
9090

91-
| Name | Type | Default | Description |
92-
| --------------- | ------------- | ------- | ------------------------------------------------------- |
93-
| connect-timeout | time.Duration | 60s | Timeout before calling error during database connection |
91+
| Name | Type | Default | Description |
92+
| --------------- | ------------- | -------------| ------------------------------------------------------------------- |
93+
| connect-timeout | time.Duration | 60s | Timeout before calling error during database connection |
94+
| listen-address | string | 0.0.0.0:6789 | The network interface or IP address to receive incoming connections |
9495

9596
## Katib admission webhooks
9697

cmd/db-manager/v1beta1/main.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
const (
38-
port = "0.0.0.0:6789"
38+
defaultListenAddress = "0.0.0.0:6789"
3939
defaultConnectTimeout = time.Second * 60
4040
)
4141

@@ -90,7 +90,9 @@ func (s *server) Check(ctx context.Context, in *health_pb.HealthCheckRequest) (*
9090

9191
func main() {
9292
var connectTimeout time.Duration
93+
var listenAddress string
9394
flag.DurationVar(&connectTimeout, "connect-timeout", defaultConnectTimeout, "Timeout before calling error during database connection. (e.g. 120s)")
95+
flag.StringVar(&listenAddress, "listen-address", defaultListenAddress, "The network interface or IP address to receive incoming connections. (e.g. 0.0.0.0:6789)")
9496
flag.Parse()
9597

9698
var err error
@@ -104,13 +106,13 @@ func main() {
104106
klog.Fatalf("Failed to open db connection: %v", err)
105107
}
106108
dbIf.DBInit()
107-
listener, err := net.Listen("tcp", port)
109+
listener, err := net.Listen("tcp", listenAddress)
108110
if err != nil {
109111
klog.Fatalf("Failed to listen: %v", err)
110112
}
111113

112114
size := 1<<31 - 1
113-
klog.Infof("Start Katib manager: %s", port)
115+
klog.Infof("Start Katib manager: %s", listenAddress)
114116
s := grpc.NewServer(grpc.MaxRecvMsgSize(size), grpc.MaxSendMsgSize(size))
115117
api_pb.RegisterDBManagerServer(s, &server{})
116118
health_pb.RegisterHealthServer(s, &server{})

0 commit comments

Comments
 (0)