@@ -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.
108109func (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 {
0 commit comments