Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
0fb1b540
Commit
0fb1b540
authored
May 15, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mask the secret parts of Secrets at log levels >= Debug.
parent
66c69663
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
controller.go
pkg/controller/controller.go
+19
-2
No files found.
pkg/controller/controller.go
View file @
0fb1b540
...
...
@@ -213,8 +213,25 @@ func NewIngressController(
return
&
ingc
,
nil
}
var
maskedSecret
=
[]
byte
{}
func
mask
(
obj
interface
{})
interface
{}
{
secret
,
ok
:=
obj
.
(
*
api_v1
.
Secret
)
if
!
ok
{
return
obj
}
cpy
:=
secret
.
DeepCopy
()
for
k
:=
range
cpy
.
Data
{
cpy
.
Data
[
k
]
=
maskedSecret
}
for
k
:=
range
cpy
.
StringData
{
cpy
.
StringData
[
k
]
=
string
(
maskedSecret
)
}
return
cpy
}
func
(
ingc
*
IngressController
)
logObj
(
action
string
,
obj
interface
{})
{
ingc
.
log
.
Debug
(
action
,
":"
,
obj
)
ingc
.
log
.
Debug
(
action
,
":"
,
mask
(
obj
)
)
m
,
mErr
:=
meta
.
Accessor
(
obj
)
t
,
tErr
:=
meta
.
TypeAccessor
(
obj
)
if
mErr
==
nil
&&
tErr
==
nil
{
...
...
@@ -260,7 +277,7 @@ func (ingc *IngressController) deleteObj(obj interface{}) {
}
func
(
ingc
*
IngressController
)
updateObj
(
old
,
new
interface
{})
{
ingc
.
log
.
Debug
(
"Update:"
,
old
,
new
)
ingc
.
log
.
Debug
(
"Update:"
,
mask
(
old
),
mask
(
new
)
)
incWatchCounter
(
new
,
"Update"
)
oldMeta
,
oldErr
:=
meta
.
Accessor
(
old
)
newMeta
,
newErr
:=
meta
.
Accessor
(
new
)
...
...
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