@@ -555,7 +555,8 @@ pub struct RoutingConfigSection {
555555#[ rkyv( attr( derive( PartialEq , Eq , Debug ) ) ) ]
556556pub struct ConfigServerSection {
557557 /// gRPC server address (TCP or Unix socket)
558- pub address : GrpcAddress ,
558+ pub address : Option < GrpcAddress > ,
559+ pub config_dir : Option < String > ,
559560}
560561
561562/// Complete dataplane launch configuration.
@@ -1088,12 +1089,12 @@ impl TryFrom<CmdArgs> for LaunchConfiguration {
10881089 general : GeneralConfigSection {
10891090 name : value. get_name ( ) . cloned ( ) ,
10901091 } ,
1091- config_server : value
1092- . grpc_address ( )
1093- . map_err ( InvalidCmdArguments :: InvalidGrpcAddress ) ?
1094- . map ( |grpc_address| ConfigServerSection {
1095- address : grpc_address ,
1096- } ) ,
1092+ config_server : Some ( ConfigServerSection {
1093+ address : value
1094+ . grpc_address ( )
1095+ . map_err ( InvalidCmdArguments :: InvalidGrpcAddress ) ? ,
1096+ config_dir : value . config_dir ( ) . cloned ( ) ,
1097+ } ) ,
10971098 driver : match & value. driver {
10981099 Some ( driver) if driver == "dpdk" => {
10991100 // TODO: adjust command line to specify lcore usage more flexibly in next PR
@@ -1275,6 +1276,17 @@ E.g. default=error,all=info,nat=debug will set the default target to error, and
12751276
12761277 #[ arg( long, help = "Set the name of this gateway" ) ]
12771278 name : Option < String > ,
1279+
1280+ #[ arg(
1281+ long,
1282+ help = "Run in k8s-less mode using this directory to watch for configurations.
1283+ You can copy json/yaml config files in this directory to reconfigure dataplane. You can modify existing
1284+ files or just 'touch' them to trigger a new reconfiguration. Every change will increase the generation id by one.
1285+ NOTE: dataplane tracks file 'save' events. If you modify an existing file, depending on the editor used, this will
1286+ trigger more than one reconfiguration (e.g. gedit). If this is undesired, use nano or vi(m), or edit your file
1287+ elsewhere and copy it in the configuration directory. This mode is meant mostly for debugging or early testing."
1288+ ) ]
1289+ config_dir : Option < String > ,
12781290}
12791291
12801292impl CmdArgs {
@@ -1464,6 +1476,14 @@ impl CmdArgs {
14641476 pub fn get_name ( & self ) -> Option < & String > {
14651477 self . name . as_ref ( )
14661478 }
1479+
1480+ /// Get the configuration directory.
1481+ /// Setting the configuration directory enables k8s-less mode, where configurations are retrieved from files
1482+ /// or their changes in the configuration directory.
1483+ #[ must_use]
1484+ pub fn config_dir ( & self ) -> Option < & String > {
1485+ self . config_dir . as_ref ( )
1486+ }
14671487}
14681488
14691489#[ cfg( test) ]
0 commit comments