Skip to content

Create IP detection utils and use in AWS security group creation #423

Merged
ArangoGutierrez merged 7 commits intoNVIDIA:mainfrom
ArangoGutierrez:get_ip
Jul 24, 2025
Merged

Create IP detection utils and use in AWS security group creation #423
ArangoGutierrez merged 7 commits intoNVIDIA:mainfrom
ArangoGutierrez:get_ip

Conversation

@ArangoGutierrez
Copy link
Collaborator

This pull request introduces automated public IP detection for AWS environments in Holodeck, simplifying configuration and improving usability. The changes include updates to documentation, examples, and the codebase to support this new feature. Below is a summary of the most important changes:

Feature Implementation:

  • Added the GetIPAddress utility function to automatically detect the user's public IP using multiple fallback services and format it in CIDR notation for AWS compatibility. (pkg/utils/ip.go, pkg/utils/ip.goR1-R114)
  • Integrated the IP detection functionality into the AWS provider's security group creation process, ensuring the detected IP is added to the security group rules. (pkg/provider/aws/create.go, pkg/provider/aws/create.goR252-R262)

Documentation Updates:

  • Added a new "IP Detection Guide" with detailed explanations of the feature, configuration examples, troubleshooting steps, and best practices. (docs/guides/ip-detection.md, docs/guides/ip-detection.mdR1-R124)
  • Updated existing documentation to reflect the new behavior, including the README.md, commands/create.md, guides/README.md, and prerequisites.md files. (docs/README.md, [1]; docs/commands/create.md, [2]; docs/guides/README.md, [3]; docs/prerequisites.md, [4]

Example Configuration Updates:

  • Modified example YAML files to indicate that the ingressIpRanges field is now optional, as the user's public IP is automatically detected. (examples/aws_kind.yaml, [1]; examples/aws_kubeadm.yaml, [2]; examples/v1alpha1_environment.yaml, [3]

Test Data Updates:

  • Removed hardcoded ingressIpRanges entries from test data files to align with the new automated IP detection feature. (tests/data/test_aws.yml, [1]; tests/data/test_aws_dra.yml, [2]; tests/data/test_aws_kernel.yml, [3]; tests/data/test_aws_legacy.yml, [4]

These changes collectively enhance the user experience by automating IP configuration for AWS environments, reducing errors, and improving documentation clarity.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces automated public IP detection for AWS environments in Holodeck, eliminating the need for users to manually configure their IP addresses in security group rules. The feature automatically detects the user's public IP using multiple fallback services and formats it correctly for AWS.

  • Added IP detection utility with fallback services and validation
  • Integrated automatic IP detection into AWS security group creation
  • Updated documentation and examples to reflect the optional nature of ingressIpRanges

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/utils/ip.go New utility for IP detection with multiple service fallbacks and validation
pkg/provider/aws/create.go Integration of IP detection into security group creation
tests/data/test_aws*.yml Removal of hardcoded IP ranges from test configurations
examples/*.yaml Updated examples showing optional ingressIpRanges with comments
docs/guides/ip-detection.md New comprehensive guide for IP detection feature
docs/commands/create.md Documentation updates for automated IP detection
docs/guides/README.md Added reference to new IP detection guide
docs/examples/README.md Updated examples documentation
docs/prerequisites.md Updated network requirements
docs/README.md Added link to IP detection guide

@coveralls
Copy link

coveralls commented Jul 23, 2025

Pull Request Test Coverage Report for Build 16471487882

Details

  • 0 of 77 (0.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.6%) to 14.286%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/provider/aws/create.go 0 12 0.0%
pkg/utils/ip.go 0 65 0.0%
Totals Coverage Status
Change from base Build 16468368668: -0.6%
Covered Lines: 261
Relevant Lines: 1827

💛 - Coveralls

- Add utils.GetIPAddress() with HTTP-based IP detection services
- Implement fallback services (ipify.org, ifconfig.me, icanhazip.com, ident.me)
- Add timeout protection (15s overall, 5s per service) and context support
- Include IP validation and proper CIDR notation (/32) for AWS API
- Use utils.GetIPAddress() in AWS security group creation
- Fix "CIDR block malformed" error in security group creation

The new utils package provides reliable public IP detection with proper
CIDR formatting, ensuring AWS security groups are created with valid
IP ranges for external access.

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
@ArangoGutierrez
Copy link
Collaborator Author

It's ok for CI Pipeline / e2e-test / integration-test (push) to fail, expected during this PR

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
@ArangoGutierrez ArangoGutierrez merged commit 8b26d05 into NVIDIA:main Jul 24, 2025
18 of 19 checks passed
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.

3 participants