Skip to content

Commit

Permalink
Merge pull request #1005 from ioito/hotfix/qx-secgroup-rule-create
Browse files Browse the repository at this point in the history
fix(qcloud): security group rule create
  • Loading branch information
ioito authored Jul 1, 2024
2 parents d11cc99 + 6898ba6 commit 1e444b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/multicloud/google/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions pkg/multicloud/qcloud/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 1e444b8

Please sign in to comment.