Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Flyte Add Enable/Disable Options for Agent Services #420

Merged
merged 10 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/config/subcommand/sandbox/config_flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions cmd/config/subcommand/sandbox/config_flags_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cmd/config/subcommand/sandbox/sandbox_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type Config struct {
// Default value false represents that Flytectl will not use the latest pre-release if it exists.
Prerelease bool `json:"pre" pflag:",Optional. Pre release Version of flyte will be used for sandbox."`

// Agent Service
DisableAgent bool `json:"disable-agent" pflag:",Optional. Disable the agent service."`

// Optionally it is possible to pass in environment variables to sandbox container.
Env []string `json:"env" pflag:",Optional. Provide Env variable in key=value format which can be passed to sandbox container."`

Expand Down
5 changes: 5 additions & 0 deletions pkg/sandbox/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ func startSandbox(ctx context.Context, cli docker.Docker, g github.GHRepoService
sandboxEnv = append(sandboxEnv, "FLYTE_DEV=True")
}

if sandboxConfig.DisableAgent {
sandboxEnv = append(sandboxEnv, "DISABLE_AGENT=True")
}

ID, err := docker.StartContainer(ctx, cli, volumes, exposedPorts, portBindings, docker.FlyteSandboxClusterName,
sandboxImage, sandboxEnv, sandboxConfig.DryRun)

Expand Down Expand Up @@ -393,6 +397,7 @@ func StartDemoCluster(ctx context.Context, args []string, sandboxConfig *sandbox
return err
}
// K3s will automatically write the file specified by this var, which is mounted from user's local state dir.

sandboxConfig.Env = append(sandboxConfig.Env, k3sKubeConfigEnvVar)
err = StartCluster(ctx, args, sandboxConfig, demoImageName, sandboxImagePrefix, exposedPorts, portBindings, util.DemoConsolePort)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/sandbox/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func TestStartFunc(t *testing.T) {
RegistryAuth: "",
Platform: "",
}
config.Dev = true
config.DisableAgent = true
assert.Nil(t, util.SetupFlyteDir())
assert.Nil(t, os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte", "state"), os.ModePerm))
assert.Nil(t, ioutil.WriteFile(docker.Kubeconfig, []byte(content), os.ModePerm))
Expand Down
Loading