Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: natgateway flowlogs rules #94

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

rmocanu-ionos
Copy link
Contributor

@rmocanu-ionos rmocanu-ionos commented Sep 14, 2023

What does this fix or implement?

fixes #93 and #46

Checklist

  • PR name added as appropriate (e.g. feat:/fix:/doc:/test:/refactor:)
  • Tests added or updated
  • Documentation updated
  • Sonar Cloud Scan
  • Changelog updated and version incremented (label: upcoming release)
  • Github Issue linked if any
  • Jira task updated

Comment on lines +217 to +219
if new_rules != nil {
*rules = append(*rules, *new_rules.Items...)
}
Copy link
Contributor

@avirtopeanu-ionos avirtopeanu-ionos Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, if the user specifies some custom nat rules, then it should override the default ones, instead of adding to them?

For example, currently, I think there is no way of closing, for example, the default port 10250 TCP

@@ -50,6 +50,8 @@ Available Options for the IONOS Cloud Docker Machine Driver:
| `--ionoscloud-create-nat` | Create a new NAT with some default open ports |
| `--ionoscloud-nat-public-ips` | If --ionoscloud-create-nat is set, change the NAT's public IPs to these values |
| `--ionoscloud-nat-lans-to-gateways` | If --ionoscloud-create-nat is set, change the NAT's mappings of LANs to Gateway IPs to these values. Must respect format `1=10.0.0.1,10.0.0.2:2=10.0.0.10` |
| `--ionoscloud-nat-flowlogs` | If --ionoscloud-create-nat is set, add flowlogs to the nat. Must respect format `name:action:direction:bucket`, |
| `--ionoscloud-nat-rules` | If --ionoscloud-create-nat is set, add rules to the NAT. Must respect format `name:type:protocol:public_ip:source_subnet:target_subnet:target_port_range_start:target_port_range_end`, to skip providing an optional value just omit it (`name:type:protocol::source_subnet:::`), not setting public IP will use the public IP of the NAT for the rule |
Copy link
Contributor

@avirtopeanu-ionos avirtopeanu-ionos Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to add that the user can add multiple rules by separating these string models via ,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add another --ionoscloud-nat-rules with a second rule and an array will be formed
using "," would result in an error if i remember correctly as the whole array is passed as a string

#97)

* feat: added option to skip adding default nat rules, changed default target subnet

* test: remove sleep, fix tests

* fix: check error first

* doc: updated docs with new ionoscloud-skip-default-nat-rules flag
@sonarcloud
Copy link

sonarcloud bot commented Sep 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

31.8% 31.8% Coverage
0.0% 0.0% Duplication

@rmocanu-ionos rmocanu-ionos merged commit f7cc6b9 into master Sep 26, 2023
5 checks passed
@rmocanu-ionos rmocanu-ionos deleted the feat/natgateway-flowlogs-rules branch September 26, 2023 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants