Skip to content

Commit

Permalink
feature: ipam support additional pools
Browse files Browse the repository at this point in the history
  • Loading branch information
fra98 committed Nov 25, 2024
1 parent c765c47 commit 3b2993d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/ipam/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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. "+
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 @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions deployments/liqo/templates/liqo-ipam-networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ metadata:
ipam.liqo.io/network-not-remapped: "true"
spec:
cidr: {{ $value }}
---
{{- end }}
3 changes: 3 additions & 0 deletions pkg/ipam/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3b2993d

Please sign in to comment.