Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to run (some) components as native processes #1205

Closed
krancour opened this issue Dec 1, 2023 · 5 comments
Closed

option to run (some) components as native processes #1205

krancour opened this issue Dec 1, 2023 · 5 comments

Comments

@krancour
Copy link
Member

krancour commented Dec 1, 2023

Before we lose track of it...

In a conversation with @rbreeze earlier today, we talked about using a process manager like goreman to make it easier to build and run Kargo components from source as native processes.

Look before we leap..

There are some considerations here:

Kargo's always going to have a dependency on k8s. Running Kargo components natively outside a cluster -- which could be remote for all we care -- offers a speed advantage.

On the flip side -- we'll never be able to get the webhook server working a a native process, because it needs to be accessible to the k8s cluster's own API server. If forced to run at least one component in the cluster, why not run them all in the cluster?

Last, the UI in particular would benefit tremendously from (optionally) being run as a native process. There is no way the Kargo container image can ever be rebuilt as fast as vite can hot reload modified UI code. Maybe this is the main problem to solve for.

@jessesuen
Copy link
Member

I will push for this. I already do all my development by running kargo controller and API server with go run. I think it's the easiest/fastest development workflow and is especially helpful when I need to step through code with an IDE.

You're right that webhook is not possible to do without something like telepresence proxying back requests to desktop, but for API and controller work, it works wonderfully.

@jessesuen
Copy link
Member

jessesuen commented Dec 1, 2023

In case it helps others, here's how I start kargo in VSCode. We'd need the same env var conveniences for the goreman script.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "api-server",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/cmd/controlplane",
            "args": [
                "api"
            ],
            "env": {
                "UI_DIR": "${workspaceFolder}/ui/build",
                "LOG_LEVEL": "DEBUG",
                "KUBECONFIG": "/Users/jesse/.kube/config",
                //"DEX_ENABLED": "true",
                //"DEX_SERVER_ADDRESS": "http://localhost/dex",
                "ARGOCD_KUBECONFIG": "/Users/jesse/.kube/config",
                "ADMIN_ACCOUNT_TOKEN_SIGNING_KEY": "abc123",
                "ADMIN_ACCOUNT_TOKEN_AUDIENCE": "localhost",
                "ADMIN_ACCOUNT_TOKEN_ISSUER": "localhost",
                "ADMIN_ACCOUNT_PASSWORD_HASH": "$2y$10$jtazu6KuiZkZRdsCMMpQRufL/V46xQilgOo/tmrzHvJT8ndPDWK8i",
                "ADMIN_ACCOUNT_ENABLED": "true",
                "ARGOCD_URLS": "foo=https://argocd.com,bar=https://bar.com",
                "ADMIN_ACCOUNT_TOKEN_TTL": "8760h",
            }
        },
        {
            "name": "controller",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/cmd/controlplane",
            "args": [
                "controller"
            ],
            "env": {
                "UI_DIR": "${workspaceFolder}/ui/build",
                "KUBECONFIG": "/Users/jesse/.kube/config",
                // "DEX_ENABLED": "true",
                // "DEX_SERVER_ADDRESS": "http://localhost/dex",
                "ARGOCD_KUBECONFIG": "/Users/jesse/.kube/config",
                "LOG_LEVEL": "DEBUG",
            }
        }
    ]
}

Copy link

This issue has been automatically marked as stale because it had no activity for 90 days. It will be closed if no activity occurs in the next 30 days but can be reopened if it becomes relevant again.

@github-actions github-actions bot added the stale label Feb 29, 2024
@krancour
Copy link
Member Author

I'm dropping the stale label, but will also mention that since #1248, developing with all components running in a local cluster has become significantly less painful.

Binaries for back end components now compile on the host and Tilt shims them into the already-running pods. This speeds up restarts enormously because compilations use the host's Go build cache and running pods don't have to be replaced.

Something similar happens for the UI. Tilt runs Vite inside a pod so that UI changes are hot-reloaded the same as they would be if Vite was running on the host.

Anyone who may have been waiting for progress on this issue might also want to see what kind of mileage they get out of developing in a local cluster since these changes.

@rbreeze
Copy link
Contributor

rbreeze commented Apr 3, 2024

Closing now that we can run Controller and API locally as of #1738

@rbreeze rbreeze closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants