diff --git a/cmd/ipam/main.go b/cmd/ipam/main.go index 79c926a05d..a0026273c1 100644 --- a/cmd/ipam/main.go +++ b/cmd/ipam/main.go @@ -72,6 +72,8 @@ func main() { cmd.Flags().IntVar(&options.ServerOpts.Port, "port", consts.IpamPort, "The port on which to listen for incoming gRPC requests.") cmd.Flags().DurationVar(&options.ServerOpts.SyncFrequency, "interval", consts.SyncFrequency, "The interval at which the IPAM will synchronize the IPAM storage.") + cmd.Flags().StringSliceVar(&options.ServerOpts.AdditionalPools, "additional-pools", []string{}, + "Additional pools to acquire IPs and Networks from.") // Leader election flags. cmd.Flags().BoolVar(&options.EnableLeaderElection, "leader-election", false, "Enable leader election for IPAM. "+ diff --git a/deployments/liqo/templates/liqo-ipam-deployment.yaml b/deployments/liqo/templates/liqo-ipam-deployment.yaml index 7ced18abe2..2f42c220e6 100644 --- a/deployments/liqo/templates/liqo-ipam-deployment.yaml +++ b/deployments/liqo/templates/liqo-ipam-deployment.yaml @@ -55,6 +55,10 @@ spec: - --leader-election - --leader-election-namespace=$(POD_NAMESPACE) {{- end }} + {{- if .Values.ipam.additionalPools }} + {{- $d := dict "commandName" "--additional-pools" "list" .Values.ipam.additionalPools }} + {{- include "liqo.concatenateList" $d | nindent 12 }} + {{- end }} {{- if .Values.common.extraArgs }} {{- toYaml .Values.common.extraArgs | nindent 12 }} {{- end }} diff --git a/pkg/ipam/initialize.go b/pkg/ipam/initialize.go index 647e04e8cf..9b0da85fe6 100644 --- a/pkg/ipam/initialize.go +++ b/pkg/ipam/initialize.go @@ -24,6 +24,9 @@ import ( // +kubebuilder:rbac:groups=ipam.liqo.io,resources=networks,verbs=get;list;watch func (lipam *LiqoIPAM) initialize(ctx context.Context) error { + // TODO: set additional pools + klog.Infof("Additional pools: %v", lipam.opts.AdditionalPools) + if err := lipam.initializeNetworks(ctx); err != nil { return err } diff --git a/pkg/ipam/ipam.go b/pkg/ipam/ipam.go index 5cfe349209..7224a71b52 100644 --- a/pkg/ipam/ipam.go +++ b/pkg/ipam/ipam.go @@ -41,6 +41,8 @@ type LiqoIPAM struct { type ServerOptions struct { Port int SyncFrequency time.Duration + + AdditionalPools []string } // New creates a new instance of the LiqoIPAM.