fix: leave the probe path empty for TCP probes

This commit is contained in:
Qi Ni 2021-09-26 14:27:01 +08:00
parent 857d4c107c
commit 1256231f2f
2 changed files with 12 additions and 1 deletions

View File

@ -1645,7 +1645,9 @@ func (az *Cloud) reconcileLoadBalancerRule(
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
}

View File

@ -1724,6 +1724,15 @@ func TestReconcileLoadBalancerRule(t *testing.T) {
expectedProbes: getDefaultTestProbes("Tcp", ""),
expectedRules: getHATestRules(true),
},
{
desc: "reconcileLoadBalancerRule shall 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)