Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade whereabouts CNI to v0.5.4 and align secondary network IPAM with additional pluginArgs #3987

Merged

Conversation

arunvelayutham
Copy link
Contributor

Register Whereabouts CNI as a valid IPAMType for secondary network configuration. Whereabouts is the IPAM used to configure secondary/virtual networks for Service function chaining needs at this time.

Signed-off-by: [email protected]

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2022

Codecov Report

Merging #3987 (0e15a85) into main (2f9134b) will decrease coverage by 0.07%.
The diff coverage is 37.34%.

❗ Current head 0e15a85 differs from pull request most recent head bb7da9a. Consider uploading reports for the commit bb7da9a to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3987      +/-   ##
==========================================
- Coverage   64.58%   64.51%   -0.08%     
==========================================
  Files         295      294       -1     
  Lines       43740    44314     +574     
==========================================
+ Hits        28251    28590     +339     
- Misses      13215    13420     +205     
- Partials     2274     2304      +30     
Flag Coverage Δ *Carryforward flag
e2e-tests 40.75% <5.09%> (?)
kind-e2e-tests 50.22% <10.28%> (-0.93%) ⬇️ Carriedforward from 36622c8
unit-tests 44.26% <36.87%> (-0.05%) ⬇️ Carriedforward from 36622c8

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
...icluster/cmd/multicluster-controller/controller.go 7.86% <0.00%> (-0.47%) ⬇️
multicluster/cmd/multicluster-controller/leader.go 0.00% <0.00%> (ø)
multicluster/cmd/multicluster-controller/main.go 0.00% <0.00%> (ø)
pkg/agent/agent_linux.go 5.36% <0.00%> (+0.22%) ⬆️
pkg/agent/cniserver/pod_configuration.go 54.59% <0.00%> (ø)
pkg/agent/openflow/client.go 68.44% <0.00%> (+3.27%) ⬆️
pkg/agent/openflow/multicast.go 0.00% <0.00%> (ø)
pkg/agent/openflow/pipeline.go 73.13% <0.00%> (-0.19%) ⬇️
pkg/agent/util/ndp/ndp.go 0.00% <0.00%> (ø)
pkg/agent/util/net.go 51.00% <0.00%> (-0.95%) ⬇️
... and 71 more

@arunvelayutham
Copy link
Contributor Author

/test-e2e

@antoninbas antoninbas requested a review from jianjuns July 11, 2022 22:12
@@ -28,8 +28,9 @@ import (
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But secondary network uses "pkg/agent/secondarynetwork/ipam". Why we need to register Whereabouts in cniserver/ipam?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses both the IPAM packages @jianjuns.
"pkg/agent/secondarynetwork/ipam"(whereabouts) is used to get the IPAddress from a specific subnet based on the virtual network provided on the Pod spec Annotation. But the IPaddress assignment to the VF interface is actually handled using cniserver/ipam APIs (configureInterface).

I'm looking to confirm that this fix actually address the issue. But have some lab connectivity issues since yesterday evening and I'm working with my peers at Santa clara lab to recover it.

Once the lab connectivity is restored today, I will retest this and confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Register whereabouts as a valid IPAMDriver at cniserver/IPAM fixed the "Unsupported IPAM type whereabouts" issue (When pod controller uses the CNI server IPAM APIs to assign the IP address to the secondary network interface at the pod context - Though the Virtual network specific IP addressed was retrieved using secondarynetwork/ipam API which using whereabouts CNI for IPAM).

@arunvelayutham arunvelayutham force-pushed the antrea-whereabout-cni-support branch from 546489e to 66af7fb Compare July 15, 2022 19:24
@arunvelayutham arunvelayutham force-pushed the antrea-whereabout-cni-support branch 2 times, most recently from e1284d7 to 8ff0fd8 Compare July 28, 2022 00:16
@arunvelayutham arunvelayutham changed the title Register Whereabouts CNI as a valid IPAMType for secondary network configuration Upgrade whereabouts CNI to v0.5.4 and align secondary network IPAM with additional pluginArgs Jul 28, 2022
@@ -365,4 +366,7 @@ func init() {

// Host local plugin is fallback driver
RegisterIPAMDriver(AntreaIPAMType, &IPAMDelegator{pluginType: ipamHostLocal})

// Whereabouts plugin for secondary network configuration.
RegisterIPAMDriver(WhereaboutsIPAMType, &IPAMDelegator{pluginType: WhereaboutsIPAMType})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you figured out why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I retested after removing the IPAM driver reg for whereabouts and with all the other fixes specific to whereabouts. It works good without registration. Not sure why we got the unsupport IPAM error earlier (before root cause other issues related to whereabouts configuration).

Thanks @jianjuns . I removed the IPAM reg part and pushed the updated changes.

With the updated changes, secondary interface is getting created successfully and got the IP assigned for the specific subnet (based on Annotation).
kubectl exec -it testpodsec15 -n kube-system -- ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
3: eth0@if113: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue
link/ether 7a:4c:50:d6:ea:24 brd ff:ff:ff:ff:ff:ff
inet 172.25.0.46/24 brd 172.25.0.255 scope global eth0
valid_lft forever preferred_lft forever
34: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1450 qdisc mq qlen 1000
link/ether 5e:eb:3e:08:16:04 brd ff:ff:ff:ff:ff:ff
inet 148.14.25.12/24 brd 148.14.25.255 scope global eth2
valid_lft forever preferred_lft forever

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@arunvelayutham arunvelayutham force-pushed the antrea-whereabout-cni-support branch 2 times, most recently from 7f4476e to 56982bd Compare July 28, 2022 07:25
jianjuns
jianjuns previously approved these changes Jul 28, 2022
@jianjuns jianjuns requested a review from antoninbas July 28, 2022 21:01
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small comments

Comment on lines 135 to 138
NetNS: podCNIInfo.ContainerNetNS, Path: cniPath, PluginArgs: [][2]string{
{"K8S_POD_NAME", podCNIInfo.PodName},
{"K8S_POD_NAMESPACE", podCNIInfo.PodNameSpace},
{"K8S_POD_INFRA_CONTAINER_ID", podCNIInfo.ContainerID},
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment to explain that these variables are required by the version of whereabouts we are using

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also just to confirm: whereabouts expect these args for DEL and not just for ADD?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

@@ -190,7 +194,7 @@ func (pc *PodController) handleAddUpdatePod(obj interface{}) error {
// Avoid processing Pod annotation, if we already have at least one secondary network successfully configured on this Pod.
// We do not support/handle Annotation updates yet.
if len(podCNIInfo.NetworkConfig) > 0 {
klog.InfoS("Secondary network already configured on this Pod. Annotation update not supported.", klog.KObj(pod))
klog.InfoS("Secondary network already configured on this Pod. Annotation update not supported.", "Pod", klog.KObj(pod))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
klog.InfoS("Secondary network already configured on this Pod. Annotation update not supported.", "Pod", klog.KObj(pod))
klog.InfoS("Secondary network already configured on this Pod and annotation update not supported, skipping update", "pod", klog.KObj(pod))

(We don't include a period at the end of log messages)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. took care.

@@ -295,7 +299,11 @@ func (pc *PodController) configureSecondaryInterface(pod *corev1.Pod, netinfo *S
if netinfo.InterfaceType == sriovInterfaceType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to avoid code duplication by using a helper function to craft the cni plugin args?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Moved the command building into a separate function whereaboutsCmdBuilder().

@@ -329,7 +337,7 @@ func (pc *PodController) configureSecondaryInterface(pod *corev1.Pod, netinfo *S
func (pc *PodController) configureSecondaryNetwork(pod *corev1.Pod, networklist []*SecondaryNetworkObject, podCNIInfo *cnipodcache.CNIConfigInfo) error {

for _, netinfo := range networklist {
klog.InfoS("Secondary Network Information:", netinfo)
klog.InfoS("Secondary Network Information:", "netInfo", netinfo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
klog.InfoS("Secondary Network Information:", "netInfo", netinfo)
klog.InfoS("Secondary Network Information", "info", netinfo)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified.

Comment on lines 64 to 67
const (
cmd_add = "ADD"
cmd_del = "DEL"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary (in general I don't see a point in defining constants for a short hardcoded string that's never going to change).

On a side note (but not important if you remove those), we don't use snake case for names, only camel case.

@@ -127,12 +132,24 @@ func generatePodSecondaryIfaceName(podCNIInfo *cnipodcache.CNIConfigInfo) string
return string("eth") + strconv.Itoa(rand.IntnRange(end_iface_index, max_rand_index))
}

func whereaboutsCmdBuilder(cmd string, interfaceName string, podCNIInfo *cnipodcache.CNIConfigInfo) *invoke.Args {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/whereaboutsCmdBuilder/whereaboutsArgsBuilder

@arunvelayutham arunvelayutham force-pushed the antrea-whereabout-cni-support branch from 31da3d8 to bb7da9a Compare August 1, 2022 18:04
@antoninbas
Copy link
Contributor

/test-all

2 similar comments
@arunvelayutham
Copy link
Contributor Author

/test-all

@arunvelayutham
Copy link
Contributor Author

/test-all

…th additional pluginArgs.

 - Modify base Dockerfile to pull whereabouts-v0.5.4.
 - Update whereabouts clusterrole with additional API group resources.
 - Update whereabouts cmdArgs to provide PodName and PodNameSpace information.

Signed-off-by: root <[email protected]>
@jianjuns jianjuns merged commit eff3591 into antrea-io:main Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants