Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Flyte CoPilot: Raw container support for all K8s containers #84

Merged
merged 56 commits into from
Jun 23, 2020

Conversation

kumare3
Copy link
Contributor

@kumare3 kumare3 commented May 6, 2020

TL;DR

This PR implements FlyteCoPilot as an optional for all container executions. This is an Alpha feature

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Refer to Design Doc

Tracking Issue

flyteorg/flyte#297

Follow-up issue

flyteorg/flyte#316
flyteorg/flyte#317

@kumare3 kumare3 requested a review from EngHabu May 19, 2020 21:52
@kumare3 kumare3 changed the title Raw container plugin Flyte CoPilot: Raw container support for all K8s containers May 27, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2020

Codecov Report

Merging #84 into master will increase coverage by 3.69%.
The diff coverage is 92.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   56.03%   59.73%   +3.69%     
==========================================
  Files          93       95       +2     
  Lines        4806     5327     +521     
==========================================
+ Hits         2693     3182     +489     
- Misses       1830     1844      +14     
- Partials      283      301      +18     
Impacted Files Coverage Δ
...tasks/pluginmachinery/flytek8s/container_helper.go 80.64% <0.00%> (-2.69%) ⬇️
go/tasks/pluginmachinery/flytek8s/pod_helper.go 59.37% <52.94%> (-3.96%) ⬇️
go/tasks/pluginmachinery/flytek8s/copilot.go 92.85% <92.85%> (ø)
go/tasks/pluginmachinery/utils/literals.go 95.04% <95.04%> (ø)
go/tasks/pluginmachinery/flytek8s/config/config.go 50.00% <100.00%> (+50.00%) ⬆️
...machinery/flytek8s/config/k8spluginconfig_flags.go 46.15% <100.00%> (+12.82%) ⬆️
go/tasks/plugins/k8s/container/container.go 80.48% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f6d312...d106008. Read the comment docs.

Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

definitely need to spend more time reading through/using the code, but let me know if you want an approval just to move forward.

cd copilot; go build -o ../artifacts/flyte-copilot .; cd -

cross_compile:
@glide install
Copy link
Contributor

Choose a reason for hiding this comment

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

wat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what good catch, how did that get in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pre go.mod go i think


Once we know the main container, waiting for it to exit is simple and implemented
Copying data is simple and implemented

Copy link
Contributor

Choose a reason for hiding this comment

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

It is not clear reading this which of the three you went with.


func (d *DownloadOptions) Download(ctx context.Context) error {
if d.remoteOutputsPrefix == "" {
return fmt.Errorf("to-remoute-prefix is required")
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

func (d *DownloadOptions) Download(ctx context.Context) error {
if d.remoteOutputsPrefix == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add eventing to this to emit events to Admin?

Can we emit a timer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes metrics i want to add, but as a second pass

@@ -0,0 +1,365 @@
package data
Copy link
Contributor

Choose a reason for hiding this comment

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

I imagine that the future flytectl will have all this code as well. Maybe this copilot will be a dependency. I can see users wanting to download inputs and outputs to past workflow and task executions to local.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You have absolutely hit a point that I was thinking as well. CoPilot should be part of flytectl?

@@ -0,0 +1,439 @@
package utils
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can move this to flyteidl one day.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes after this gets merged i was going to move this to there and move eventing etc into propeller

@@ -17,6 +25,21 @@ var (
DefaultAnnotations: map[string]string{
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false",
},
CoPilot: FlyteCoPilotConfig{
NamePrefix: "flyte-copilot-",
Image: "docker.pkg.github.com/lyft/flyteplugins/operator:v0.4.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make it so that we have to make two PRs right for every change we want to publish right? The first to make the actual change and the second to update this version. Are we okay with this? I think it's fine, just thought I'd mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, its a config, so you can just change the config for the deployment?

if err != nil {
return err
}
coPilotPod.InitContainers = append(coPilotPod.InitContainers, downloader)
Copy link
Contributor

Choose a reason for hiding this comment

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

Appending will make it the last init container - should we make it the first instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cannot make the first like in case of IAM wait, but IAM wait is injected. Also, we do not really add the data volume to all init containers, thus not sure, if making it earlier has any uses?

copilot/cmd/root.go Outdated Show resolved Hide resolved
return nil
}

func NewUploadCommand(opts *RootOptions) *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, I feel like the uploader, downloader, and sidecar watcher should be different cmds in flytectl. That could get messy too but maybe worth thinking about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no this is not messy at all. I think I agree, I think they should be in flytectl, just that we need to move some code to flyteidl before we do that. What do you think we move ahead and then clean up after the fact. I can drop all the github workflows?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure sure, sounds good.

@wild-endeavor
Copy link
Contributor

just let me know when you want the final +1

wild-endeavor
wild-endeavor previously approved these changes Jun 23, 2020
wild-endeavor
wild-endeavor previously approved these changes Jun 23, 2020
@kumare3 kumare3 merged commit d39837a into master Jun 23, 2020
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.

4 participants