Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: leave the probe path empty for TCP probes #680

Merged
merged 1 commit into from Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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