Use authbind to bind privileged ports

This commit is contained in:
Manuel de Brito Fontes 2018-08-03 09:50:53 -04:00 committed by Manuel Alejandro de Brito Fontes
parent e2f5d9066e
commit b148f113ae
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
14 changed files with 48 additions and 69 deletions

View file

@ -77,7 +77,7 @@ func NewController(pod, namespace, class string) *Controller {
prometheus.GaugeOpts{
Namespace: PrometheusNamespace,
Name: "config_last_reload_successful",
Help: "Whether the last configuration reload attemp was successful",
Help: "Whether the last configuration reload attempt was successful",
ConstLabels: constLabels,
}),
configSuccessTime: prometheus.NewGauge(

View file

@ -26,7 +26,7 @@ import (
func TestControllerCounters(t *testing.T) {
const metadata = `
# HELP nginx_ingress_controller_config_last_reload_successful Whether the last configuration reload attemp was successful
# HELP nginx_ingress_controller_config_last_reload_successful Whether the last configuration reload attempt was successful
# TYPE nginx_ingress_controller_config_last_reload_successful gauge
# HELP nginx_ingress_controller_success Cumulative number of Ingress controller reload operations
# TYPE nginx_ingress_controller_success counter

View file

@ -21,6 +21,7 @@ import (
"fmt"
"io"
"net"
"os"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
@ -95,7 +96,13 @@ var (
// NewSocketCollector creates a new SocketCollector instance using
// the ingresss watch namespace and class used by the controller
func NewSocketCollector(pod, namespace, class string) (*SocketCollector, error) {
listener, err := net.Listen("unix", "/tmp/prometheus-nginx.socket")
socket := "/tmp/prometheus-nginx.socket"
listener, err := net.Listen("unix", socket)
if err != nil {
return nil, err
}
err = os.Chmod(socket, 0777)
if err != nil {
return nil, err
}