@@ -76,8 +76,8 @@ func (c *E2EClient) DeleteNamespace(name string) error {
76
76
return nil
77
77
}
78
78
79
- func (c * E2EClient ) ProvisionPod (podName string , namespace string , label , annotations map [string ]string ) (* corev1.Pod , error ) {
80
- pod := PodObject (podName , namespace , label , annotations )
79
+ func (c * E2EClient ) ProvisionPod (podName string , namespace string , label , podAnnotations map [string ]string ) (* corev1.Pod , error ) {
80
+ pod := PodObject (podName , namespace , label , podAnnotations )
81
81
pod , err := c .k8sClient .CoreV1 ().Pods (pod .Namespace ).Create (context .Background (), pod , metav1.CreateOptions {})
82
82
if err != nil {
83
83
return nil , err
@@ -144,8 +144,9 @@ func (c *E2EClient) WaitForPodBySelector(namespace, selector string, timeout tim
144
144
return nil
145
145
}
146
146
147
- for _ , pod := range podList .Items {
148
- if err := c .WaitForPodReady (namespace , pod .Name , timeout ); err != nil {
147
+ pods := podList .Items
148
+ for i := range pods {
149
+ if err := c .WaitForPodReady (namespace , pods [i ].Name , timeout ); err != nil {
149
150
return err
150
151
}
151
152
}
@@ -196,9 +197,9 @@ func isPodGone(cs kubernetes.Interface, podName, namespace string) wait.Conditio
196
197
}
197
198
}
198
199
199
- func PodObject (podName string , namespace string , label , annotations map [string ]string ) * corev1.Pod {
200
+ func PodObject (podName string , namespace string , label , podAnnotations map [string ]string ) * corev1.Pod {
200
201
return & corev1.Pod {
201
- ObjectMeta : podMeta (podName , namespace , label , annotations ),
202
+ ObjectMeta : podMeta (podName , namespace , label , podAnnotations ),
202
203
Spec : podSpec ("samplepod" ),
203
204
}
204
205
}
@@ -220,31 +221,31 @@ func containerCmd() []string {
220
221
return []string {"/bin/ash" , "-c" , "trap : TERM INT; sleep infinity & wait" }
221
222
}
222
223
223
- func podMeta (podName string , namespace string , label map [string ]string , annotations map [string ]string ) metav1.ObjectMeta {
224
+ func podMeta (podName string , namespace string , label map [string ]string , podAnnotations map [string ]string ) metav1.ObjectMeta {
224
225
return metav1.ObjectMeta {
225
226
Name : podName ,
226
227
Namespace : namespace ,
227
228
Labels : label ,
228
- Annotations : annotations ,
229
+ Annotations : podAnnotations ,
229
230
}
230
231
}
231
232
232
233
func dynamicNetworksAnnotation (pod * corev1.Pod , newIfaceConfigs ... * nettypes.NetworkSelectionElement ) string {
233
- currentNetworkSelectionElements , err := extractPodNetworkSelectionElements (pod )
234
+ networkSelectionElements , err := extractPodNetworkSelectionElements (pod )
234
235
if err != nil {
235
236
return ""
236
237
}
237
238
238
- updatedNetworkSelectionElements : = append (
239
- currentNetworkSelectionElements ,
239
+ networkSelectionElements = append (
240
+ networkSelectionElements ,
240
241
newIfaceConfigs ... ,
241
242
)
242
- newSelectionElements , err := json .Marshal (updatedNetworkSelectionElements )
243
+ updatedNetworkSelectionElements , err := json .Marshal (networkSelectionElements )
243
244
if err != nil {
244
245
return ""
245
246
}
246
247
247
- return string (newSelectionElements )
248
+ return string (updatedNetworkSelectionElements )
248
249
}
249
250
250
251
func removeFromDynamicNetworksAnnotation (pod * corev1.Pod , networkName string , netNamespace string , ifaceName string ) string {
0 commit comments