Merge pull request #395 from vdemeester/carry-pr-382
Carry: http protocol should not use TLS
This commit is contained in:
commit
5d6492e6f5
2 changed files with 11 additions and 4 deletions
5
cmd.go
5
cmd.go
|
@ -10,12 +10,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"net/http"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/containous/traefik/middlewares"
|
"github.com/containous/traefik/middlewares"
|
||||||
"github.com/containous/traefik/provider"
|
"github.com/containous/traefik/provider"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var traefikCmd = &cobra.Command{
|
var traefikCmd = &cobra.Command{
|
||||||
|
@ -171,7 +172,7 @@ func init() {
|
||||||
traefikCmd.PersistentFlags().StringVar(&arguments.Boltdb.Prefix, "boltdb.prefix", "/traefik", "Prefix used for KV store")
|
traefikCmd.PersistentFlags().StringVar(&arguments.Boltdb.Prefix, "boltdb.prefix", "/traefik", "Prefix used for KV store")
|
||||||
|
|
||||||
traefikCmd.PersistentFlags().BoolVar(&arguments.kubernetes, "kubernetes", false, "Enable Kubernetes backend")
|
traefikCmd.PersistentFlags().BoolVar(&arguments.kubernetes, "kubernetes", false, "Enable Kubernetes backend")
|
||||||
traefikCmd.PersistentFlags().StringVar(&arguments.Kubernetes.Endpoint, "kubernetes.endpoint", "127.0.0.1:8080", "Kubernetes server endpoint")
|
traefikCmd.PersistentFlags().StringVar(&arguments.Kubernetes.Endpoint, "kubernetes.endpoint", "http://127.0.0.1:8080", "Kubernetes server endpoint")
|
||||||
traefikCmd.PersistentFlags().StringSliceVar(&arguments.Kubernetes.Namespaces, "kubernetes.namespaces", []string{}, "Kubernetes namespaces")
|
traefikCmd.PersistentFlags().StringSliceVar(&arguments.Kubernetes.Namespaces, "kubernetes.namespaces", []string{}, "Kubernetes namespaces")
|
||||||
|
|
||||||
_ = viper.BindPFlag("configFile", traefikCmd.PersistentFlags().Lookup("configFile"))
|
_ = viper.BindPFlag("configFile", traefikCmd.PersistentFlags().Lookup("configFile"))
|
||||||
|
|
|
@ -5,11 +5,12 @@ import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/containous/traefik/safe"
|
|
||||||
"github.com/parnurzeal/gorequest"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containous/traefik/safe"
|
||||||
|
"github.com/parnurzeal/gorequest"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -201,6 +202,11 @@ func (c *clientImpl) do(request *gorequest.SuperAgent) ([]byte, error) {
|
||||||
func (c *clientImpl) request(url string) *gorequest.SuperAgent {
|
func (c *clientImpl) request(url string) *gorequest.SuperAgent {
|
||||||
// Make request to Kubernetes API
|
// Make request to Kubernetes API
|
||||||
request := gorequest.New().Get(url)
|
request := gorequest.New().Get(url)
|
||||||
|
|
||||||
|
if strings.HasPrefix(url, "http://") {
|
||||||
|
return request
|
||||||
|
}
|
||||||
|
|
||||||
if len(c.token) > 0 {
|
if len(c.token) > 0 {
|
||||||
request.Header["Authorization"] = "Bearer " + c.token
|
request.Header["Authorization"] = "Bearer " + c.token
|
||||||
pool := x509.NewCertPool()
|
pool := x509.NewCertPool()
|
||||||
|
|
Loading…
Reference in a new issue