Skip to content

Commit

Permalink
feat: ipam support additional pools
Browse files Browse the repository at this point in the history
  • Loading branch information
fra98 committed Dec 2, 2024
1 parent b38a260 commit db3ed5a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/ipam/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion deployments/liqo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand All @@ -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. |
Expand Down
4 changes: 4 additions & 0 deletions deployments/liqo/templates/liqo-ipam-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions deployments/liqo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions pkg/ipam/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit db3ed5a

Please sign in to comment.