Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b2ceb3e2
Commit
b2ceb3e2
authored
Mar 30, 2016
by
Alex Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22917 from liggitt/namespace_controller_logging
Decrease verbosity of namespace controller trace logging
parents
cd0caf53
655048ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
namespace_controller_utils.go
pkg/controller/namespace/namespace_controller_utils.go
+18
-18
No files found.
pkg/controller/namespace/namespace_controller_utils.go
View file @
b2ceb3e2
...
@@ -146,11 +146,11 @@ func deleteCollection(
...
@@ -146,11 +146,11 @@ func deleteCollection(
gvr
unversioned
.
GroupVersionResource
,
gvr
unversioned
.
GroupVersionResource
,
namespace
string
,
namespace
string
,
)
(
bool
,
error
)
{
)
(
bool
,
error
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteCollection - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteCollection - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
key
:=
operationKey
{
op
:
operationDeleteCollection
,
gvr
:
gvr
}
key
:=
operationKey
{
op
:
operationDeleteCollection
,
gvr
:
gvr
}
if
!
opCache
.
isSupported
(
key
)
{
if
!
opCache
.
isSupported
(
key
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteCollection ignored since not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteCollection ignored since not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
return
false
,
nil
return
false
,
nil
}
}
...
@@ -168,12 +168,12 @@ func deleteCollection(
...
@@ -168,12 +168,12 @@ func deleteCollection(
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// remember next time that this resource does not support delete collection...
// remember next time that this resource does not support delete collection...
if
errors
.
IsMethodNotSupported
(
err
)
||
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsMethodNotSupported
(
err
)
||
errors
.
IsNotFound
(
err
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteCollection not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteCollection not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
opCache
[
key
]
=
true
opCache
[
key
]
=
true
return
false
,
nil
return
false
,
nil
}
}
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteCollection unexpected error - namespace: %s, gvr: %v, error: %v"
,
namespace
,
gvr
,
err
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteCollection unexpected error - namespace: %s, gvr: %v, error: %v"
,
namespace
,
gvr
,
err
)
return
true
,
err
return
true
,
err
}
}
...
@@ -188,11 +188,11 @@ func listCollection(
...
@@ -188,11 +188,11 @@ func listCollection(
gvr
unversioned
.
GroupVersionResource
,
gvr
unversioned
.
GroupVersionResource
,
namespace
string
,
namespace
string
,
)
(
*
runtime
.
UnstructuredList
,
bool
,
error
)
{
)
(
*
runtime
.
UnstructuredList
,
bool
,
error
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - listCollection - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - listCollection - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
key
:=
operationKey
{
op
:
operationList
,
gvr
:
gvr
}
key
:=
operationKey
{
op
:
operationList
,
gvr
:
gvr
}
if
!
opCache
.
isSupported
(
key
)
{
if
!
opCache
.
isSupported
(
key
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - listCollection ignored since not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - listCollection ignored since not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
return
nil
,
false
,
nil
return
nil
,
false
,
nil
}
}
...
@@ -209,7 +209,7 @@ func listCollection(
...
@@ -209,7 +209,7 @@ func listCollection(
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// remember next time that this resource does not support delete collection...
// remember next time that this resource does not support delete collection...
if
errors
.
IsMethodNotSupported
(
err
)
||
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsMethodNotSupported
(
err
)
||
errors
.
IsNotFound
(
err
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - listCollection not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - listCollection not supported - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
opCache
[
key
]
=
true
opCache
[
key
]
=
true
return
nil
,
false
,
nil
return
nil
,
false
,
nil
}
}
...
@@ -224,7 +224,7 @@ func deleteEachItem(
...
@@ -224,7 +224,7 @@ func deleteEachItem(
gvr
unversioned
.
GroupVersionResource
,
gvr
unversioned
.
GroupVersionResource
,
namespace
string
,
namespace
string
,
)
error
{
)
error
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteEachItem - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteEachItem - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
unstructuredList
,
listSupported
,
err
:=
listCollection
(
dynamicClient
,
opCache
,
gvr
,
namespace
)
unstructuredList
,
listSupported
,
err
:=
listCollection
(
dynamicClient
,
opCache
,
gvr
,
namespace
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -253,20 +253,20 @@ func deleteAllContentForGroupVersionResource(
...
@@ -253,20 +253,20 @@ func deleteAllContentForGroupVersionResource(
namespace
string
,
namespace
string
,
namespaceDeletedAt
unversioned
.
Time
,
namespaceDeletedAt
unversioned
.
Time
,
)
(
int64
,
error
)
{
)
(
int64
,
error
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - namespace: %s, gvr: %v"
,
namespace
,
gvr
)
// estimate how long it will take for the resource to be deleted (needed for objects that support graceful delete)
// estimate how long it will take for the resource to be deleted (needed for objects that support graceful delete)
estimate
,
err
:=
estimateGracefulTermination
(
kubeClient
,
gvr
,
namespace
,
namespaceDeletedAt
)
estimate
,
err
:=
estimateGracefulTermination
(
kubeClient
,
gvr
,
namespace
,
namespaceDeletedAt
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - unable to estimate - namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - unable to estimate - namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
return
estimate
,
err
return
estimate
,
err
}
}
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - estimate - namespace: %s, gvr: %v, estimate: %v"
,
namespace
,
gvr
,
estimate
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - estimate - namespace: %s, gvr: %v, estimate: %v"
,
namespace
,
gvr
,
estimate
)
// get a client for this group version...
// get a client for this group version...
dynamicClient
,
err
:=
clientPool
.
ClientForGroupVersion
(
gvr
.
GroupVersion
())
dynamicClient
,
err
:=
clientPool
.
ClientForGroupVersion
(
gvr
.
GroupVersion
())
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - unable to get client - namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - unable to get client - namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
return
estimate
,
err
return
estimate
,
err
}
}
...
@@ -286,16 +286,16 @@ func deleteAllContentForGroupVersionResource(
...
@@ -286,16 +286,16 @@ func deleteAllContentForGroupVersionResource(
// verify there are no more remaining items
// verify there are no more remaining items
// it is not an error condition for there to be remaining items if local estimate is non-zero
// it is not an error condition for there to be remaining items if local estimate is non-zero
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - checking for no more items in namespace: %s, gvr: %v"
,
namespace
,
gvr
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - checking for no more items in namespace: %s, gvr: %v"
,
namespace
,
gvr
)
unstructuredList
,
listSupported
,
err
:=
listCollection
(
dynamicClient
,
opCache
,
gvr
,
namespace
)
unstructuredList
,
listSupported
,
err
:=
listCollection
(
dynamicClient
,
opCache
,
gvr
,
namespace
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - error verifying no items in namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - error verifying no items in namespace: %s, gvr: %v, err: %v"
,
namespace
,
gvr
,
err
)
return
estimate
,
err
return
estimate
,
err
}
}
if
!
listSupported
{
if
!
listSupported
{
return
estimate
,
nil
return
estimate
,
nil
}
}
glog
.
V
(
4
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - items remaining - namespace: %s, gvr: %v, items: %v"
,
namespace
,
gvr
,
len
(
unstructuredList
.
Items
))
glog
.
V
(
5
)
.
Infof
(
"namespace controller - deleteAllContentForGroupVersionResource - items remaining - namespace: %s, gvr: %v, items: %v"
,
namespace
,
gvr
,
len
(
unstructuredList
.
Items
))
if
len
(
unstructuredList
.
Items
)
!=
0
&&
estimate
==
int64
(
0
)
{
if
len
(
unstructuredList
.
Items
)
!=
0
&&
estimate
==
int64
(
0
)
{
return
estimate
,
fmt
.
Errorf
(
"unexpected items still remain in namespace: %s for gvr: %v"
,
namespace
,
gvr
)
return
estimate
,
fmt
.
Errorf
(
"unexpected items still remain in namespace: %s for gvr: %v"
,
namespace
,
gvr
)
}
}
...
@@ -353,7 +353,7 @@ func syncNamespace(
...
@@ -353,7 +353,7 @@ func syncNamespace(
return
err
return
err
}
}
glog
.
V
(
4
)
.
Infof
(
"namespace controller - syncNamespace - namespace: %s, finalizerToken: %s"
,
namespace
.
Name
,
finalizerToken
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - syncNamespace - namespace: %s, finalizerToken: %s"
,
namespace
.
Name
,
finalizerToken
)
// ensure that the status is up to date on the namespace
// ensure that the status is up to date on the namespace
// if we get a not found error, we assume the namespace is truly gone
// if we get a not found error, we assume the namespace is truly gone
...
@@ -409,7 +409,7 @@ func syncNamespace(
...
@@ -409,7 +409,7 @@ func syncNamespace(
// estimateGrracefulTermination will estimate the graceful termination required for the specific entity in the namespace
// estimateGrracefulTermination will estimate the graceful termination required for the specific entity in the namespace
func
estimateGracefulTermination
(
kubeClient
clientset
.
Interface
,
groupVersionResource
unversioned
.
GroupVersionResource
,
ns
string
,
namespaceDeletedAt
unversioned
.
Time
)
(
int64
,
error
)
{
func
estimateGracefulTermination
(
kubeClient
clientset
.
Interface
,
groupVersionResource
unversioned
.
GroupVersionResource
,
ns
string
,
namespaceDeletedAt
unversioned
.
Time
)
(
int64
,
error
)
{
groupResource
:=
groupVersionResource
.
GroupResource
()
groupResource
:=
groupVersionResource
.
GroupResource
()
glog
.
V
(
4
)
.
Infof
(
"namespace controller - estimateGracefulTermination - group %s, resource: %s"
,
groupResource
.
Group
,
groupResource
.
Resource
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - estimateGracefulTermination - group %s, resource: %s"
,
groupResource
.
Group
,
groupResource
.
Resource
)
estimate
:=
int64
(
0
)
estimate
:=
int64
(
0
)
var
err
error
var
err
error
switch
groupResource
{
switch
groupResource
{
...
@@ -430,7 +430,7 @@ func estimateGracefulTermination(kubeClient clientset.Interface, groupVersionRes
...
@@ -430,7 +430,7 @@ func estimateGracefulTermination(kubeClient clientset.Interface, groupVersionRes
// estimateGracefulTerminationForPods determines the graceful termination period for pods in the namespace
// estimateGracefulTerminationForPods determines the graceful termination period for pods in the namespace
func
estimateGracefulTerminationForPods
(
kubeClient
clientset
.
Interface
,
ns
string
)
(
int64
,
error
)
{
func
estimateGracefulTerminationForPods
(
kubeClient
clientset
.
Interface
,
ns
string
)
(
int64
,
error
)
{
glog
.
V
(
4
)
.
Infof
(
"namespace controller - estimateGracefulTerminationForPods - namespace %s"
,
ns
)
glog
.
V
(
5
)
.
Infof
(
"namespace controller - estimateGracefulTerminationForPods - namespace %s"
,
ns
)
estimate
:=
int64
(
0
)
estimate
:=
int64
(
0
)
items
,
err
:=
kubeClient
.
Core
()
.
Pods
(
ns
)
.
List
(
api
.
ListOptions
{})
items
,
err
:=
kubeClient
.
Core
()
.
Pods
(
ns
)
.
List
(
api
.
ListOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment