Move TCPProxy to pkg
This commit is contained in:
parent
7304086202
commit
32d06d4b3b
2 changed files with 8 additions and 7 deletions
|
@ -44,6 +44,7 @@ import (
|
||||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
"k8s.io/client-go/util/flowcontrol"
|
"k8s.io/client-go/util/flowcontrol"
|
||||||
|
"k8s.io/ingress-nginx/pkg/tcpproxy"
|
||||||
|
|
||||||
adm_controller "k8s.io/ingress-nginx/internal/admission/controller"
|
adm_controller "k8s.io/ingress-nginx/internal/admission/controller"
|
||||||
"k8s.io/ingress-nginx/internal/ingress"
|
"k8s.io/ingress-nginx/internal/ingress"
|
||||||
|
@ -101,7 +102,7 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
|
||||||
|
|
||||||
runningConfig: new(ingress.Configuration),
|
runningConfig: new(ingress.Configuration),
|
||||||
|
|
||||||
Proxy: &TCPProxy{},
|
Proxy: &tcpproxy.TCPProxy{},
|
||||||
|
|
||||||
metricCollector: mc,
|
metricCollector: mc,
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ type NGINXController struct {
|
||||||
|
|
||||||
isShuttingDown bool
|
isShuttingDown bool
|
||||||
|
|
||||||
Proxy *TCPProxy
|
Proxy *tcpproxy.TCPProxy
|
||||||
|
|
||||||
store store.Storer
|
store store.Storer
|
||||||
|
|
||||||
|
@ -439,7 +440,7 @@ func (n NGINXController) DefaultEndpoint() ingress.Endpoint {
|
||||||
func (n NGINXController) generateTemplate(cfg ngx_config.Configuration, ingressCfg ingress.Configuration) ([]byte, error) {
|
func (n NGINXController) generateTemplate(cfg ngx_config.Configuration, ingressCfg ingress.Configuration) ([]byte, error) {
|
||||||
|
|
||||||
if n.cfg.EnableSSLPassthrough {
|
if n.cfg.EnableSSLPassthrough {
|
||||||
servers := []*TCPServer{}
|
servers := []*tcpproxy.TCPServer{}
|
||||||
for _, pb := range ingressCfg.PassthroughBackends {
|
for _, pb := range ingressCfg.PassthroughBackends {
|
||||||
svc := pb.Service
|
svc := pb.Service
|
||||||
if svc == nil {
|
if svc == nil {
|
||||||
|
@ -464,7 +465,7 @@ func (n NGINXController) generateTemplate(cfg ngx_config.Configuration, ingressC
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Allow PassthroughBackends to specify they support proxy-protocol
|
// TODO: Allow PassthroughBackends to specify they support proxy-protocol
|
||||||
servers = append(servers, &TCPServer{
|
servers = append(servers, &tcpproxy.TCPServer{
|
||||||
Hostname: pb.Hostname,
|
Hostname: pb.Hostname,
|
||||||
IP: svc.Spec.ClusterIP,
|
IP: svc.Spec.ClusterIP,
|
||||||
Port: port,
|
Port: port,
|
||||||
|
@ -751,8 +752,8 @@ func (n *NGINXController) setupSSLProxy() {
|
||||||
proxyPort := n.cfg.ListenPorts.SSLProxy
|
proxyPort := n.cfg.ListenPorts.SSLProxy
|
||||||
|
|
||||||
klog.InfoS("Starting TLS proxy for SSL Passthrough")
|
klog.InfoS("Starting TLS proxy for SSL Passthrough")
|
||||||
n.Proxy = &TCPProxy{
|
n.Proxy = &tcpproxy.TCPProxy{
|
||||||
Default: &TCPServer{
|
Default: &tcpproxy.TCPServer{
|
||||||
Hostname: "localhost",
|
Hostname: "localhost",
|
||||||
IP: "127.0.0.1",
|
IP: "127.0.0.1",
|
||||||
Port: proxyPort,
|
Port: proxyPort,
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package controller
|
package tcpproxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
Loading…
Reference in a new issue