From 589044bb6658f91064ff21aff99398e439a92148 Mon Sep 17 00:00:00 2001 From: Francesco Torta <62566275+fra98@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:50:34 +0100 Subject: [PATCH] feat: ipam support additional pools --- cmd/ipam/main.go | 3 ++- deployments/liqo/templates/liqo-ipam-deployment.yaml | 4 ++++ deployments/liqo/values.yaml | 6 +++--- pkg/ipam/initialize.go | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/ipam/main.go b/cmd/ipam/main.go index 874470f428..b879a46198 100644 --- a/cmd/ipam/main.go +++ b/cmd/ipam/main.go @@ -74,7 +74,8 @@ func main() { "The interval at which the IPAM will synchronize the IPAM storage.") cmd.Flags().BoolVar(&options.ServerOpts.GraphvizEnabled, "enable-graphviz", false, "Enable the graphviz output for the IPAM.") cmd.Flags().StringSliceVar(&options.ServerOpts.Pools, "pools", - []string{"10.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12"}, "The pools used by the IPAM.", + []string{"10.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12"}, + "The pools used by the IPAM to acquire Networks and IPs from. Default: private addesses range.", ) // Leader election flags. diff --git a/deployments/liqo/templates/liqo-ipam-deployment.yaml b/deployments/liqo/templates/liqo-ipam-deployment.yaml index bcb33b08ed..0f998ee1a2 100644 --- a/deployments/liqo/templates/liqo-ipam-deployment.yaml +++ b/deployments/liqo/templates/liqo-ipam-deployment.yaml @@ -56,6 +56,10 @@ spec: - --leader-election - --leader-election-namespace=$(POD_NAMESPACE) {{- end }} + {{- if .Values.ipam.pools }} + {{- $d := dict "commandName" "--pools" "list" .Values.ipam.pools }} + {{- include "liqo.concatenateList" $d | nindent 12 }} + {{- end }} {{- if .Values.common.extraArgs }} {{- toYaml .Values.common.extraArgs | nindent 12 }} {{- end }} diff --git a/deployments/liqo/values.yaml b/deployments/liqo/values.yaml index ef04de745f..442fbc8a36 100644 --- a/deployments/liqo/values.yaml +++ b/deployments/liqo/values.yaml @@ -464,10 +464,10 @@ ipam: # you need tell liqo the subnets used in your cluster. E.g if your cluster nodes belong to the 192.168.2.0/24 subnet, then # you should add that subnet to the reservedSubnets. PodCIDR and serviceCIDR used in the local cluster are automatically added to the reserved list. reservedSubnets: [] - # -- Set of additional network pools to perform the automatic address mapping in Liqo. + # -- Set of network pools to perform the automatic address mapping in Liqo. # Network pools are used to map a cluster network into another one in order to prevent conflicts. - # Default set of network pools is: [10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12] - additionalPools: [] + # If left empty, it is defaulted to the private addresses range: [10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12] + pools: [] crdReplicator: pod: diff --git a/pkg/ipam/initialize.go b/pkg/ipam/initialize.go index 6dc72f5a1b..35d669ee36 100644 --- a/pkg/ipam/initialize.go +++ b/pkg/ipam/initialize.go @@ -29,6 +29,8 @@ func (lipam *LiqoIPAM) initialize(ctx context.Context) error { defer lipam.mutex.Unlock() klog.Info("Initializing IPAM") + klog.Infof("IPAM pools: %v", lipam.opts.Pools) + if err := lipam.initializeNetworks(ctx); err != nil { return err }