@@ -3,16 +3,17 @@ package networkpolicy
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
- log "github.com/Sirupsen/logrus"
7
- "github.com/contiv/client-go/kubernetes"
8
- "github.com/contiv/client-go/pkg/api/v1"
9
- "github.com/contiv/client-go/pkg/apis/extensions/v1beta1"
10
- "github.com/contiv/client-go/pkg/watch"
11
- "github.com/contiv/netplugin/contivmodel/client"
12
- "github.com/contiv/netplugin/utils/k8sutils"
13
6
"reflect"
14
7
"strings"
15
8
"time"
9
+
10
+ log "github.com/Sirupsen/logrus"
11
+ "github.com/contiv/netplugin/contivmodel/client"
12
+ "github.com/contiv/netplugin/utils/k8sutils"
13
+ "k8s.io/api/networking/v1"
14
+ meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15
+ "k8s.io/apimachinery/pkg/watch"
16
+ "k8s.io/client-go/kubernetes"
16
17
)
17
18
18
19
const defaultTenantName = "default"
@@ -311,7 +312,7 @@ func (k8sNet *k8sContext) deleteDefaultIngressPolicy(ns string) {
311
312
}
312
313
}
313
314
314
- func (k8sNet * k8sContext ) processK8sNetworkPolicy (opCode watch.EventType , np * v1beta1 .NetworkPolicy ) {
315
+ func (k8sNet * k8sContext ) processK8sNetworkPolicy (opCode watch.EventType , np * v1 .NetworkPolicy ) {
315
316
if np .Namespace == "kube-system" { // not applicable for system namespace
316
317
return
317
318
}
@@ -330,7 +331,7 @@ func (k8sNet *k8sContext) processK8sEvent(opCode watch.EventType, eventObj inter
330
331
}
331
332
switch objType := eventObj .(type ) {
332
333
333
- case * v1beta1 .NetworkPolicy :
334
+ case * v1 .NetworkPolicy :
334
335
k8sNet .processK8sNetworkPolicy (opCode , objType )
335
336
}
336
337
}
@@ -343,7 +344,7 @@ func (k8sNet *k8sContext) watchK8sEvents(errChan chan error) {
343
344
time .Sleep (time .Millisecond * 100 )
344
345
}
345
346
346
- npWatch , err := k8sNet .k8sClientSet .ExtensionsV1beta1 ().NetworkPolicies ("" ).Watch (v1 .ListOptions {})
347
+ npWatch , err := k8sNet .k8sClientSet .Networking ().NetworkPolicies ("" ).Watch (meta_v1 .ListOptions {})
347
348
if err != nil {
348
349
errChan <- fmt .Errorf ("failed to watch network policy, %s" , err )
349
350
return
0 commit comments