77 "github.com/Azure/azure-container-networking/crd/multitenancy/api/v1alpha1"
88 "github.com/pkg/errors"
99 v1 "k8s.io/api/core/v1"
10+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011 "sigs.k8s.io/controller-runtime/pkg/client"
1112)
1213
@@ -66,31 +67,35 @@ func NewClient() *Client {
6667 testPod10 .Labels = make (map [string ]string )
6768 testPod10 .Labels [configuration .LabelPodNetworkInstanceSwiftV2 ] = podNetwork
6869
70+ testPodMtpncTerminating := v1.Pod {}
71+ testPodMtpncTerminating .Labels = make (map [string ]string )
72+ testPodMtpncTerminating .Labels [configuration .LabelPodSwiftV2 ] = podNetwork
73+
6974 testInterfaceInfos1 := v1alpha1.InterfaceInfo {
70- NCID : "testncid" ,
71- PrimaryIP : "192.168.0.1/32" ,
72- MacAddress : "00:00:00:00:00:00" ,
73- GatewayIP : "10.0.0.1" ,
74- DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
75- AccelnetEnabled : false ,
75+ NCID : "testncid" ,
76+ PrimaryIP : "192.168.0.1/32" ,
77+ MacAddress : "00:00:00:00:00:00" ,
78+ GatewayIP : "10.0.0.1" ,
79+ DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
80+ AccelnetEnabled : false ,
7681 SubnetAddressSpace : "192.168.0.0/24" ,
7782 }
7883 testInterfaceInfos3 := v1alpha1.InterfaceInfo {
79- NCID : "testncid" ,
80- PrimaryIP : "192.168.0.1/32" ,
81- MacAddress : "00:00:00:00:00:00" ,
82- GatewayIP : "10.0.0.1" ,
83- DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
84- AccelnetEnabled : false ,
84+ NCID : "testncid" ,
85+ PrimaryIP : "192.168.0.1/32" ,
86+ MacAddress : "00:00:00:00:00:00" ,
87+ GatewayIP : "10.0.0.1" ,
88+ DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
89+ AccelnetEnabled : false ,
8590 SubnetAddressSpace : "192.168.0.0/24" ,
8691 }
8792 testInterfaceInfos5 := v1alpha1.InterfaceInfo {
88- NCID : "testncid" ,
89- PrimaryIP : "192.168.0.1/32" ,
90- MacAddress : "00:00:00:00:00:00" ,
91- GatewayIP : "10.0.0.1" ,
92- DeviceType : v1alpha1 .DeviceTypeInfiniBandNIC ,
93- AccelnetEnabled : true ,
93+ NCID : "testncid" ,
94+ PrimaryIP : "192.168.0.1/32" ,
95+ MacAddress : "00:00:00:00:00:00" ,
96+ GatewayIP : "10.0.0.1" ,
97+ DeviceType : v1alpha1 .DeviceTypeInfiniBandNIC ,
98+ AccelnetEnabled : true ,
9499 SubnetAddressSpace : "192.168.0.0/24" ,
95100 }
96101
@@ -166,28 +171,38 @@ func NewClient() *Client {
166171 Status : v1alpha1.MultitenantPodNetworkConfigStatus {},
167172 }
168173
174+ testMTPNCTerminating := v1alpha1.MultitenantPodNetworkConfig {
175+ Status : v1alpha1.MultitenantPodNetworkConfigStatus {
176+ InterfaceInfos : []v1alpha1.InterfaceInfo {testInterfaceInfos1 },
177+ },
178+ }
179+ now := metav1 .Now ()
180+ testMTPNCTerminating .DeletionTimestamp = & now
181+
169182 return & Client {
170183 mtPodCache : map [string ]* v1.Pod {
171- "testpod1namespace/testpod1" : & testPod1 ,
172- "testpod3namespace/testpod3" : & testPod3 ,
173- "testpod4namespace/testpod4" : & testPod4 ,
174- "testpod5namespace/testpod5" : & testPod5 ,
175- "testpod6namespace/testpod6" : & testPod6 ,
176- "testpod7namespace/testpod7" : & testPod7 ,
177- "testpod8namespace/testpod8" : & testPod8 ,
178- "testpod9namespace/testpod9" : & testPod9 ,
179- "testpod10namespace/testpod10" : & testPod10 ,
184+ "testpod1namespace/testpod1" : & testPod1 ,
185+ "testpod3namespace/testpod3" : & testPod3 ,
186+ "testpod4namespace/testpod4" : & testPod4 ,
187+ "testpod5namespace/testpod5" : & testPod5 ,
188+ "testpod6namespace/testpod6" : & testPod6 ,
189+ "testpod7namespace/testpod7" : & testPod7 ,
190+ "testpod8namespace/testpod8" : & testPod8 ,
191+ "testpod9namespace/testpod9" : & testPod9 ,
192+ "testpod10namespace/testpod10" : & testPod10 ,
193+ "testpodMtpncTerminatingnamespace/testpodMtpncTerminating" : & testPodMtpncTerminating ,
180194 },
181195 mtpncCache : map [string ]* v1alpha1.MultitenantPodNetworkConfig {
182- "testpod1namespace/testpod1" : & testMTPNC1 ,
183- "testpod2namespace/testpod2" : & testMTPNC2 ,
184- "testpod4namespace/testpod4" : & testMTPNC4 ,
185- "testpod5namespace/testpod5" : & testMTPNC3 ,
186- "testpod6namespace/testpod6" : & testMTPNC5 ,
187- "testpod7namespace/testpod7" : & testMTPNCMulti ,
188- "testpod8namespace/testpod8" : & testMTPNC8 ,
189- "testpod9namespace/testpod9" : & testMTPNC9 ,
190- "testpod10namespace/testpod10" : & testMTPNC10 ,
196+ "testpod1namespace/testpod1" : & testMTPNC1 ,
197+ "testpod2namespace/testpod2" : & testMTPNC2 ,
198+ "testpod4namespace/testpod4" : & testMTPNC4 ,
199+ "testpod5namespace/testpod5" : & testMTPNC3 ,
200+ "testpod6namespace/testpod6" : & testMTPNC5 ,
201+ "testpod7namespace/testpod7" : & testMTPNCMulti ,
202+ "testpod8namespace/testpod8" : & testMTPNC8 ,
203+ "testpod9namespace/testpod9" : & testMTPNC9 ,
204+ "testpod10namespace/testpod10" : & testMTPNC10 ,
205+ "testpodMtpncTerminatingnamespace/testpodMtpncTerminating" : & testMTPNCTerminating ,
191206 },
192207 }
193208}
@@ -213,12 +228,12 @@ func (c *Client) Get(_ context.Context, key client.ObjectKey, obj client.Object,
213228
214229func (c * Client ) SetMTPNCReady () {
215230 testInterfaceInfos1 := v1alpha1.InterfaceInfo {
216- NCID : "testncid" ,
217- PrimaryIP : "192.168.0.1/32" ,
218- MacAddress : "00:00:00:00:00:00" ,
219- GatewayIP : "10.0.0.1" ,
220- DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
221- AccelnetEnabled : false ,
231+ NCID : "testncid" ,
232+ PrimaryIP : "192.168.0.1/32" ,
233+ MacAddress : "00:00:00:00:00:00" ,
234+ GatewayIP : "10.0.0.1" ,
235+ DeviceType : v1alpha1 .DeviceTypeVnetNIC ,
236+ AccelnetEnabled : false ,
222237 SubnetAddressSpace : "192.168.0.0/24" ,
223238 }
224239
0 commit comments