Skip to content

Instantly share code, notes, and snippets.

@marcosnils
Created November 14, 2024 21:47
Show Gist options
  • Save marcosnils/0806e0203c7c1fa5f8916d9c2b7e3705 to your computer and use it in GitHub Desktop.
Save marcosnils/0806e0203c7c1fa5f8916d9c2b7e3705 to your computer and use it in GitHub Desktop.
gen3 dagger k3s helm example
package main
import (
"context"
"dagger/gen-3/internal/dagger"
)
type Gen3 struct{}
// Returns a container that echoes whatever string argument is provided
func (m *Gen3) Service(ctx context.Context) *dagger.Container {
k3s := dag.K3S("gen3")
k3s.Server().Start(ctx)
return dag.Container().From("alpine/helm").
WithWorkdir("/app").
WithExec([]string{"apk", "add", "kubectl"}).
WithEnvVariable("KUBECONFIG", "/.kube/config").
WithFile("/.kube/config", k3s.Config()).
WithExec([]string{"helm", "upgrade", "--repo", "https://helm.gen3.org", "--install", "gen3", "gen3"})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment