mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): security group rule create (#20696)
This commit is contained in:
@@ -88,7 +88,7 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062636-776eefa1bc11
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025412-01d62887063f
|
||||
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
|
||||
|
||||
@@ -1210,8 +1210,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.20240627062636-776eefa1bc11 h1:BGgeJfS7zVMhJROBYx6tTd877ot6ZKxPLf2+nzvK7ZI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240627062636-776eefa1bc11/go.mod h1:iLoBHVR2Eur/1WJSGcbZaEwpzh/iqXvbFCsX9/xt8CI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025412-01d62887063f h1:uSJUrgR373E8D+EI7CCBOCvTS0hJrYEGU2ythiJWZxI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025412-01d62887063f/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
@@ -1485,7 +1485,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.20240627062636-776eefa1bc11
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240701025412-01d62887063f
|
||||
## 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