Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Pre-render Helm Kloudlite-agent and optimize Wireguard setup#380

Merged
nxtcoder17 merged 2 commits into
release-v1.0.8from
fix/installation-with-rendered-yamls
Oct 8, 2024
Merged

Pre-render Helm Kloudlite-agent and optimize Wireguard setup#380
nxtcoder17 merged 2 commits into
release-v1.0.8from
fix/installation-with-rendered-yamls

Conversation

@nxtcoder17
Copy link
Copy Markdown
Member

@nxtcoder17 nxtcoder17 commented Oct 8, 2024

feat:

- pre-rendering of helm/kloudlite-agent with values, with provides superfast installation on your local dev cluster
- while creating a global vpn cluster connection (aka Gateway), wireguard secrets are pre-created, and distributed with edge peers. Previously, it used to happen when `infra-api` received a status update from agent. It should ideally, reduce the initial wireguard connection time.

updates:

- updates flakes to latest
- bumps golang and toolings to v1.23
- `go pkg: gqlgen` to latest
- `go pkg: controller-runtime` to latest

Summary by Sourcery

Enhance the installation process by pre-rendering Helm charts for faster deployment and optimize global VPN connections by pre-creating WireGuard secrets. Update Go dependencies and refactor AWS-related code for consistency. Upgrade the Go version in the build configuration.

New Features:

  • Introduce pre-rendering of Helm charts for the kloudlite-agent, allowing faster installation on local development clusters.
  • Implement pre-creation and distribution of WireGuard secrets for global VPN cluster connections, reducing initial connection time.

Enhancements:

  • Update various Go packages and dependencies to their latest versions, including gqlgen, controller-runtime, and others.
  • Refactor AWS-related code to use consistent naming conventions, such as changing 'Aws' to 'AWS'.

Build:

  • Bump the Go version to 1.23 in the build configuration.

It will ensure superfast installation of kloudlite-agent, at least on
local clusters

updates NIX flakes to latest
Bumps go to v1.23
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Oct 8, 2024

Reviewer's Guide by Sourcery

This pull request introduces several significant changes to the Kloudlite API project, including updates to Go dependencies, refactoring of code related to AWS and GCP services, improvements to the Helm chart rendering process, and various other enhancements and bug fixes.

Updated class diagram for AWS and GCP services

classDiagram
    class CheckAWSAccessOutput {
        bool Result
        string InstallationURL
    }

    class GithubComKloudliteAPIAppsInfraInternalEntitiesAWSAssumeRoleParams {
        string AWSAccountID
        string CfParamTrustedArn
        string ExternalID
        string RoleArn
    }

    class GithubComKloudliteAPIAppsInfraInternalEntitiesAWSSecretCredentials {
        GithubComKloudliteAPIAppsInfraInternalEntitiesAWSAssumeRoleParams AssumeRoleParams
        GithubComKloudliteOperatorApisClustersV1AWSAuthMechanism AuthMechanism
        GithubComKloudliteAPIAppsInfraInternalEntitiesAWSAuthSecretKeys AuthSecretKeys
        string CfParamInstanceProfileName
        string CfParamRoleName
    }

    class GithubComKloudliteOperatorApisClustersV1AWSClusterConfig {
        GithubComKloudliteOperatorApisClustersV1AWSCredentials Credentials
        GithubComKloudliteOperatorApisClustersV1AWSK3sMastersConfig K3sMasters
        map NodePools
        string Region
        map SpotNodePools
        GithubComKloudliteOperatorApisClustersV1AWSVPCParams Vpc
    }

    class GithubComKloudliteOperatorApisClustersV1GCPClusterConfig {
        GithubComKloudliteOperatorApisCommonTypesSecretRef CredentialsRef
        string GCPProjectID
        GithubComKloudliteOperatorApisClustersV1GCPMasterNodesConfig MasterNodes
        string Region
        GithubComKloudliteOperatorApisClustersV1GCPServiceAccount ServiceAccount
        GithubComKloudliteOperatorApisClustersV1GCPVPCParams Vpc
    }

    class GithubComKloudliteOperatorApisClustersV1AWSAuthMechanism {
        <<enumeration>>
        assume_role
        secret_keys
    }

    class GithubComKloudliteOperatorApisCommonTypesCloudProvider {
        <<enumeration>>
        AWS
        Azure
        Digitalocean
        GCP
    }

    GithubComKloudliteAPIAppsInfraInternalEntitiesAWSSecretCredentials --> GithubComKloudliteAPIAppsInfraInternalEntitiesAWSAssumeRoleParams
    GithubComKloudliteOperatorApisClustersV1AWSClusterConfig --> GithubComKloudliteOperatorApisClustersV1AWSCredentials
    GithubComKloudliteOperatorApisClustersV1GCPClusterConfig --> GithubComKloudliteOperatorApisCommonTypesSecretRef
    GithubComKloudliteOperatorApisClustersV1AWSClusterConfig --> GithubComKloudliteOperatorApisClustersV1AWSVPCParams
    GithubComKloudliteOperatorApisClustersV1GCPClusterConfig --> GithubComKloudliteOperatorApisClustersV1GCPVPCParams
    GithubComKloudliteOperatorApisClustersV1AWSAuthMechanism <|-- GithubComKloudliteAPIAppsInfraInternalEntitiesAWSSecretCredentials
    GithubComKloudliteOperatorApisCommonTypesCloudProvider <|-- GithubComKloudliteOperatorApisClustersV1AWSClusterConfig
    GithubComKloudliteOperatorApisCommonTypesCloudProvider <|-- GithubComKloudliteOperatorApisClustersV1GCPClusterConfig
Loading

File-Level Changes

Change Details Files
Updated Go version and dependencies
  • Upgraded Go version from 1.21.1 to 1.23
  • Updated various Go package dependencies to their latest versions
  • Bumped golang and toolings to v1.23
go.mod
flake.nix
Refactored AWS and GCP related code
  • Renamed 'Aws' to 'AWS' and 'Gcp' to 'GCP' in various struct and function names for consistency
  • Updated field names in models to use 'AWS' and 'GCP' instead of 'Aws' and 'Gcp'
  • Modified resolvers to use the new naming convention
apps/infra/internal/app/graph/model/models_gen.go
apps/infra/internal/app/graph/cloudprovidersecret.resolvers.go
apps/infra/internal/app/graph/schema.resolvers.go
Implemented Helm chart rendering functionality
  • Added new function RenderHelmKloudliteAgent to render Helm charts for Kloudlite agent
  • Introduced a new Helm client package for interacting with Helm charts
  • Added a new HTTP endpoint for rendering Helm charts
apps/infra/internal/domain/byok-clusters.go
apps/infra/internal/app/app.go
pkg/helm/client.go
pkg/helm/types.go
Enhanced Global VPN connection handling
  • Added functionality to generate and store Wireguard keys for Global VPN connections
  • Updated the createGlobalVPNConnection function to include new Wireguard-related fields
  • Modified the Gateway struct to include new fields related to Wireguard configuration
apps/infra/internal/domain/global-vpn-cluster-connection.go
apps/infra/internal/domain/templates/gateway/deployment.yml.tpl
Improved error handling and logging
  • Added option to suppress gRPC server logs
  • Updated error handling in various functions
  • Removed deprecated warning handler in k8s client initialization
pkg/grpc/server.go
pkg/k8s/client.go
Miscellaneous improvements and bug fixes
  • Updated protobuf-generated files
  • Modified Taskfile.yml to run in dev mode by default
  • Added new template file for cluster gateway deployment
  • Updated various function signatures and parameter names for consistency
apps/infra/protobufs/infra/infra.pb.go
apps/infra/protobufs/infra/infra_grpc.pb.go
apps/infra/Taskfile.yml
apps/infra/internal/domain/templates/embed.go
apps/infra/internal/domain/clusters.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.
  • 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 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

@nxtcoder17 nxtcoder17 self-assigned this Oct 8, 2024
@nxtcoder17 nxtcoder17 changed the title Fix/installation with rendered yamls @sourcery-ai Oct 8, 2024
@sourcery-ai sourcery-ai Bot changed the title @sourcery-ai Pre-render Helm Kloudlite-agent and optimize Wireguard setup Oct 8, 2024
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder17 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

return fn.JsonConvertP[model.GithubComKloudliteAPIAppsInfraInternalEntitiesAWSSecretCredentials](obj.AWS)
// AWS is the resolver for the aws field.
func (r *cloudProviderSecretResolver) AWS(ctx context.Context, obj *entities.CloudProviderSecret) (*model.GithubComKloudliteAPIAppsInfraInternalEntitiesAWSSecretCredentials, error) {
panic(fmt.Errorf("not implemented: AWS - aws"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Replace panic calls with proper error handling in resolver functions

Using panic in these resolver functions can lead to runtime crashes if these functions are called. Instead, implement proper error handling and return appropriate errors. This will make the code more robust and easier to debug.

@nxtcoder17 nxtcoder17 merged commit 1d195c3 into release-v1.0.8 Oct 8, 2024
@nxtcoder17 nxtcoder17 deleted the fix/installation-with-rendered-yamls branch October 8, 2024 03:29
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Pre-render Helm Kloudlite-agent and optimize Wireguard setup
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant