kloudlite / kl

Kloudlite CLI Client
GNU Affero General Public License v3.0
5 stars 1 forks source link

WIP: testing in progress #174

Closed nxtcoder36 closed 1 week ago

nxtcoder36 commented 1 week ago

Summary by Sourcery

Enhance the k3s client by adding a method to delete pods and improve logging for cluster creation. Refactor intercept removal to use JSON patching and update WireGuard configuration settings. Change the K3S image source and version. Introduce a Runfile for managing Docker images.

New Features:

Enhancements:

Build:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This pull request implements several changes to improve the functionality and performance of the K3s cluster management system. Key changes include timing cluster creation, adding pod deletion functionality, updating Wireguard configurations, modifying intercept removal process, and updating container image versions.

Sequence diagram for pod deletion process

sequenceDiagram
    participant User
    participant Client
    participant Spinner
    User->>Client: DeletePods()
    activate Client
    Client->>Spinner: UpdateMessage("deleting pods")
    Client->>Client: runScriptInContainer(script)
    deactivate Client

Class diagram for updated K3s client

classDiagram
    class K3sClient {
        +EnsureImage(i string) error
        +RestartWgProxyContainer() error
        +RemoveAllIntercepts() error
        +DeletePods() error
    }
    class client {
        +CreateClustersTeams(teamName string) error
        +DeletePods() error
        +EnsureK3sServerIsReady() error
        +RemoveAllIntercepts() error
    }

File-Level Changes

Change Details Files
Added timing for cluster creation and ensured K3s server readiness
  • Implemented timing for cluster creation process
  • Added logging of time taken to create cluster when in verbose mode
  • Called EnsureK3sServerIsReady() after cluster creation
k3s/impl.go
Implemented pod deletion functionality
  • Added DeletePods() method to K3sClient interface
  • Implemented DeletePods() function to remove pods from specific namespaces
  • Updated down command to call DeletePods() before stopping containers
k3s/impl.go
k3s/main.go
cmd/k3s/down.go
Updated Wireguard configuration
  • Changed IP address subnet from /24 to /32
  • Added ListenPort and PersistentKeepalive options to WG config
domain/fileclient/context.go
Modified intercept removal process
  • Updated RemoveAllIntercepts() function to use JSON patch instead of full YAML replacement
  • Uncommented code to remove intercepts in env selection and cloning
k3s/impl.go
cmd/clone/env.go
cmd/use/env.go
Updated container image versions and build process
  • Changed K3S image to use a custom build (ghcr.io/kloudlite/kl/k3s:latest)
  • Added Runfile.yml for building and pulling various container images
  • Implemented multi-platform build process for the custom K3s image
constants/main.go
k3s/k3s-base/Runfile.yml

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).