mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
fix: formating and typo
This commit is contained in:
parent
d7f14fb38e
commit
fbe3521e8e
@ -65,7 +65,7 @@ const (
|
|||||||
nodeLabelRole = "kubernetes.io/role"
|
nodeLabelRole = "kubernetes.io/role"
|
||||||
nicFailedState = "Failed"
|
nicFailedState = "Failed"
|
||||||
|
|
||||||
storageAccountNameMaxLength = 24
|
storageAccountNameMaxLength = 24
|
||||||
frontendIPConfigNameMaxLength = 80
|
frontendIPConfigNameMaxLength = 80
|
||||||
loadBalancerRuleNameMaxLength = 80
|
loadBalancerRuleNameMaxLength = 80
|
||||||
)
|
)
|
||||||
@ -283,10 +283,10 @@ func (az *Cloud) getLoadBalancerRuleName(service *v1.Service, protocol v1.Protoc
|
|||||||
return ruleName
|
return ruleName
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load balancer rule name must be less or equal to 80 charactors, so excluding the hyphen two segments cannot exceed 79
|
// Load balancer rule name must be less or equal to 80 characters, so excluding the hyphen two segments cannot exceed 79
|
||||||
subnetSegment := *subnet
|
subnetSegment := *subnet
|
||||||
if len(ruleName) + len(subnetSegment) + 1 > loadBalancerRuleNameMaxLength {
|
if len(ruleName)+len(subnetSegment)+1 > loadBalancerRuleNameMaxLength {
|
||||||
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength - len(ruleName) - 1]
|
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength-len(ruleName)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s-%s-%s-%d", prefix, subnetSegment, protocol, port)
|
return fmt.Sprintf("%s-%s-%s-%d", prefix, subnetSegment, protocol, port)
|
||||||
@ -333,7 +333,7 @@ func (az *Cloud) getFrontendIPConfigName(service *v1.Service) string {
|
|||||||
if subnetName != nil {
|
if subnetName != nil {
|
||||||
ipcName := fmt.Sprintf("%s-%s", baseName, *subnetName)
|
ipcName := fmt.Sprintf("%s-%s", baseName, *subnetName)
|
||||||
|
|
||||||
// Azure lb front end configuration name must not exceed 80 charactors
|
// Azure lb front end configuration name must not exceed 80 characters
|
||||||
if len(ipcName) > frontendIPConfigNameMaxLength {
|
if len(ipcName) > frontendIPConfigNameMaxLength {
|
||||||
ipcName = ipcName[:frontendIPConfigNameMaxLength]
|
ipcName = ipcName[:frontendIPConfigNameMaxLength]
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ limitations under the License.
|
|||||||
package azure
|
package azure
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
@ -261,13 +261,13 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
|
|||||||
|
|
||||||
svc := &v1.Service{
|
svc := &v1.Service{
|
||||||
ObjectMeta: meta.ObjectMeta{
|
ObjectMeta: meta.ObjectMeta{
|
||||||
Annotations: map[string]string{ },
|
Annotations: map[string]string{},
|
||||||
UID: "257b9655-5137-4ad2-b091-ef3f07043ad3",
|
UID: "257b9655-5137-4ad2-b091-ef3f07043ad3",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
description string
|
description string
|
||||||
subnetName string
|
subnetName string
|
||||||
isInternal bool
|
isInternal bool
|
||||||
useStandardLB bool
|
useStandardLB bool
|
||||||
@ -276,49 +276,49 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
|
|||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
description: "internal lb should have subnet name on the rule name",
|
description: "internal lb should have subnet name on the rule name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
protocol: v1.ProtocolTCP,
|
protocol: v1.ProtocolTCP,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet-TCP-9000",
|
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet-TCP-9000",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "internal standard lb should have subnet name on the rule name but truncated to 80 charactors",
|
description: "internal standard lb should have subnet name on the rule name but truncated to 80 characters",
|
||||||
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
protocol: v1.ProtocolTCP,
|
protocol: v1.ProtocolTCP,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
|
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "internal basic lb should have subnet name on the rule name but truncated to 80 charactors",
|
description: "internal basic lb should have subnet name on the rule name but truncated to 80 characters",
|
||||||
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: false,
|
useStandardLB: false,
|
||||||
protocol: v1.ProtocolTCP,
|
protocol: v1.ProtocolTCP,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
|
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "external standard lb should not have subnet name on the rule name",
|
description: "external standard lb should not have subnet name on the rule name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
protocol: v1.ProtocolTCP,
|
protocol: v1.ProtocolTCP,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
|
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "external basic lb should not have subnet name on the rule name",
|
description: "external basic lb should not have subnet name on the rule name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
useStandardLB: false,
|
useStandardLB: false,
|
||||||
protocol: v1.ProtocolTCP,
|
protocol: v1.ProtocolTCP,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
|
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,46 +351,46 @@ func TestGetFrontendIPConfigName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
description string
|
description string
|
||||||
subnetName string
|
subnetName string
|
||||||
isInternal bool
|
isInternal bool
|
||||||
useStandardLB bool
|
useStandardLB bool
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
description: "internal lb should have subnet name on the frontend ip configuration name",
|
description: "internal lb should have subnet name on the frontend ip configuration name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet",
|
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
|
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
|
||||||
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
|
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
|
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
|
||||||
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
useStandardLB: false,
|
useStandardLB: false,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
|
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "external standard lb should not have subnet name on the frontend ip configuration name",
|
description: "external standard lb should not have subnet name on the frontend ip configuration name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
useStandardLB: true,
|
useStandardLB: true,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad",
|
expected: "a257b965551374ad2b091ef3f07043ad",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "external basic lb should not have subnet name on the frontend ip configuration name",
|
description: "external basic lb should not have subnet name on the frontend ip configuration name",
|
||||||
subnetName: "shortsubnet",
|
subnetName: "shortsubnet",
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
useStandardLB: false,
|
useStandardLB: false,
|
||||||
expected: "a257b965551374ad2b091ef3f07043ad",
|
expected: "a257b965551374ad2b091ef3f07043ad",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user