Skip to content

Commit c31ce59

Browse files
committed
Add ib macs to spec
1 parent cea22ec commit c31ce59

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cns/restserver/ibdevices.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func (service *HTTPRestService) createMTPNC(ctx context.Context, pod *v1.Pod, ib
144144
},
145145
Spec: v1alpha1.MultitenantPodNetworkConfigSpec{
146146
PodNetworkInstance: pod.Labels[PNILabel],
147+
IBMACAddresses: convertMACsToStrings(ibMACs),
147148
},
148149
}
149150

@@ -175,6 +176,14 @@ func (service *HTTPRestService) createMTPNC(ctx context.Context, pod *v1.Pod, ib
175176
return nil
176177
}
177178

179+
func convertMACsToStrings(macAddrs []net.HardwareAddr) []string {
180+
macStrs := make([]string, 0, len(macAddrs))
181+
for _, hwAddr := range macAddrs {
182+
macStrs = append(macStrs, hwAddr.String())
183+
}
184+
return macStrs
185+
}
186+
178187
// determineMTPNCUpdate compares the ownership references and specs of the two MTPNC objects and returns a MTPNC for patching to the
179188
// desired state and true. If no update is required, this will return nil and false
180189
func determineMTPNCUpdate(existing, desired *v1alpha1.MultitenantPodNetworkConfig) (*v1alpha1.MultitenantPodNetworkConfig, bool) {

0 commit comments

Comments
 (0)