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

Add Wireguard Support and create a fake SMD #38

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

alexlovelltroy
Copy link
Member

This pull request introduces several new features and refactors existing code in the cloud-init-server. The main change is the addition of WireGuard support. In addition, there are new HTTP handlers for managing groups and a refactor of the main server initialization, and removing old instance data handling code.

New Features:

  • Added Wireguard support to allow nodes to register themselves to set up a WireGuard tunnel for use to pull cloud-init information. This is gated by a set of new commandline arguments -wireguard-server 100.97.0.1/16 and -wireguard-only. When enabled, the server will create a narrow tunnel for each client and only allow requests that come through the tunnel.
  • Added FakeSMD for testing. This is only accessible through the use of an environment variable CLOUD_INIT_SMD_SIMULATOR=true. There is no persistence and it generates 500 fake nodes for testing.
  • Added new HTTP handlers for managing groups, including GetGroups, AddGroupHandler, GetGroupHandler, UpdateGroupHandler, and RemoveGroupHandler in group_handlers.go.

Refactoring:

  • Refactored the main server initialization in main.go to include new configuration options and WireGuard support. This includes setting up the cistore, adding new flags, and initializing the WireGuard server. [1] [2] [3] [4]

Code Removal:

  • Removed old instance data handling code from instance_data.go and its associated tests from instance_data_test.go. [1] [2]
  • Removed old handlers and their tests from handlers_test.go.

alexlovelltroy and others added 4 commits January 8, 2025 10:14
…anagement

feat: add unit tests for cloud-init server handlers and implement local inventory structure
…, update dependencies, and remove obsolete tests

feat: remove obsolete JSON configuration files and update add_node.sh to include group assignment
feat: refactor instance data generation and update group metadata handling
feat: enhance cloud-init server with group user data handling and improve vendor data response
      * refactor code to put less in citypes and more in local handlers
feat: add scripts for hostname override and cluster defaults, refactor ciStore interface, update group handling, add cluster defaults endpoints and support to override the hostnames as needed
feat: add update node functionality to FakeSMDClient and corresponding HTTP handler
fix: remove unnecessary unlock call in PopulateNodes method of SMDClient
fix: streamline locking mechanism in PopulateNodes method of SMDClient
…adata handlers

fix: update SetClusterDefaults method to use locking and improve cluster defaults handling
feat: update cluster defaults demo script to show ssh key and base-url
fix: improve error handling in GroupUserDataHandler to return empty cloud-config on missing group data
fix: update base URL in demo script and trim trailing slashes in SetClusterDefaults method
feat: Allow node update to include own ip/mac
fix: update UpdateGroupData method to support creating group data if it doesn't exist
…dler

fix: enhance error handling and logging in WireGuard setup and client management
feat: enhance WireGuard server initialization and improve metadata field naming conventions
feat: implement IP address allocation management with IPAllocator and integrate into InterfaceManager
feat: add WireGuard IP management methods to SMDClient and FakeSMDClient
feat: enhance WireGuard client addition by integrating SMD client for IP management
feat: enhance IPAllocator with network and broadcast address calculations and add unit tests
      Update IpforPeer to return existing wgip for peer
feat: add support for WireGuard setup and implement middleware for access control
Copy link
Collaborator

@travisbcotton travisbcotton left a comment

Choose a reason for hiding this comment

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

A lot of changes here, but I've tested it on one of our test systems and it all works. Not exhaustive tests though

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