@@ -10,7 +10,6 @@ import (
1010 "time"
1111
1212 "github.com/Azure/azure-container-networking/aitelemetry"
13- "github.com/Azure/azure-container-networking/log"
1413
1514 "github.com/Azure/azure-container-networking/npm/ipsm"
1615 "github.com/Azure/azure-container-networking/npm/iptm"
@@ -25,6 +24,7 @@ import (
2524 networkinginformers "k8s.io/client-go/informers/networking/v1"
2625 "k8s.io/client-go/kubernetes"
2726 "k8s.io/client-go/tools/cache"
27+ "k8s.io/klog"
2828 utilexec "k8s.io/utils/exec"
2929)
3030
@@ -71,17 +71,17 @@ type NetworkPolicyManager struct {
7171func (npMgr * NetworkPolicyManager ) GetClusterState () telemetry.ClusterState {
7272 pods , err := npMgr .clientset .CoreV1 ().Pods ("" ).List (context .TODO (), metav1.ListOptions {})
7373 if err != nil {
74- log . Logf ("Error: Failed to list pods in GetClusterState" )
74+ klog . Info ("Error: Failed to list pods in GetClusterState" )
7575 }
7676
7777 namespaces , err := npMgr .clientset .CoreV1 ().Namespaces ().List (context .TODO (), metav1.ListOptions {})
7878 if err != nil {
79- log . Logf ("Error: Failed to list namespaces in GetClusterState" )
79+ klog . Info ("Error: Failed to list namespaces in GetClusterState" )
8080 }
8181
8282 networkpolicies , err := npMgr .clientset .NetworkingV1 ().NetworkPolicies ("" ).List (context .TODO (), metav1.ListOptions {})
8383 if err != nil {
84- log . Logf ("Error: Failed to list networkpolicies in GetClusterState" )
84+ klog . Info ("Error: Failed to list networkpolicies in GetClusterState" )
8585 }
8686
8787 npMgr .clusterState .PodCount = len (pods .Items )
@@ -170,11 +170,11 @@ func (npMgr *NetworkPolicyManager) Start(stopCh <-chan struct{}) error {
170170// NewNetworkPolicyManager creates a NetworkPolicyManager
171171func NewNetworkPolicyManager (clientset * kubernetes.Clientset , informerFactory informers.SharedInformerFactory , exec utilexec.Interface , npmVersion string ) * NetworkPolicyManager {
172172 // Clear out left over iptables states
173- log . Logf ("Azure-NPM creating, cleaning iptables" )
173+ klog . Info ("Azure-NPM creating, cleaning iptables" )
174174 iptMgr := iptm .NewIptablesManager (exec , iptm .NewIptOperationShim ())
175175 iptMgr .UninitNpmChains ()
176176
177- log . Logf ("Azure-NPM creating, cleaning existing Azure NPM IPSets" )
177+ klog . Info ("Azure-NPM creating, cleaning existing Azure NPM IPSets" )
178178 ipsm .NewIpsetManager (exec ).DestroyNpmIpsets ()
179179
180180 var (
@@ -196,7 +196,9 @@ func NewNetworkPolicyManager(clientset *kubernetes.Clientset, informerFactory in
196196 metrics .SendErrorLogAndMetric (util .NpmID , "Error: failed to retrieving kubernetes version" )
197197 panic (err .Error )
198198 }
199- log .Logf ("API server version: %+v" , serverVersion )
199+
200+ // This K8s api server version information is used to support backward-compatibility in translatePolicy.go
201+ klog .Infof ("Run NPM (%s) on K8s version %+v" , npmVersion , serverVersion )
200202
201203 if err = util .SetIsNewNwPolicyVerFlag (serverVersion ); err != nil {
202204 metrics .SendErrorLogAndMetric (util .NpmID , "Error: failed to set IsNewNwPolicyVerFlag" )
0 commit comments