Skip to content

Commit

Permalink
fix: leave the probe path empty for TCP probes
Browse files Browse the repository at this point in the history
  • Loading branch information
nilo19 committed Jun 28, 2021
1 parent fb498b8 commit d37fa6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/provider/azure_loadbalancer.go
Expand Up @@ -2046,7 +2046,9 @@ func (az *Cloud) getExpectedLBRules(
if probeProtocol == "" {
probeProtocol = string(network.ProbeProtocolHTTP)
}
if requestPath == "" {

needRequestPath := strings.EqualFold(probeProtocol, string(network.ProbeProtocolHTTP)) || strings.EqualFold(probeProtocol, string(network.ProbeProtocolHTTPS))
if requestPath == "" && needRequestPath {
requestPath = podPresencePath
}

Expand Down
15 changes: 12 additions & 3 deletions pkg/provider/azure_loadbalancer_test.go
Expand Up @@ -1761,7 +1761,7 @@ func TestReconcileLoadBalancerRule(t *testing.T) {
expectedRules: getDefaultTestRules(true),
},
{
desc: "reconcileLoadBalancerRule shall return corresponding probe and lbRule (slb with HA enabled)",
desc: "getExpectedLBRules shall return corresponding probe and lbRule (slb with HA enabled)",
service: getTestService("test1", v1.ProtocolTCP, map[string]string{
"service.beta.kubernetes.io/azure-load-balancer-enable-high-availability-ports": "true",
"service.beta.kubernetes.io/azure-load-balancer-internal": "true",
Expand All @@ -1772,7 +1772,7 @@ func TestReconcileLoadBalancerRule(t *testing.T) {
expectedRules: getHATestRules(true, true, v1.ProtocolTCP),
},
{
desc: "reconcileLoadBalancerRule shall return corresponding probe and lbRule (slb with SCTP)",
desc: "getExpectedLBRules shall return corresponding probe and lbRule (slb with SCTP)",
service: getTestService("test1", v1.ProtocolSCTP, map[string]string{
"service.beta.kubernetes.io/azure-load-balancer-enable-high-availability-ports": "true",
"service.beta.kubernetes.io/azure-load-balancer-internal": "true",
Expand All @@ -1782,7 +1782,7 @@ func TestReconcileLoadBalancerRule(t *testing.T) {
expectedRules: getHATestRules(true, false, v1.ProtocolSCTP),
},
{
desc: "reconcileLoadBalancerRule shall return corresponding probe and lbRule (slb with HA enabled multi-ports services)",
desc: "getExpectedLBRules shall return corresponding probe and lbRule (slb with HA enabled multi-ports services)",
service: getTestService("test1", v1.ProtocolTCP, map[string]string{
"service.beta.kubernetes.io/azure-load-balancer-enable-high-availability-ports": "true",
"service.beta.kubernetes.io/azure-load-balancer-internal": "true",
Expand All @@ -1792,6 +1792,15 @@ func TestReconcileLoadBalancerRule(t *testing.T) {
expectedProbes: getDefaultTestProbes("Tcp", ""),
expectedRules: getHATestRules(true, true, v1.ProtocolTCP),
},
{
desc: "getExpectedLBRules should leave probe path empty when using TCP probe",
service: getTestService("test1", v1.ProtocolTCP, nil, false, 80),
loadBalancerSku: "standard",
wantLb: true,
probeProtocol: "Tcp",
expectedProbes: getDefaultTestProbes("Tcp", ""),
expectedRules: getDefaultTestRules(true),
},
}
for i, test := range testCases {
az := GetTestCloud(ctrl)
Expand Down

0 comments on commit d37fa6c

Please sign in to comment.