@@ -76,8 +76,8 @@ func (c *E2EClient) DeleteNamespace(name string) error {
7676 return nil
7777}
7878
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 )
8181 pod , err := c .k8sClient .CoreV1 ().Pods (pod .Namespace ).Create (context .Background (), pod , metav1.CreateOptions {})
8282 if err != nil {
8383 return nil , err
@@ -144,8 +144,9 @@ func (c *E2EClient) WaitForPodBySelector(namespace, selector string, timeout tim
144144 return nil
145145 }
146146
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 {
149150 return err
150151 }
151152 }
@@ -196,9 +197,9 @@ func isPodGone(cs kubernetes.Interface, podName, namespace string) wait.Conditio
196197 }
197198}
198199
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 {
200201 return & corev1.Pod {
201- ObjectMeta : podMeta (podName , namespace , label , annotations ),
202+ ObjectMeta : podMeta (podName , namespace , label , podAnnotations ),
202203 Spec : podSpec ("samplepod" ),
203204 }
204205}
@@ -220,31 +221,31 @@ func containerCmd() []string {
220221 return []string {"/bin/ash" , "-c" , "trap : TERM INT; sleep infinity & wait" }
221222}
222223
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 {
224225 return metav1.ObjectMeta {
225226 Name : podName ,
226227 Namespace : namespace ,
227228 Labels : label ,
228- Annotations : annotations ,
229+ Annotations : podAnnotations ,
229230 }
230231}
231232
232233func dynamicNetworksAnnotation (pod * corev1.Pod , newIfaceConfigs ... * nettypes.NetworkSelectionElement ) string {
233- currentNetworkSelectionElements , err := extractPodNetworkSelectionElements (pod )
234+ networkSelectionElements , err := extractPodNetworkSelectionElements (pod )
234235 if err != nil {
235236 return ""
236237 }
237238
238- updatedNetworkSelectionElements : = append (
239- currentNetworkSelectionElements ,
239+ networkSelectionElements = append (
240+ networkSelectionElements ,
240241 newIfaceConfigs ... ,
241242 )
242- newSelectionElements , err := json .Marshal (updatedNetworkSelectionElements )
243+ updatedNetworkSelectionElements , err := json .Marshal (networkSelectionElements )
243244 if err != nil {
244245 return ""
245246 }
246247
247- return string (newSelectionElements )
248+ return string (updatedNetworkSelectionElements )
248249}
249250
250251func removeFromDynamicNetworksAnnotation (pod * corev1.Pod , networkName string , netNamespace string , ifaceName string ) string {
0 commit comments