Merge pull request #105253 from nilo19/bug/cherry-pick-680

fix: leave the probe path empty for TCP probes
This commit is contained in:
Kubernetes Prow Robot 2021-10-31 23:01:19 -07:00 committed by GitHub
commit 763e528e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -1643,7 +1643,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

@ -1726,6 +1726,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)