Skip to content

Commit

Permalink
Unify config name and format (#2843)
Browse files Browse the repository at this point in the history
Use same naming and format convention for for NodeIPAM as it is for
other Antrea features.

Fixes: #2839
Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray authored and liu4480 committed Jun 15, 2022
1 parent 38dfd2e commit 3a8d203
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 61 deletions.
16 changes: 8 additions & 8 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- antrea-config-99dtkgmckh
- antrea-config-k4kb8fm255
resources:
- configmaps
verbs:
Expand Down Expand Up @@ -3916,14 +3916,14 @@ data:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false
# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []
# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:
# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand All @@ -3937,7 +3937,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -4008,7 +4008,7 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: ANTREA_CONFIG_MAP_NAME
value: antrea-config-99dtkgmckh
value: antrea-config-k4kb8fm255
image: projects.registry.vmware.com/antrea/antrea-ubuntu:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down Expand Up @@ -4059,7 +4059,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -4355,7 +4355,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
16 changes: 8 additions & 8 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- antrea-config-99dtkgmckh
- antrea-config-k4kb8fm255
resources:
- configmaps
verbs:
Expand Down Expand Up @@ -3916,14 +3916,14 @@ data:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false
# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []
# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:
# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand All @@ -3937,7 +3937,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -4008,7 +4008,7 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: ANTREA_CONFIG_MAP_NAME
value: antrea-config-99dtkgmckh
value: antrea-config-k4kb8fm255
image: projects.registry.vmware.com/antrea/antrea-ubuntu:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down Expand Up @@ -4059,7 +4059,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -4357,7 +4357,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-99dtkgmckh
name: antrea-config-k4kb8fm255
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
16 changes: 8 additions & 8 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- antrea-config-cf84k5688d
- antrea-config-g28k2t6c9k
resources:
- configmaps
verbs:
Expand Down Expand Up @@ -3916,14 +3916,14 @@ data:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false
# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []
# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:
# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand All @@ -3937,7 +3937,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-cf84k5688d
name: antrea-config-g28k2t6c9k
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -4008,7 +4008,7 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: ANTREA_CONFIG_MAP_NAME
value: antrea-config-cf84k5688d
value: antrea-config-g28k2t6c9k
image: projects.registry.vmware.com/antrea/antrea-ubuntu:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down Expand Up @@ -4059,7 +4059,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-cf84k5688d
name: antrea-config-g28k2t6c9k
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -4358,7 +4358,7 @@ spec:
path: /home/kubernetes/bin
name: host-cni-bin
- configMap:
name: antrea-config-cf84k5688d
name: antrea-config-g28k2t6c9k
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
16 changes: 8 additions & 8 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- antrea-config-9dh28h4g8d
- antrea-config-k2g27bhk9h
resources:
- configmaps
verbs:
Expand Down Expand Up @@ -3921,14 +3921,14 @@ data:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false
# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []
# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:
# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand All @@ -3942,7 +3942,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-9dh28h4g8d
name: antrea-config-k2g27bhk9h
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -4022,7 +4022,7 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: ANTREA_CONFIG_MAP_NAME
value: antrea-config-9dh28h4g8d
value: antrea-config-k2g27bhk9h
image: projects.registry.vmware.com/antrea/antrea-ubuntu:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down Expand Up @@ -4073,7 +4073,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-9dh28h4g8d
name: antrea-config-k2g27bhk9h
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -4404,7 +4404,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-9dh28h4g8d
name: antrea-config-k2g27bhk9h
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
16 changes: 8 additions & 8 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- antrea-config-t4dt6g6kf5
- antrea-config-c48mcgtk29
resources:
- configmaps
verbs:
Expand Down Expand Up @@ -3921,14 +3921,14 @@ data:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false
# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []
# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:
# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand All @@ -3942,7 +3942,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-t4dt6g6kf5
name: antrea-config-c48mcgtk29
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -4013,7 +4013,7 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: ANTREA_CONFIG_MAP_NAME
value: antrea-config-t4dt6g6kf5
value: antrea-config-c48mcgtk29
image: projects.registry.vmware.com/antrea/antrea-ubuntu:latest
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down Expand Up @@ -4064,7 +4064,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-t4dt6g6kf5
name: antrea-config-c48mcgtk29
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -4360,7 +4360,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-t4dt6g6kf5
name: antrea-config-c48mcgtk29
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
6 changes: 3 additions & 3 deletions build/yamls/base/conf/antrea-controller.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ nodeIPAM:
# Enable the integrated Node IPAM controller within the Antrea controller.
# enableNodeIPAM: false

# CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
# CIDR Ranges for Pods in cluster. String array containing single CIDR range, or multiple ranges.
# The CIDRs could be either IPv4 or IPv6. Value ignored when enableNodeIPAM is false.
# clusterCIDRs:
# clusterCIDRs: []

# CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
# Value ignored when enableNodeIPAM is false.
# serviceCIDR:
# secondaryServiceCIDR:
# serviceCIDRv6:

# Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when enableNodeIPAM is false
# or when IPv4 Pod CIDR is not configured. Valid range is 16 to 30.
Expand Down
6 changes: 3 additions & 3 deletions cmd/antrea-controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type NodeIPAMConfig struct {
EnableNodeIPAM bool `yaml:"enableNodeIPAM,omitempty"`
// CIDR Ranges for Pods in cluster. Value can contain a single CIDR range, or multiple ranges, separated by commas.
// The CIDRs could be either IPv4 or IPv6. Value ignored when EnableNodeIPAM is false.
ClusterCIDRs string `yaml:"clusterCIDRs,omitempty"`
ClusterCIDRs []string `yaml:"clusterCIDRs,omitempty"`
// CIDR Ranges for Services in cluster. It is not necessary to specify it when there is no overlap with clusterCIDRs.
// Value ignored when EnableNodeIPAM is false.
ServiceCIDR string `yaml:"serviceCIDR,omitempty"`
SecondaryServiceCIDR string `yaml:"secondaryServiceCIDR,omitempty"`
ServiceCIDR string `yaml:"serviceCIDR,omitempty"`
ServiceCIDRv6 string `yaml:"serviceCIDRv6,omitempty"`
// Mask size for IPv4 Node CIDR in IPv4 or dual-stack cluster. Value ignored when EnableNodeIPAM is false
// or when IPv4 Pod CIDR is not configured.
NodeCIDRMaskSizeIPv4 int `yaml:"nodeCIDRMaskSizeIPv4,omitempty"`
Expand Down
12 changes: 5 additions & 7 deletions cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"net"
"os"
"path"
"strings"
"time"

apiextensionclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
Expand Down Expand Up @@ -357,16 +356,15 @@ func run(o *Options) error {
go networkPolicyStatusController.Run(stopCh)
}
if features.DefaultFeatureGate.Enabled(features.NodeIPAM) && o.config.NodeIPAM.EnableNodeIPAM {
cidrSplit := strings.Split(strings.TrimSpace(o.config.NodeIPAM.ClusterCIDRs), ",")
clusterCIDRs, _ := netutils.ParseCIDRs(cidrSplit)
clusterCIDRs, _ := netutils.ParseCIDRs(o.config.NodeIPAM.ClusterCIDRs)
_, serviceCIDR, _ := net.ParseCIDR(o.config.NodeIPAM.ServiceCIDR)
_, secondaryServiceCIDR, _ := net.ParseCIDR(o.config.NodeIPAM.SecondaryServiceCIDR)
_, serviceCIDRv6, _ := net.ParseCIDR(o.config.NodeIPAM.ServiceCIDRv6)
err = startNodeIPAM(
client,
informerFactory,
clusterCIDRs,
serviceCIDR,
secondaryServiceCIDR,
serviceCIDRv6,
o.config.NodeIPAM.NodeCIDRMaskSizeIPv4,
o.config.NodeIPAM.NodeCIDRMaskSizeIPv6,
stopCh)
Expand Down Expand Up @@ -418,7 +416,7 @@ func startNodeIPAM(client clientset.Interface,
informerFactory informers.SharedInformerFactory,
clusterCIDRs []*net.IPNet,
serviceCIDR *net.IPNet,
secondaryServiceCIDR *net.IPNet,
serviceCIDRv6 *net.IPNet,
nodeCIDRMaskSizeIPv4 int,
nodeCIDRMaskSizeIPv6 int,
stopCh <-chan struct{}) error {
Expand All @@ -429,7 +427,7 @@ func startNodeIPAM(client clientset.Interface,
client,
clusterCIDRs,
serviceCIDR,
secondaryServiceCIDR,
serviceCIDRv6,
nodeCIDRMaskSizes,
ipam.RangeAllocatorType,
)
Expand Down
Loading

0 comments on commit 3a8d203

Please sign in to comment.