@@ -33,9 +33,7 @@ package ambex
3333 * will get sent to the Envoy.
3434 * - We manage the SnapshotCache by loading envoy configuration from
3535 * json and/or protobuf files on disk.
36- * - By default when we get a SIGHUP, we reload configuration.
37- * - When passed the -watch argument we reload whenever any file in
38- * the directory changes.
36+ * - When we get a SIGHUP, we reload configuration.
3937 */
4038
4139import (
@@ -55,7 +53,6 @@ import (
5553 "syscall"
5654
5755 // third-party libraries
58- "github.com/fsnotify/fsnotify"
5956 "google.golang.org/grpc"
6057 "google.golang.org/protobuf/encoding/protojson"
6158 "google.golang.org/protobuf/encoding/prototext"
@@ -113,8 +110,6 @@ import (
113110)
114111
115112type Args struct {
116- watch bool
117-
118113 adsNetwork string
119114 adsAddress string
120115
@@ -132,8 +127,6 @@ func parseArgs(ctx context.Context, rawArgs ...string) (*Args, error) {
132127 var args Args
133128 flagset := flag .NewFlagSet ("ambex" , flag .ContinueOnError )
134129
135- flagset .BoolVar (& args .watch , "watch" , false , "Watch for file changes" )
136-
137130 // TODO(lukeshu): Consider changing the default here so we don't need to put it in entrypoint.sh
138131 flagset .StringVar (& args .adsNetwork , "ads-listen-network" , "tcp" , "network for ADS to listen on" )
139132 flagset .StringVar (& args .adsAddress , "ads-listen-address" , ":18000" , "address (on --ads-listen-network) for ADS to listen on" )
@@ -647,20 +640,6 @@ func Main(
647640
648641 dlog .Infof (ctx , "Ambex %s starting, snapdirPath %s" , Version , args .snapdirPath )
649642
650- watcher , err := fsnotify .NewWatcher ()
651- if err != nil {
652- return err
653- }
654- defer watcher .Close ()
655-
656- if args .watch {
657- for _ , d := range args .dirs {
658- if err := watcher .Add (d ); err != nil {
659- return err
660- }
661- }
662- }
663-
664643 // The golang signal package does not block when it writes to the channel. We therefore need a
665644 // nonzero buffer for the channel to minimize the possiblity that we miss out on a signal that
666645 // comes in while we are doing work and not reading from the channel. To minimize the chance
@@ -762,26 +741,6 @@ func Main(
762741 if err != nil {
763742 return err
764743 }
765- case <- watcher .Events :
766- // Non-fastpath update. Just update.
767- err := update (
768- ctx ,
769- args .snapdirPath ,
770- args .numsnaps ,
771- args .edsBypass ,
772- configv3 ,
773- & generation ,
774- args .dirs ,
775- edsEndpointsV3 ,
776- fastpathSnapshot ,
777- updates ,
778- )
779- if err != nil {
780- return err
781- }
782- case err := <- watcher .Errors :
783- // Something went wrong, so scream about that.
784- dlog .Warnf (ctx , "Watcher error: %v" , err )
785744 case <- ctx .Done ():
786745 return nil
787746 }
0 commit comments