mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
Add comment, rename getListener to buildListener
This commit is contained in:
@@ -78,7 +78,6 @@ const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws
|
|||||||
// Only inspected when `aws-load-balancer-ssl-cert` is used.
|
// Only inspected when `aws-load-balancer-ssl-cert` is used.
|
||||||
// If `http` (default) or `https`, an HTTPS listener that terminates the connection and parses headers is created.
|
// If `http` (default) or `https`, an HTTPS listener that terminates the connection and parses headers is created.
|
||||||
// If set to `ssl` or `tcp`, a "raw" SSL listener is used.
|
// If set to `ssl` or `tcp`, a "raw" SSL listener is used.
|
||||||
|
|
||||||
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"
|
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"
|
||||||
|
|
||||||
// Maps from backend protocol to ELB protocol
|
// Maps from backend protocol to ELB protocol
|
||||||
@@ -2119,7 +2118,9 @@ func isSubnetPublic(rt []*ec2.RouteTable, subnetID string) (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getListener(port api.ServicePort, annotations map[string]string) (*elb.Listener, error) {
|
// buildListener creates a new listener from the given port, adding an SSL certificate
|
||||||
|
// if indicated by the appropriate annotations.
|
||||||
|
func buildListener(port api.ServicePort, annotations map[string]string) (*elb.Listener, error) {
|
||||||
loadBalancerPort := int64(port.Port)
|
loadBalancerPort := int64(port.Port)
|
||||||
instancePort := int64(port.NodePort)
|
instancePort := int64(port.NodePort)
|
||||||
protocol := strings.ToLower(string(port.Protocol))
|
protocol := strings.ToLower(string(port.Protocol))
|
||||||
@@ -2172,7 +2173,7 @@ func (s *AWSCloud) EnsureLoadBalancer(apiService *api.Service, hosts []string, a
|
|||||||
glog.Errorf("Ignoring port without NodePort defined: %v", port)
|
glog.Errorf("Ignoring port without NodePort defined: %v", port)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
listener, err := getListener(port, annotations)
|
listener, err := buildListener(port, annotations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@@ -1200,7 +1200,7 @@ func TestDescribeLoadBalancerOnEnsure(t *testing.T) {
|
|||||||
c.EnsureLoadBalancer(&api.Service{ObjectMeta: api.ObjectMeta{Name: "myservice", UID: "id"}}, []string{}, map[string]string{})
|
c.EnsureLoadBalancer(&api.Service{ObjectMeta: api.ObjectMeta{Name: "myservice", UID: "id"}}, []string{}, map[string]string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetListener(t *testing.T) {
|
func TestBuildListener(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user