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
451261f8
Commit
451261f8
authored
Jan 29, 2019
by
Patrick Barker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
returns 500 on error; updates header dates for audit proxy
parent
ef508297
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
Dockerfile
test/images/audit-proxy/Dockerfile
+1
-1
Makefile
test/images/audit-proxy/Makefile
+1
-1
main.go
test/images/audit-proxy/main.go
+9
-4
No files found.
test/images/audit-proxy/Dockerfile
View file @
451261f8
# Copyright 201
8
The Kubernetes Authors.
# Copyright 201
9
The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
test/images/audit-proxy/Makefile
View file @
451261f8
# Copyright 201
8
The Kubernetes Authors.
# Copyright 201
9
The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
test/images/audit-proxy/main.go
View file @
451261f8
...
...
@@ -48,12 +48,16 @@ func main() {
func
handler
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
body
,
err
:=
ioutil
.
ReadAll
(
req
.
Body
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not read request body: %v"
,
err
)
log
.
Printf
(
"could not read request body: %v"
,
err
)
w
.
WriteHeader
(
http
.
StatusInternalServerError
)
return
}
el
:=
&
auditv1
.
EventList
{}
if
err
:=
runtime
.
DecodeInto
(
decoder
,
body
,
el
);
err
!=
nil
{
log
.
Fatalf
(
"failed decoding buf: %b, apiVersion: %s"
,
body
,
auditv1
.
SchemeGroupVersion
)
log
.
Printf
(
"failed decoding buf: %b, apiVersion: %s"
,
body
,
auditv1
.
SchemeGroupVersion
)
w
.
WriteHeader
(
http
.
StatusInternalServerError
)
return
}
defer
req
.
Body
.
Close
()
...
...
@@ -61,9 +65,10 @@ func handler(w http.ResponseWriter, req *http.Request) {
for
_
,
event
:=
range
el
.
Items
{
err
:=
encoder
.
Encode
(
&
event
,
os
.
Stdout
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not encode audit event: %v"
,
err
)
log
.
Printf
(
"could not encode audit event: %v"
,
err
)
w
.
WriteHeader
(
http
.
StatusInternalServerError
)
return
}
}
w
.
WriteHeader
(
http
.
StatusOK
)
return
}
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