Commit Graph

359 Commits

Author SHA1 Message Date
76c0cacc1b Merge pull request 'feat: LampScore implement dockerfile generation and image building' (#22) from feat/lampDocker into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/22
Reviewed-by: wjro <wrolleman@nationtech.io>
2025-04-27 19:56:29 +00:00
f17948397f feat: escape PHP_ERROR_REPORTING value in Dockerfile
Escapes the value of the PHP_ERROR_REPORTING environment variable in the Dockerfile to prevent potential issues with shell interpretation. Uses EnvBuilder for a more structured approach.
2025-04-27 15:55:12 -04:00
16a665241e feat: LampScore implement dockerfile generation and image building
- Added `build_dockerfile` function to generate a Dockerfile based on the LAMP stack for the given project.
- Implemented `build_docker_image` to execute the docker build command and create the image.
- Configured user and permissions for apache.
- Included necessary apache configuration for security.
- Added error handling for docker build failures.
- Exposed port 80 for external access.
- Added basic serialization to Config struct.
2025-04-25 14:34:57 -04:00
065e3904b8 Merge pull request 'fix(k8s_anywhere): Ensure k3d cluster is started before use' (#21) from feat/k3d into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/21
Reviewed-by: wjro <wrolleman@nationtech.io>
Reviewed-by: taha <taha@noreply.git.nationtech.io>
2025-04-25 16:46:28 +00:00
22752960f9 fix(k8s_anywhere): Ensure k3d cluster is started before use
- Refactor k3d cluster management to explicitly start the cluster.
- Introduce `start_cluster` function to ensure cluster is running before operations.
- Improve error handling and logging during cluster startup.
- Update `create_cluster` and other related functions to utilize the new startup mechanism.
- Enhance reliability and prevent potential issues caused by an uninitialized cluster.
- Add `run_k3d_command` to handle k3d commands with logging and error handling.
2025-04-25 12:45:02 -04:00
23971ecd7c Merge pull request 'feat: implement k3d cluster management' (#20) from feat/k3d into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/20
Reviewed-by: wjro <wrolleman@nationtech.io>
Reviewed-by: taha <taha@noreply.git.nationtech.io>
2025-04-25 15:33:13 +00:00
fbcd3e4f7f feat: implement k3d cluster management
- Adds functionality to download, install, and manage k3d clusters.
- Includes methods for downloading the latest release, creating clusters, and verifying cluster existence.
- Implements `ensure_k3d_installed`, `get_latest_release_tag`, `download_latest_release`, `is_k3d_installed`, `verify_cluster_exists`, `create_cluster` and `create_kubernetes_client`.
- Provides a `get_client` method to access the Kubernetes client.
- Includes unit tests for download and installation.
- Adds handling for different operating systems.
- Improves error handling and logging.
- Introduces a `K3d` struct to encapsulate k3d cluster management logic.
- Adds the ability to specify the cluster name during K3d initialization.
2025-04-24 17:36:01 -04:00
d307893f15 fix: small-fixes (#19)
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/19
Reviewed-by: johnride <jg@nationtech.io>
Co-authored-by: Taha Hawa <taha@taha.dev>
Co-committed-by: Taha Hawa <taha@taha.dev>
2025-04-24 18:47:47 +00:00
00c0566533 Merge pull request 'feat: introduce Maestro::initialize function that creates the maestro instance and ensure_ready the topology as well. Also refactor all relevant examples to use this new initialize function' (#18) from feat/maestroinitialize into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/18
Reviewed-by: taha <taha@noreply.git.nationtech.io>
2025-04-24 17:43:31 +00:00
f5e3f1aaea feat: Add check.sh helper script to make sure code looks OK before pushing 2025-04-24 13:16:20 -04:00
508b97ca7c chore: Fix more warnings 2025-04-24 13:14:35 -04:00
80bdd0ee8a feat: introduce Maestro::initialize function that creates the maestro instance and ensure_ready the topology as well. Also refactor all relevant examples to use this new initialize function 2025-04-24 12:58:41 -04:00
6c06a4ae07 feat: update ensure_ready to check helm is available (#17)
I want to make sure the changes I'm working on in the ensure_ready don't break anything

Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/17
Reviewed-by: taha <taha@noreply.git.nationtech.io>
Co-authored-by: Willem <wrolleman@nationtech.io>
Co-committed-by: Willem <wrolleman@nationtech.io>
2025-04-24 15:51:28 +00:00
ad1aa897b1 Merge pull request 'chore: Fix all warnings in the project, ignore unused variables mostly' (#16) from chore/warnings into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/16
Reviewed-by: wjro <wrolleman@nationtech.io>
2025-04-24 14:28:14 +00:00
dccc9c04f5 chore: Fix all warnings in the project, ignore unused variables mostly 2025-04-24 10:22:53 -04:00
9345e63a32 fix: couple of changes to get a test working 2025-04-23 15:31:02 -04:00
ff830486af Merge pull request 'fix(cli): remove need for debug in harmony-cli' (#15) from harmony-cli-remove-debug into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/15
Reviewed-by: johnride <jg@nationtech.io>
2025-04-23 18:55:06 +00:00
da83019d85 remove need for debug in harmony-cli 2025-04-23 14:53:36 -04:00
53aa47f91e feat: Initial helm score using helm-wrapper-rs (#14)
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/14
Co-authored-by: Taha Hawa <taha@taha.dev>
Co-committed-by: Taha Hawa <taha@taha.dev>
2025-04-23 18:22:27 +00:00
8f470278a7 Merge pull request 'feat: introduce topology readiness and initialization' (#10) from feat/topologyDependencies into master
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/10
Reviewed-by: taha <taha@noreply.git.nationtech.io>
2025-04-23 15:58:31 +00:00
213fb25686 feat: Use inquire::Confirm instead of raw std::io::Read for K8sAnywhere installation confirmation prompt 2025-04-23 11:56:55 -04:00
45668638e1 feat: TUI does not require Topology to implement Debug anymore 2025-04-23 11:17:03 -04:00
0857aba039 Switch HAClusterTopology for K8sAnywhereTopology in lamp example 2025-04-23 11:08:36 -04:00
452ebc2614 feat: add k3d installation interpret
Adds a new interpret for k3d installation. This includes defining the `K3dInstallationInterpret` struct, implementing the `Interpret` trait for it, and adding the `K3dInstallation` variant to the `InterpretName` enum. The implementation currently contains `todo!()` placeholders for the actual logic.
2025-04-23 10:54:54 -04:00
9e456bb4f5 chore: Refactor DownloadableAsset tests to use httptest instead of a local TcpListener 2025-04-23 10:54:54 -04:00
83ba0e1044 fix: Initialize K3DInstallationScore correctly 2025-04-23 10:54:54 -04:00
2229e9d7af chore: Cargo fmt 2025-04-23 10:54:54 -04:00
15785dd219 feat: download and install k3d latest release
- Implemented functionality to fetch the latest k3d release tag from GitHub.
- Added logic to determine the appropriate binary URL based on the current platform.
- Implemented downloading and saving the binary to a specified directory.
- Included unit tests to verify the download and installation process.
- Added a `K3D_BIN_FILE_NAME` constant for clarity.
- Added logging for better debugging.
2025-04-23 10:54:54 -04:00
847d84b46f wip: Started work on k3d crate 2025-04-23 10:54:54 -04:00
3f6f1fa0d4 wip: Implement basic K8sAnywhere setup with K3d support
- Added initial K8sAnywhere topology and related modules.
- Implemented a basic K3d installation score for cluster bootstrapping.
- Introduced LocalhostTopology for local development and testing.
- Added necessary module structure and dependencies.
- Implemented user prompt for K3d installation confirmation.
- Added basic error handling and logging.
- Refactored existing code to improve modularity and maintainability.
- Included necessary tests to ensure functionality.
2025-04-23 10:54:54 -04:00
6812d05849 feat: Introduce K8sAnywhereTopology and refactor Kubernetes interactions
This commit introduces a new topology, `K8sAnywhereTopology`, designed to handle Kubernetes deployments more flexibly.

Key changes include:

- Introduced `K8sAnywhereTopology` to encapsulate Kubernetes client management and configuration.
- Refactored existing Kubernetes-related code to utilize the new topology.
- Updated `OcK8sclient` to `K8sclient` across modules (k8s, lamp, deployment, resource) for consistency.
- Ensured all relevant modules now interface with Kubernetes through the `K8sclient` trait.

This change promotes a more modular and maintainable codebase for Kubernetes integrations within Harmony.
2025-04-23 10:54:54 -04:00
027114c48c feat: introduce topology readiness and initialization
Adds a `ensure_ready` method to the `Topology` trait to ensure the infrastructure is prepared before score execution.

- Introduces a new `Outcome` status to indicate the result of the readiness check.
- Implements a `topology_preparation_result` field in `Maestro` to track initialization status.
- Adds a check in `interpret` to warn if the topology isn't fully initialized.
- Provides detailed documentation for the `Topology` trait and `ensure_ready` method, including recommended patterns for complex setups.
- Adds `async_trait` dependency.
2025-04-23 10:54:54 -04:00
eeafa086f3 feat: Improve output of tui. From p-r tui-score-info (#11)
WIP: formatted score debug print into a table with a name header and the score information below
Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/11
Reviewed-by: johnride <jg@nationtech.io>
Co-authored-by: Willem <wrolleman@nationtech.io>
Co-committed-by: Willem <wrolleman@nationtech.io>
2025-04-23 14:54:32 +00:00
abd20b96a2 feat: harmony-cli v0.1 #8 (#9)
Co-authored-by: tahahawa <tahahawa@gmail.com>
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/9
Reviewed-by: johnride <jg@nationtech.io>
Co-authored-by: Taha Hawa <taha@taha.dev>
Co-committed-by: Taha Hawa <taha@taha.dev>
2025-04-19 01:13:40 +00:00
0ba7f2536c docs: ADR for Helm Resource implementation style (#12)
Co-authored-by: tahahawa <tahahawa@gmail.com>
Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/12
2025-04-16 17:39:17 +00:00
3097e6af67 Merge branch 'adr/005-interactive-project' 2025-04-11 11:03:16 -04:00
606ea43b51 fix: improve tests and remove unused code
- Corrected XML test data to remove unnecessary `<descr>` tags, resolving failing tests.
- Removed the unused `ratatui_utils` module and its associated code.
- Simplified example in `harmony_tui/src/lib.rs` to use `tokio::main` and register scores directly with `Maestro`. This aligns with the project's evolving structure.
2025-04-11 11:01:05 -04:00
31ae8365a6 docs: add quick demo and core architecture overview
Adds a quick demo command using `cargo run -p example-tui` to launch a minimalist TUI with demo scores.

Also includes a core architecture diagram and overview in the README for better understanding of the project structure.
2025-04-09 16:09:54 -04:00
1cbf4de2a1 adr: proposal serde for score data representation and UI rendering
Decouples score definitions from UI implementations by mandating `serde::Serialize` and `serde::Deserialize` for all `Score` structs. UIs will interact with scores via their serialized representation, enabling scalability and reducing complexity for score authors.

This approach:

- Scales better with new score types and UI targets.
- Simplifies score authoring by removing the need for UI-specific display traits.
- Leverages the `serde` ecosystem for robust data handling.

Adding new field types requires updates to all UIs, a trade-off acknowledged in the ADR.
2025-04-05 14:38:58 -04:00
b4cc5cff4f feat: add serde derive to Score types
This commit adds `serde` dependency and derives `Serialize` trait for `Score` types. This is necessary for serialization and deserialization of these types, which is required to display Scores to various user interfaces

- Added `serde` dependency to `harmony_types/Cargo.toml`.
- Added `serde::Serialize` derive macro to `MacAddress` in `harmony_types/src/lib.rs`.
- Added `serde::Serialize` derive macro to `Config` in `opnsense-config/src/config/config.rs`.
- Added `serde::Serialize` derive macro to `Score` in `harmony_types/src/lib.rs`.
- Added `serde::Serialize` derive macro to `Config` and `Score` in relevant modules.
- Added placeholder `todo!()` implementations for `serialize` methods. These will be implemented in future commits.
2025-04-05 14:36:08 -04:00
ab9b7476a4 feat: add load balancer score and frontend integration
- Implemented `OKDLoadBalancerScore` and integrated it as a `FrontendScore`.
- Added `FrontendScore` trait for TUI displayable scores.
- Implemented `Display` for `OKDLoadBalancerScore`.
- Updated `ScoreListWidget` to handle `FrontendScore` types.
- Included load balancer score in the TUI.
2025-04-03 13:41:29 -04:00
e6384da57e Working on various ADR, cleaning up some stuff 2025-04-03 13:40:46 -04:00
79213ba8d7 feat: implement passthrough for HAClusterTopology traits
This commit completes the refactoring of the `HAClusterTopology` struct to implement all required traits via passthrough to the underlying infrastructure providers.

- Implemented all traits (`DnsServer`, `LoadBalancer`, `HttpServer`, etc.) on `HAClusterTopology`.
- Each trait method now simply calls the corresponding method on the underlying infrastructure provider.
- This ensures that all functionality is delegated to the correct provider without duplicating logic.
- Updated trait implementations to accept `&self` instead of `&mut self` where appropriate.
- Fixed a compilation error in `remove_record` by changing the signature to accept `&self`.
- Added unimplemented!() stubs for HttpServer traits.
2025-04-03 12:20:51 -04:00
8a1627e728 wip: refactoring 2025-04-02 16:52:24 -04:00
fc718f11cf feat: Introduce Topology Trait for Compile-Time Safe Score Binding
Introduce the `Topology` trait to ensure that `Maestro` can compile-time safely bind compatible `Scores` and `Topologies`. This refactoring includes updating `HarmonyTuiEvent`, `ScoreListWidget`, and related structures to work with generic `Topology` types, enhancing type safety and modularity.
2025-04-02 15:51:28 -04:00
f7dc15cbf0 refactor(topology): remove unused HAClusterTopology import
Remove the unnecessary `HAClusterTopology` import from multiple modules to clean up dependencies and reduce clutter. This change does not affect functionality as `HAClusterTopology` is no longer required in these files.
2025-03-31 15:07:16 -04:00
6e9bf3a4be Add more Topology samples with various architectures 2025-03-31 15:02:41 -04:00
fda007f014 feat(topology): generalize Score and Interpret implementations with topology traits
Refactor various `Score` and `Interpret` implementations to utilize generic `Topology` traits, removing hardcoded dependencies on `HAClusterTopology`. This enhancement allows for more flexible and extensible code, accommodating different types of network topologies.
2025-03-26 23:10:51 -04:00
d7897f29c4 feat(orchestration): introduce Interpret trait and refactor score application
Refactor the orchestration process to use an `Interpret` trait instead of directly applying scores. This change introduces a more flexible and extensible design for executing commands associated with different types of topologies. The `CommandScore` and `K8sResourceScore` now implement this trait, providing a clear separation between score definition and execution logic. Update the `Maestro::orchestrate` method to compile scores into interpreters before executing them against their respective topologies.
2025-03-26 16:39:11 -04:00
3962238f0d spike: Working on abstractions, Topology, Score, Capability, Maestro for strong type safety and nice UX/DX 2025-03-25 08:03:45 -04:00