Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Fix/gvpn gateway allowed ips#371

Merged
nxtcoder17 merged 2 commits into
release-v1.0.7from
fix/gvpn-gateway-allowed-ips
Sep 26, 2024
Merged

Fix/gvpn gateway allowed ips#371
nxtcoder17 merged 2 commits into
release-v1.0.7from
fix/gvpn-gateway-allowed-ips

Conversation

@nxtcoder17
Copy link
Copy Markdown
Member

@nxtcoder17 nxtcoder17 commented Sep 26, 2024

Resolves kloudlite/kloudlite#295

Summary by Sourcery

Fix the allowed IPs configuration in global VPN devices and add a new resolver for retrieving DNS host suffix.

Bug Fixes:

  • Fix the handling of allowed IPs in the global VPN device configuration by replacing the use of non-cluster-use allowed IPs with a specific IP range.

Enhancements:

  • Add a new resolver function CoreGetDNSHostSuffix to retrieve the DNS host suffix from environment variables.

- apparently, cluster gateway's allowed IP could easily have been
  100.64.0.0/10, but idk why i had all possible 256 combinations in
  there 😂
@nxtcoder17 nxtcoder17 self-assigned this Sep 26, 2024
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Sep 26, 2024

Reviewer's Guide by Sourcery

This pull request addresses issues related to Global VPN (GVPN) gateway allowed IPs and introduces a new resolver for DNS host suffix. The changes primarily affect the handling of allowed IPs for GVPN devices and improve the robustness of peer hashing.

Sequence Diagram

No sequence diagram generated.

File-Level Changes

Change Details Files
Added a new resolver for DNS host suffix
  • Implemented CoreGetDNSHostSuffix resolver
  • Returns KloudliteDNSSuffix from EnvVars
apps/console/internal/app/graph/schema.resolvers.go
Modified allowed IPs for GVPN gateway device
  • Commented out the addition of NonClusterUseAllowedIPs
  • Added a fixed CIDR '100.64.0.0/10' to allowedIPs
apps/infra/internal/domain/global-vpn-devices.go
Improved peer hashing function
  • Added default value handling for peer IP in hashPeer function
apps/infra/internal/domain/global-vpn-cluster-connection.go

Tips and commands
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder17 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The change in global-vpn-devices.go replaces a dynamic list with a hardcoded CIDR. Please provide more context on why this change was necessary and document the reasoning in the code comments.
  • Consider adding error handling to the new CoreGetDNSHostSuffix function in schema.resolvers.go, or explain why it's not necessary in this case.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +457 to +458
func (r *queryResolver) CoreGetDNSHostSuffix(ctx context.Context) (string, error) {
return r.EnvVars.KloudliteDNSSuffix, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consider adding error handling for KloudliteDNSSuffix

The function assumes KloudliteDNSSuffix is always available and valid. Consider adding a check to ensure it's not empty or invalid, and return an appropriate error if it is.

Suggested change
func (r *queryResolver) CoreGetDNSHostSuffix(ctx context.Context) (string, error) {
return r.EnvVars.KloudliteDNSSuffix, nil
func (r *queryResolver) CoreGetDNSHostSuffix(ctx context.Context) (string, error) {
if r.EnvVars.KloudliteDNSSuffix == "" {
return "", errors.New("KloudliteDNSSuffix is empty")
}
return r.EnvVars.KloudliteDNSSuffix, nil
}

@nxtcoder17 nxtcoder17 merged commit c9eab09 into release-v1.0.7 Sep 26, 2024
@nxtcoder17 nxtcoder17 deleted the fix/gvpn-gateway-allowed-ips branch September 26, 2024 11:24
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Gateway] Cluster Gateway has peers with very large allowed IPs

1 participant