Error out when multiple https endpoints are specified. (#2438)

This fix will error out when multiple https endpoints are specified,
as additional work is needed to support beyond http.

This fix fixes 1464.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2019-01-07 09:28:03 -08:00 committed by GitHub
parent 06efc07f46
commit 53d1afbaf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

View file

@ -196,6 +196,15 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
args := c.RemainingArgs()
if len(args) > 0 {
k8s.APIServerList = args
if len(args) > 1 {
// If multiple endoints specified, then only http allowed
for i := range args {
parts := strings.SplitN(args[i], "://", 2)
if len(parts) == 2 && parts[0] != "http" {
return nil, fmt.Errorf("multiple endpoints can only accept http, found: %v", args[i])
}
}
}
continue
}
return nil, c.ArgErr()