mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): security group rule create (#20695)
This commit is contained in:
@@ -89,7 +89,7 @@ require (
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
k8s.io/cri-api v0.22.17
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062632-f586429f366d
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025407-fcc1a0b725c1
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
|
||||
yunion.io/x/jsonutils v1.0.1-0.20240203102553-4096f103b401
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
@@ -1215,8 +1215,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062632-f586429f366d h1:FsW649gKCUZOmXbRrD7gDYc9q/Hl19bKaNBe9/BJRCE=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062632-f586429f366d/go.mod h1:iLoBHVR2Eur/1WJSGcbZaEwpzh/iqXvbFCsX9/xt8CI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025407-fcc1a0b725c1 h1:PtCUfpzyF+JHU+A3vQrt7bGirqXDFiPSUT6sFq3ewac=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025407-fcc1a0b725c1/go.mod h1:iLoBHVR2Eur/1WJSGcbZaEwpzh/iqXvbFCsX9/xt8CI=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
@@ -83,6 +83,9 @@ func (self *SecurityGroupRuleCreateTask) OnInit(ctx context.Context, obj db.ISta
|
||||
CIDR: rule.CIDR,
|
||||
Action: secrules.TSecurityRuleAction(rule.Action),
|
||||
}
|
||||
if len(opts.CIDR) == 0 {
|
||||
opts.CIDR = "0.0.0.0/0"
|
||||
}
|
||||
|
||||
iRule, err := iGroup.CreateRule(opts)
|
||||
if err != nil {
|
||||
|
||||
Vendored
+1
-1
@@ -1489,7 +1489,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062632-f586429f366d
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025407-fcc1a0b725c1
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+3
@@ -131,6 +131,9 @@ func (self *SGoogleClient) CreateSecurityGroupRule(globalnetworkId, tag string,
|
||||
"direction": "INGRESS",
|
||||
"targetTags": []string{strings.ToLower(tag)},
|
||||
}
|
||||
if len(opts.CIDR) == 0 {
|
||||
opts.CIDR = "0.0.0.0/0"
|
||||
}
|
||||
if opts.Direction == secrules.DIR_OUT {
|
||||
body["direction"] = "EGRESS"
|
||||
body["destinationRanges"] = []string{opts.CIDR}
|
||||
|
||||
+3
@@ -338,6 +338,9 @@ func (self *SRegion) CreateSecurityGroupRule(groupId string, opts *cloudprovider
|
||||
if opts.Action == secrules.SecurityRuleDeny {
|
||||
action = "drop"
|
||||
}
|
||||
if len(opts.CIDR) == 0 {
|
||||
opts.CIDR = "0.0.0.0/0"
|
||||
}
|
||||
params := map[string]string{
|
||||
"SecurityGroupId": groupId,
|
||||
prefix + "PolicyIndex": fmt.Sprintf("%d", opts.Priority),
|
||||
|
||||
Reference in New Issue
Block a user