@@ -81,7 +81,7 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error {
8181 p .logger .Debug ("Making request to CNS" )
8282 // if this fails, the caller plugin should execute again with cmdDel before returning error.
8383 // https://www.cni.dev/docs/spec/#delegated-plugin-execution-procedure
84- resp , err := p .cnsClient .RequestIPs (context .TODO (), req )
84+ resp , err := p .cnsClient .RequestIPs (context .TODO (), req ) // need to add interfaces to this response
8585 if err != nil {
8686 if cnscli .IsUnsupportedAPI (err ) {
8787 p .logger .Error ("Failed to request IPs using RequestIPs from CNS, going to try RequestIPAddress" , zap .Error (err ), zap .Any ("request" , req ))
@@ -115,12 +115,12 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error {
115115 p .logger .Debug ("Received CNS IP config response" , zap .Any ("response" , resp ))
116116
117117 // Get Pod IP and gateway IP from ip config response
118- podIPNet , err := ipconfig .ProcessIPConfigsResp (resp )
118+ podIPNet , err := ipconfig .ProcessIPConfigsResp (resp ) // need to get interfaces out of the response and add it here
119119 if err != nil {
120120 p .logger .Error ("Failed to interpret CNS IPConfigResponse" , zap .Error (err ), zap .Any ("response" , resp ))
121121 return cniTypes .NewError (ErrProcessIPConfigResponse , err .Error (), "failed to interpret CNS IPConfigResponse" )
122122 }
123- cniResult := & types100.Result {}
123+ cniResult := & types100.Result {} // need toi add interfaces to this response
124124 cniResult .IPs = make ([]* types100.IPConfig , len (* podIPNet ))
125125 for i , ipNet := range * podIPNet {
126126 p .logger .Debug ("Parsed pod IP" , zap .String ("podIPNet" , ipNet .String ()))
@@ -130,15 +130,21 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error {
130130 IP : net .ParseIP (ipNet .Addr ().String ()),
131131 Mask : net .CIDRMask (ipNet .Bits (), 32 ), // nolint
132132 }
133+ var interf int = 1
134+ ipConfig .Interface = & interf
133135 } else {
134136 ipConfig .Address = net.IPNet {
135137 IP : net .ParseIP (ipNet .Addr ().String ()),
136138 Mask : net .CIDRMask (ipNet .Bits (), 128 ), // nolint
137139 }
140+ var interf int = 1
141+ ipConfig .Interface = & interf
138142 }
139143 cniResult .IPs [i ] = ipConfig
140144 }
141145
146+ p .logger .Info ("Created CNIResult:" , zap .Any ("result" , cniResult ))
147+
142148 // Get versioned result
143149 versionedCniResult , err := cniResult .GetAsVersion (nwCfg .CNIVersion )
144150 if err != nil {
0 commit comments