Skip to content

Commit

Permalink
Added ExternalName https support for Kubernetes CRD, as done in v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kpeiruza authored and traefiker committed Dec 16, 2019
1 parent 7dcee38 commit b501c6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/provider/kubernetes/crd/kubernetes_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,13 @@ func (c configBuilder) loadServers(fallbackNamespace string, svc v1alpha1.LoadBa

var servers []dynamic.Server
if service.Spec.Type == corev1.ServiceTypeExternalName {
protocol := "http"
if portSpec.Port == 443 || strings.HasPrefix(portSpec.Name, "https") {
protocol = "https"
}

return append(servers, dynamic.Server{
URL: fmt.Sprintf("http://%s:%d", service.Spec.ExternalName, portSpec.Port),
URL: fmt.Sprintf("%s://%s:%d", protocol, service.Spec.ExternalName, portSpec.Port),
}), nil
}

Expand Down

0 comments on commit b501c6d

Please sign in to comment.