@@ -23,7 +23,6 @@ import (
2323
2424 "github.com/spf13/cobra"
2525 "google.golang.org/grpc"
26- "google.golang.org/grpc/health"
2726 "google.golang.org/grpc/health/grpc_health_v1"
2827 corev1 "k8s.io/api/core/v1"
2928 "k8s.io/apimachinery/pkg/runtime"
@@ -71,6 +70,8 @@ func main() {
7170 restcfg .InitFlags (cmd .Flags ())
7271
7372 cmd .Flags ().IntVar (& options .Port , "port" , consts .IpamPort , "The port on which to listen for incoming gRPC requests." )
73+ cmd .Flags ().DurationVar (& options .SyncFrequency , "interval" , consts .SyncFrequency ,
74+ "The interval at which the IPAM will synchronize the IPAM storage." )
7475 cmd .Flags ().BoolVar (& options .EnableLeaderElection , "leader-election" , false , "Enable leader election for IPAM. " +
7576 "Enabling this will ensure there is only one active IPAM." )
7677 cmd .Flags ().StringVar (& options .LeaderElectionNamespace , "leader-election-namespace" , consts .DefaultLiqoNamespace ,
@@ -102,14 +103,12 @@ func run(cmd *cobra.Command, _ []string) error {
102103
103104 // Get the rest config.
104105 cfg := restcfg .SetRateLimiter (ctrl .GetConfigOrDie ())
105- options .Config = cfg
106106 cl , err := client .New (cfg , client.Options {
107107 Scheme : scheme ,
108108 })
109109 if err != nil {
110110 return err
111111 }
112- options .Client = cl
113112
114113 if options .EnableLeaderElection {
115114 if leader , err := leaderelection .Blocking (ctx , cfg , record .NewBroadcaster (), & leaderelection.Opts {
@@ -129,10 +128,7 @@ func run(cmd *cobra.Command, _ []string) error {
129128 }
130129 }
131130
132- hs := health .NewServer ()
133- options .HealthServer = hs
134-
135- liqoIPAM , err := ipam .New (ctx , & options )
131+ liqoIPAM , err := ipam .New (ctx , cl , cfg , & options )
136132 if err != nil {
137133 return err
138134 }
@@ -145,7 +141,7 @@ func run(cmd *cobra.Command, _ []string) error {
145141 server := grpc .NewServer ()
146142
147143 // Register health service
148- grpc_health_v1 .RegisterHealthServer (server , hs )
144+ grpc_health_v1 .RegisterHealthServer (server , liqoIPAM . HealthServer )
149145
150146 // Register IPAM service
151147 ipam .RegisterIPAMServer (server , liqoIPAM )
0 commit comments