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/README.md b/deployments/liqo/README.md index c9ebe013f0..0ad1a504a6 100644 --- a/deployments/liqo/README.md +++ b/deployments/liqo/README.md @@ -47,7 +47,6 @@ | discovery.config.clusterID | string | `""` | Specify an unique ID for your cluster. This ID is used to identify your cluster in the peering process. | | discovery.config.clusterLabels | object | `{}` | A set of labels that characterizes the local cluster when exposed remotely as a virtual node. It is suggested to specify the distinguishing characteristics that may be used to decide whether to offload pods on this cluster. | | fullnameOverride | string | `""` | Override the standard full name used by Helm and associated to Kubernetes/Liqo resources. | -| ipam.additionalPools | list | `[]` | Set of additional 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] | | ipam.external.enabled | bool | `false` | Use an external IPAM to allocate the IP addresses for the pods. Enabling it will disable the internal IPAM. | | ipam.external.url | string | `""` | The URL of the external IPAM. | | ipam.externalCIDR | string | `"10.70.0.0/16"` | The subnet used for the external CIDR. | @@ -63,6 +62,7 @@ | ipam.internal.syncInterval | string | `"2m"` | Set the interval at which the IPAM pod will synchronize it's in-memory status with the local cluster. If you want to disable the synchronization, set the interval to 0. | | ipam.internalCIDR | string | `"10.80.0.0/16"` | The subnet used for the internal CIDR. These IPs are assigned to the Liqo internal-network interfaces. | | ipam.podCIDR | string | `""` | The subnet used by the pods in your cluster, in CIDR notation (e.g., 10.0.0.0/16). | +| ipam.pools | list | `[]` | 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. 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] | | ipam.reservedSubnets | list | `[]` | List of IP subnets that do not have to be used by Liqo. Liqo can perform automatic IP address remapping when a remote cluster is peering with you, e.g., in case IP address spaces (e.g., PodCIDR) overlaps. In order to prevent IP conflicting between locally used private subnets in your infrastructure and private subnets belonging to remote clusters 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. | | ipam.serviceCIDR | string | `""` | The subnet used by the services in you cluster, in CIDR notation (e.g., 172.16.0.0/16). | | metricAgent.config.timeout | object | `{"read":"30s","write":"30s"}` | Set the timeout for the metrics server. | 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 }