Skip to content

Commit 0a374f3

Browse files
committed
fixed golint issues
1 parent 15a510c commit 0a374f3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import (
1414
"github.com/pkg/errors"
1515
)
1616

17-
var defaultDenyEgressPolicy policy.Policy = getEndpointPolicy(policy.ACLPolicy, cns.ActionTypeBlock, cns.DirectionTypeOut, 10_000)
18-
var defaultDenyIngressPolicy policy.Policy = getEndpointPolicy(policy.ACLPolicy, cns.ActionTypeBlock, cns.DirectionTypeIn, 10_000)
17+
var defaultDenyEgressPolicy policy.Policy = getEndpointPolicy(cns.DirectionTypeOut)
18+
19+
var defaultDenyIngressPolicy policy.Policy = getEndpointPolicy(cns.DirectionTypeIn)
1920

2021
// for AKS L1VH, do not set default route on infraNIC to avoid customer pod reaching all infra vnet services
2122
// default route is set for secondary interface NIC(i.e,delegatedNIC)
@@ -70,8 +71,8 @@ func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo, gwIP st
7071
}
7172

7273
// get policy of type endpoint policy given the params
73-
func getEndpointPolicy(policyType policy.CNIPolicyType, action, direction string, priority int) policy.Policy {
74-
endpointPolicy := createEndpointPolicy(string(policyType), action, direction, priority)
74+
func getEndpointPolicy(direction string) policy.Policy {
75+
endpointPolicy := createEndpointPolicy(direction)
7576

7677
additionalArgs := policy.Policy{
7778
Type: policy.EndpointPolicy,
@@ -82,17 +83,17 @@ func getEndpointPolicy(policyType policy.CNIPolicyType, action, direction string
8283
}
8384

8485
// create policy given the params
85-
func createEndpointPolicy(policyType, action, direction string, priority int) []byte {
86+
func createEndpointPolicy(direction string) []byte {
8687
endpointPolicy := struct {
8788
Type string `json:"Type"`
8889
Action string `json:"Action"`
8990
Direction string `json:"Direction"`
9091
Priority int `json:"Priority"`
9192
}{
92-
Type: policyType,
93-
Action: action,
93+
Type: string(policy.ACLPolicy),
94+
Action: cns.ActionTypeBlock,
9495
Direction: direction,
95-
Priority: priority,
96+
Priority: 10_000,
9697
}
9798

9899
rawPolicy, err := json.Marshal(endpointPolicy)
@@ -107,7 +108,6 @@ func createEndpointPolicy(policyType, action, direction string, priority int) []
107108
// and release IP configs handlers.
108109
func (k *K8sSWIFTv2Middleware) IPConfigsRequestHandlerWrapper(defaultHandler, failureHandler cns.IPConfigsHandlerFunc) cns.IPConfigsHandlerFunc {
109110
return func(ctx context.Context, req cns.IPConfigsRequest) (*cns.IPConfigsResponse, error) {
110-
111111
podInfo, respCode, message := k.GetPodInfoForIPConfigsRequest(ctx, &req)
112112

113113
if respCode != types.Success {

cns/middlewares/k8sSwiftV2_windows_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ func TestAddDefaultDenyACL(t *testing.T) {
150150
var defaultDenyEgressPolicy, defaultDenyIngressPolicy policy.Policy
151151
var err error
152152

153-
defaultDenyEgressPolicy = getEndpointPolicy("ACL", "Block", "Out", 10_000)
154-
defaultDenyIngressPolicy = getEndpointPolicy("ACL", "Block", "In", 10_000)
153+
defaultDenyEgressPolicy = getEndpointPolicy("Out")
154+
defaultDenyIngressPolicy = getEndpointPolicy("In")
155155

156156
allEndpoints = append(allEndpoints, defaultDenyEgressPolicy, defaultDenyIngressPolicy)
157157

0 commit comments

Comments
 (0)