-
Notifications
You must be signed in to change notification settings - Fork 83
Start sandbox logic shared for demo/sandbox cmds #minor #326
Start sandbox logic shared for demo/sandbox cmds #minor #326
Conversation
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
0e66e01
to
b1fee69
Compare
Codecov Report
@@ Coverage Diff @@
## master #326 +/- ##
==========================================
- Coverage 70.03% 69.48% -0.56%
==========================================
Files 138 139 +1
Lines 4933 4824 -109
==========================================
- Hits 3455 3352 -103
- Misses 1221 1230 +9
+ Partials 257 242 -15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM . Please update on the test results and we can get this checkedin.
pkg/sandbox/config.go
Outdated
import "github.com/flyteorg/flytectl/pkg/docker" | ||
|
||
//Config holds configuration flags for sandbox command. | ||
type Config struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern used in flytectl is to define all configs for the subcommands in the config;/subcommand/
Can we keep the same structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmahindrakar-oss my motivation for moving this struct here is that I made this part of the inputs to some of the functions in pgk/sandbox
. As shown in the signatures below
func StartCluster(ctx context.Context, args []string, sandboxConfig *Config, primePod bool, defaultImageName string)
func StartDemoCluster(ctx context.Context, args []string, sandboxConfig *Config)
what do you think it is better?
- just pass all of this fields directly into these functions
- define this config in config/subcommand and then import it in pkg/sanbox? ( I wonder if this might cause an import loop)
- create another struct essentially with the same fields. Maybe we can embed these structs together?
// embeding Config in CLIConfig
// lives in cmd/config/subcommand
type CLIConfig struct {
// sandbox.Config
Config
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option 2 & 3 should be good.
For the option 2 . I dont see an import loop issue since
subcommand is only imported in cmd module
pkg is imported in cmd module
here you are introducing a dependency from subcommand -> pkg which should be fine.
Option 3 might lead to issue with pflag generation though as embedded struct may not be supported but you can check.
Signed-off-by: David Przybilla <[email protected]>
bd7a03e
to
ac1e01d
Compare
Signed-off-by: David Przybilla <[email protected]>
Signed-off-by: David Przybilla <[email protected]>
codecov looks very sad now. I was thinking on a struct/interface like:
and then we would be able to mock and tests what values other functions pass |
Yes we can do the tests as followup.Thanks for making this change |
TL;DR
Logic for start sandbox and demo is redudant. This PR unifies start logic under a pkg/sandbox package
Type
Are all requirements met?
Complete description
As tracking issue describes there is a lot of repeated logic between
sandbox
anddemo
commands. This PR unifies the logic for starting a sandbox under a new packagepkg/sandbox
. Upcoming Prs will addressteardown
and other subcommands.This PR:
pkg/sandbox
Config
forsandbox
now lives inpkg/sandbox
ImagePullPolicy
andImagePullOptions
are part ofpkg/docker
StartDemoCluster
andStartSandboxCluster
which rely on callingStartCluster
with needed params for each particular caseWhats next?
In other batch of work/PR:
Tracking Issue
flyteorg/flyte#2472