Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
162c3dd9
Commit
162c3dd9
authored
Mar 11, 2019
by
Yong Tang
Committed by
Miek Gieben
Mar 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove proxy from kubernetes file (#2668)
Signed-off-by:
Yong Tang
<
yong.tang.github@outlook.com
>
parent
b67e4c47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
82 deletions
+0
-82
plugin/kubernetes/apiproxy.go
plugin/kubernetes/apiproxy.go
+0
-75
plugin/kubernetes/kubernetes.go
plugin/kubernetes/kubernetes.go
+0
-1
plugin/kubernetes/setup.go
plugin/kubernetes/setup.go
+0
-6
No files found.
plugin/kubernetes/apiproxy.go
deleted
100644 → 0
View file @
b67e4c47
package
kubernetes
import
(
"fmt"
"io"
"net"
"net/http"
"github.com/coredns/coredns/plugin/pkg/healthcheck"
)
type
proxyHandler
struct
{
healthcheck
.
HealthCheck
}
type
apiProxy
struct
{
http
.
Server
listener
net
.
Listener
handler
proxyHandler
}
func
(
p
*
proxyHandler
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
upstream
:=
p
.
Select
()
network
:=
"tcp"
address
:=
upstream
.
Name
d
,
err
:=
net
.
Dial
(
network
,
address
)
if
err
!=
nil
{
log
.
Errorf
(
"Unable to establish connection to upstream %s://%s: %s"
,
network
,
address
,
err
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Unable to establish connection to upstream %s://%s: %s"
,
network
,
address
,
err
),
500
)
return
}
hj
,
ok
:=
w
.
(
http
.
Hijacker
)
if
!
ok
{
log
.
Error
(
"Unable to establish connection: no hijacker"
)
http
.
Error
(
w
,
"Unable to establish connection: no hijacker"
,
500
)
return
}
nc
,
_
,
err
:=
hj
.
Hijack
()
if
err
!=
nil
{
log
.
Errorf
(
"Unable to hijack connection: %s"
,
err
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Unable to hijack connection: %s"
,
err
),
500
)
return
}
defer
nc
.
Close
()
defer
d
.
Close
()
err
=
r
.
Write
(
d
)
if
err
!=
nil
{
log
.
Errorf
(
"Unable to copy connection to upstream %s://%s: %s"
,
network
,
address
,
err
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Unable to copy connection to upstream %s://%s: %s"
,
network
,
address
,
err
),
500
)
return
}
errChan
:=
make
(
chan
error
,
2
)
cp
:=
func
(
dst
io
.
Writer
,
src
io
.
Reader
)
{
_
,
err
:=
io
.
Copy
(
dst
,
src
)
errChan
<-
err
}
go
cp
(
d
,
nc
)
go
cp
(
nc
,
d
)
<-
errChan
}
func
(
p
*
apiProxy
)
Run
()
{
p
.
handler
.
Start
()
go
func
()
{
p
.
Serve
(
p
.
listener
)
}()
}
func
(
p
*
apiProxy
)
Stop
()
{
p
.
handler
.
Stop
()
p
.
listener
.
Close
()
}
plugin/kubernetes/kubernetes.go
View file @
162c3dd9
...
...
@@ -31,7 +31,6 @@ type Kubernetes struct {
Zones
[]
string
Upstream
*
upstream
.
Upstream
APIServerList
[]
string
APIProxy
*
apiProxy
APICertAuth
string
APIClientCert
string
APIClientKey
string
...
...
plugin/kubernetes/setup.go
View file @
162c3dd9
...
...
@@ -80,9 +80,6 @@ func setup(c *caddy.Controller) error {
func
(
k
*
Kubernetes
)
RegisterKubeCache
(
c
*
caddy
.
Controller
)
{
c
.
OnStartup
(
func
()
error
{
go
k
.
APIConn
.
Run
()
if
k
.
APIProxy
!=
nil
{
k
.
APIProxy
.
Run
()
}
timeout
:=
time
.
After
(
5
*
time
.
Second
)
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
...
...
@@ -99,9 +96,6 @@ func (k *Kubernetes) RegisterKubeCache(c *caddy.Controller) {
})
c
.
OnShutdown
(
func
()
error
{
if
k
.
APIProxy
!=
nil
{
k
.
APIProxy
.
Stop
()
}
return
k
.
APIConn
.
Stop
()
})
}
...
...
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