Skip to content

Commit c0a22ef

Browse files
committed
update imports and code to use newer upstream client-go package
Signed-off-by: Bill Robinson <[email protected]>
1 parent a891233 commit c0a22ef

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

netmaster/k8snetwork/networkpolicy.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ package networkpolicy
33
import (
44
"encoding/json"
55
"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"
136
"reflect"
147
"strings"
158
"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"
1617
)
1718

1819
const defaultTenantName = "default"
@@ -311,7 +312,7 @@ func (k8sNet *k8sContext) deleteDefaultIngressPolicy(ns string) {
311312
}
312313
}
313314

314-
func (k8sNet *k8sContext) processK8sNetworkPolicy(opCode watch.EventType, np *v1beta1.NetworkPolicy) {
315+
func (k8sNet *k8sContext) processK8sNetworkPolicy(opCode watch.EventType, np *v1.NetworkPolicy) {
315316
if np.Namespace == "kube-system" { // not applicable for system namespace
316317
return
317318
}
@@ -330,7 +331,7 @@ func (k8sNet *k8sContext) processK8sEvent(opCode watch.EventType, eventObj inter
330331
}
331332
switch objType := eventObj.(type) {
332333

333-
case *v1beta1.NetworkPolicy:
334+
case *v1.NetworkPolicy:
334335
k8sNet.processK8sNetworkPolicy(opCode, objType)
335336
}
336337
}
@@ -343,7 +344,7 @@ func (k8sNet *k8sContext) watchK8sEvents(errChan chan error) {
343344
time.Sleep(time.Millisecond * 100)
344345
}
345346

346-
npWatch, err := k8sNet.k8sClientSet.ExtensionsV1beta1().NetworkPolicies("").Watch(v1.ListOptions{})
347+
npWatch, err := k8sNet.k8sClientSet.Networking().NetworkPolicies("").Watch(meta_v1.ListOptions{})
347348
if err != nil {
348349
errChan <- fmt.Errorf("failed to watch network policy, %s", err)
349350
return

utils/k8sutils/k8sutils.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package k8sutils
33
import (
44
"encoding/json"
55
"fmt"
6-
log "github.com/Sirupsen/logrus"
7-
"github.com/contiv/client-go/kubernetes"
8-
k8sRest "github.com/contiv/client-go/rest"
96
"io/ioutil"
107
"strings"
8+
9+
log "github.com/Sirupsen/logrus"
10+
"k8s.io/client-go/kubernetes"
11+
k8sRest "k8s.io/client-go/rest"
1112
)
1213

1314
// ContivConfig holds information passed via config file during cluster set up

0 commit comments

Comments
 (0)