kloudlite / kl

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

k3s app creation expose port updated #163

Closed nxtcoder36 closed 2 weeks ago

nxtcoder36 commented 2 weeks ago

Summary by Sourcery

Enhance the container creation process by conditionally exposing ports based on the development environment flag, ensuring appropriate port bindings for both development and production environments.

Enhancements:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

This pull request updates the k3s app creation process to expose different ports based on the environment (development or production). The main change is in the CreateClustersAccounts function, where the container creation logic is now split into two separate code paths depending on whether the application is running in development mode or not.

Sequence diagram for container creation in different environments

sequenceDiagram
    participant Dev as Development Environment
    participant Prod as Production Environment
    participant Client as Client
    participant Container as Container

    Client->>Dev: Check if in development mode
    alt Development Mode
        Dev->>Container: Create container with ports 6443/tcp and 33820/udp
    else Production Mode
        Prod->>Container: Create container with port 33820/udp
    end

    Container->>Client: Return container creation response
    Client->>Container: Start container

File-Level Changes

Change Details Files
Implement environment-specific container creation
  • Add a conditional statement to check if the application is running in development mode
  • Create separate container configurations for development and production environments
  • Remove the 6443/tcp port exposure in the production environment
  • Keep the 33820/udp port exposed in both environments
pkg/k3s/impl.go
Refactor container creation logic
  • Move the container creation code into separate blocks for development and production
  • Update error handling to be specific to each environment
  • Declare the createdContainer variable outside the conditional blocks
pkg/k3s/impl.go

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. #### 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).