Commit Graph

67 Commits

Author SHA1 Message Date
caec71f06d feat(k8s): add initial Resource module structure
Introduce the initial structure for the Kubernetes (K8s) resource module, including `K8sResourceScore` and `K8sResourceInterpret`. Additionally, update the module paths to include the new K8s module.
2025-01-22 10:36:19 -05:00
98c2ab169c dep: Use github dependency for yaserde 2025-01-22 10:35:35 -05:00
d8c762e9df feat(harmony_macros): add yaml macro to validate YAML input
- Introduced a new `yaml` macro in `harmony_macros` that validates if the provided YAML string is valid by attempting to deserialize it using `serde_yaml`.
- Added dependencies on `serde`, `serde_yaml` for handling YAML deserialization.
- Included dev dependencies with features enabled for deriving types from `serde`.
2025-01-22 10:21:08 -05:00
jeangab
2041ce63d7 feat(adr): add architecture decision record for infrastructure abstractions
Introduce a new Architecture Decision Record (ADR) outlining the design of provider-agnostic infrastructure abstractions in Harmony. This ADR details how domain-driven traits will be used to define essential elements for resources and upgrades, enabling flexibility and portability across different cloud providers.
2025-01-18 07:11:29 -05:00
jeangab
42ed82b0c1 wip: Kube-rs demo 2025-01-16 16:13:48 -05:00
04db8103c4 fix(config): update variable names and remove unused imports
Refactor variable names to follow snake_case convention and remove unused imports across multiple files to improve code readability and maintainability.
2025-01-12 15:57:01 -05:00
f241bf793e fix(dhcp): remove unused IP range check and simplify DnsConfig
Remove the commented-out IP range validation in `DhcpConfig` and simplify the `DnsConfig` constructor by removing an unnecessary parameter, addressing several compiler warnings.
2025-01-12 15:32:14 -05:00
cad63ecf20 fix(config): specify attribute argument in yaserde macros
Update yaserde macro usage to explicitly specify the `attribute` argument for consistency and compatibility with newer versions of the yaserde crate. This change ensures that all fields annotated with `#[yaserde]` correctly define attributes, aligning with the recommended usage in the latest yaserde documentation.
2025-01-12 14:06:30 -05:00
jeangab
1665198e66 "Update Harmony Opnsense Configuration"
Improved configuration handling for Harmony Opnsense setup. Implemented changes to opnsense-config module to support various settings, including load balancer configuration and DHCP server settings. This update enhances the overall stability and functionality of the Harmony Opnsense setup process.
2025-01-11 13:52:57 -05:00
jeangab
9e6f22d7ea chore: Remove mistakenly commited file 2025-01-09 11:59:18 -05:00
jeangab
bec96c2954 feat(bootstrapping): add bootstrap load balancer and DHCP configurations
- Introduce `bootstrap_load_balancer` module for handling initial load balancing configuration.
- Add `bootstrap_dhcp` module for bootstrapping DHCP settings.
- Create `harmony_types` crate to house shared types, including `MacAddress`.
- Update `harmony_macros` to use `harmony_types` instead of directly referencing `harmony`.
2025-01-09 11:58:49 -05:00
jeangab
a80ead418e fix(config): update package installation command and add load balancer setup script
Update the package installation command to use the Opnsense firmware install script.
Add a call to the HAProxy setup script during the load balancer configuration process. This script is intended to copy the staging configuration to production, though its necessity in this context is uncertain.
2025-01-09 09:30:04 -05:00
jeangab
0af8e7e6a8 fix(load-balancer): implement missing HAProxy reload and sanitize output handling
Implement the `reload_restart` method in `LoadBalancerConfig` to ensure proper HAProxy configuration management. Additionally, enhance SSH command execution by sanitizing and logging outputs effectively. This ensures robust handling of HAProxy configurations and improves debugging capabilities through trace-level logs.
2025-01-08 16:30:56 -05:00
a55c63ffa6 feat(harmony_macros): add ipv4 macro
Adds a new `ipv4` macro to validate IPv4 addresses in proc macros. Removes unused `debug` import from `http.rs`.
2025-01-08 11:49:42 -05:00
81d40ec163 feat(opnsense-config): add caddy module with configuration management
Introduce a new Caddy module within opnsense-config to manage Caddy server configurations. This includes enabling/disabling Caddy, setting ports, and reloading/restarting the service via OPNsense shell commands. Additionally, provide a sample Caddy configuration file for PXE booting and a test file in the pxe-http-files directory.
2025-01-07 17:12:39 -05:00
925e84e4d2 feat(harmony): add TFTP server functionality (#10)
Introduce a new module and interface for serving files via TFTP in the HAClusterTopology structure. This includes adding the necessary dependencies, creating the `TftpServer` trait, implementing it where appropriate, and integrating its usage within the topology struct.

Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/10
Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Co-committed-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
2025-01-07 19:12:35 +00:00
098cb30523 feat(load balancer): Can now fully configure an OPNSense HAProxy
instance for and openshift/OKD cluster

Squashed commit of the following:

commit f0d90d9e37da925c6b4441b076e212dd4f340cb7
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Fri Jan 3 10:19:49 2025 -0500

    chore: Remove opnsense config file committe by mistake

commit 73f017e6abc770003c483ee7e121c1c6e3cafa1a
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Fri Jan 3 10:17:42 2025 -0500

    feat(config): enhance HAProxy load balancer configuration and organize structs

    Add missing fields to the HAProxy load balancer configuration to make it fully functional. Move most of the HAProxy-related structs to their own file within `opnsense-config-xml` for better organization and maintainability.

commit 8a1b0b77dc6dde32298f69b0ca8a24ea2246de9e
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Tue Dec 31 12:06:37 2024 -0500

    feat(OPNSense): add support for configuration port and load balancer commit

    Introduce an optional port parameter to OPNSense configuration creation and enhance LoadBalancerInterpret to apply configurations after ensuring service existence. Adjust package installation commands to run non-interactively and log outputs. Add methods to enable the HAProxy component in the load balancer configuration.

commit 5075d1146f12cf7df2ae5d66ecee45f056ab39e8
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sun Dec 29 09:29:57 2024 -0500

    docs: add README.md for OPNSense demo in vbox-opnsense

    Add a README file with instructions on how to download, start, and run the OPNSense virtual machine using VirtualBox, including credentials and command line usage details.

commit 5cda52430f1db6279707f8d189b7aac10195e09d
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sat Dec 28 23:27:45 2024 -0500

    feat(opnsense-config): add package management and refactor load balancer module

    - Introduced `install_package` and `reload_haproxy` methods in the `Config` struct to manage OPNsense packages and reload HAProxy configuration.
    - Refactored `LoadBalancerConfig` to use a helper method `with_haproxy` for modifying HAProxy configurations, improving code readability and reducing duplication.
    - Added TODO warning in `add_backend` method to ensure new backends refer only to existing entities like servers or health checks.

commit d01186d21c443543e278c9e5190317b9961f8112
Author: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Date:   Sat Dec 28 15:11:10 2024 -0500

    feat: Created demo project for virtualbox opnsense

commit c6c92ab1d457f5b2e38cbcfec0660c6fb550df1e
Author: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com>
Date:   Tue Dec 24 08:08:59 2024 -0500

    fix(xml): Support virtualbox config, pretty much vanilla opnsense

commit 4d5c23a6d07a434baa83d608247d0c7c446c1c08
Author: Sylvain Tremblay <stremblay@nationtech.io>
Date:   Fri Dec 20 16:15:18 2024 -0500

    fix: Support st opnsense config

commit 4546e6b5482061e3d51e07451ba182054d44d888
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 21:11:56 2024 +0000

    feat: HAProxy load balancer able to load and create services, ready to be tested, they do not upload the new config yet

commit a899811d9bacea10e799a072965350842f9cbc7c
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 18:39:32 2024 +0000

    feat: LoadBalancer building haproxy structures wip

commit 653c323f050ead350fd048fb30c1c3717b1471d1
Author: johnride <jg@nationtech.io>
Date:   Fri Dec 20 05:02:52 2024 +0000

    feat: LoadBalancer progress, now handles loading frontend, backend, servers and healthchecks from haproxy xml

commit 737e738f62d22523d5ededa4b6cc0b2e0ac7a0da
Author: jeangab <jeangabriel.gc@gmail.com>
Date:   Thu Dec 19 18:30:58 2024 -0500

    wip: Haproxy coming along, about 80% done before first test

commit 615ed36d89182e4bb1f2312dc9a8e4a7c31ab416
Author: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com>
Date:   Wed Dec 18 22:20:36 2024 -0500

    wip: LoadBalancer score coming along, first part of the score definition done. Next step is finishing it up and writing the concrete HAProxy implementation
2025-01-04 10:12:16 -05:00
0b6c8bfd09 Merge branch 'master' of https://git.nationtech.io/NationTech/harmony 2024-12-19 15:53:50 -05:00
9c672a5c80 chore: remove useless files in the tftpboot tree 2024-12-19 15:51:03 -05:00
Jean-Gabriel Gill-Couture
367e96b36a feat: Add OKD DNS score with DNS entries and registering dhcp leases 2024-12-18 15:58:49 -05:00
b098757683 Merge pull request 'feat: don't crash if ip:mac already exist, just skip it' (#7) from feat/validateExistingStaticLease into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/7
2024-12-18 17:46:25 +00:00
0247252474 feat: don't crash if ip:mac already exist, just skip it 2024-12-18 17:46:08 +00:00
f7e97f5c81 Merge pull request 'feat: Add score and opnsense implementation to register dhcp leases in dns server' (#8) from feat/dnsRegisterDhcpLeases into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/8
2024-12-18 17:45:54 +00:00
Jean-Gabriel Gill-Couture
478fd9e941 feat: Add score and opnsense implementation to register dhcp leases in dns server 2024-12-18 12:38:04 -05:00
51c6f1818c feat: remove the getMacAddress 2024-12-18 09:38:17 -05:00
58f81f0e58 Merge pull request 'feat/opnsenseDNS' (#6) from feat/opnsenseDNS into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/6
2024-12-18 14:21:54 +00:00
Jean-Gabriel Gill-Couture
18c67adfad feat: Harmony now sets dhcp next boot server for PXE on okd setup 2024-12-17 22:45:37 -05:00
Jean-Gabriel Gill-Couture
b15df3c93f feat: OKD Dhcp config works and is actually savec on opnsense firewall, its alive!! First real run on wk cluster 2024-12-17 15:15:41 -05:00
Jean-Gabriel Gill-Couture
d0d81af796 feat(macro): Add mac_address macro 2024-12-17 09:54:23 -05:00
Jean-Gabriel Gill-Couture
1e0c2eb470 feat: Added new crate harmony_macros with ip! macro to facilitate creating ip addresses 2024-12-09 15:23:12 -05:00
jeangab
3592b176e5 chore: Some cleanup in harmony repo 2024-12-03 10:43:50 -05:00
58a4e7882b Merge pull request 'Actual implementation of opnsense dhcp' (#4) from feat/opnsenseDhcp into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/4
2024-11-29 14:53:22 +00:00
jeangab
9c18c8be6d Integrated opnsense-config API in harmony, pretty easy, pretty happy. very much encouraging 2024-11-26 15:58:42 -05:00
Jean-Gabriel Gill-Couture
d30e909b83 feat(opnsense-config): Public API now complete for dhcp add_static_mapping and remove_static_mapping, not perfect but good enough to move forward 2024-11-23 15:07:04 -05:00
Jean-Gabriel Gill-Couture
b14d0ab686 feat: Can now save configuration, refactored repository into manager as it also executes commands to reload services and calling it a repository was found misleading by @stremblay" 2024-11-22 14:15:23 -05:00
Jean-Gabriel Gill-Couture
9a37aa1321 feat(opnsense-config): Public API now a bit simpler, added support for latest opnsense version in xml types 2024-11-21 21:49:38 -05:00
Jean-Gabriel Gill-Couture
cc9bcb902c feat: DhcpConfig can now effectively manage a config file to add a static map entry 2024-11-18 17:05:48 -05:00
Jean-Gabriel Gill-Couture
cb1fea1eda wip: Interfaces using NamedList helper type to handle dynamic interface names, some refactoring on top 2024-11-18 07:08:03 -05:00
Jean-Gabriel Gill-Couture
65c395aeae wip(opnsense-config): Refactoring to improve usability and features 2024-11-14 23:45:13 -05:00
jeangab
85786cf648 feat(opnsense-config): ip_in_range function works 2024-11-07 09:22:22 -05:00
0700265622 wip: Implement add static mapping public function 2024-11-07 07:49:13 -05:00
Jean-Gabriel Gill-Couture
50ca6afb47 feat(opnsense-config): Xml parsing now works great to parse a full production config. Only some element ordering that is not consistent across multiple elements of the same type sometimes does not match but moving some stuff around gets us easily to a 100% matching file 2024-11-06 16:23:08 -05:00
Jean-Gabriel Gill-Couture
ab59923dae feat(opnsense-config): Add MaybeString type to preserve xml serialization of empty elements 2024-11-02 13:51:12 -04:00
Jean-Gabriel Gill-Couture
ebdc83b21b wip: RawXml ser/de works well, still a few more complex cases to test but seems good wnough for the opnsense config case 2024-10-20 07:39:41 -04:00
Jean-Gabriel Gill-Couture
e0acbf304b wip: Full opnsense deserializer almost done, works on a slightly cheated config file, next step is to try the real config file 2024-10-18 00:48:57 -04:00
Jean-Gabriel Gill-Couture
b332723431 feat(opnsense-config): Refactor config to use a repository trait, implement file based and ssh, save a full config file 2024-10-14 16:13:20 -04:00
Jean-Gabriel Gill-Couture
8459c38499 wip(opnsense-config): It compiles now, still have to test it 2024-10-14 07:53:02 -04:00
Jean-Gabriel Gill-Couture
32cea6c3ff wip: New crate opnsense-config 2024-10-13 08:48:56 -04:00
Jean-Gabriel Gill-Couture
6a5ebdbac7 wip: xml parser 2024-10-04 11:26:55 -04:00
jeangab
407bdbc032 wip: OPNSense XML config editor coming along 2024-09-30 16:20:11 -04:00