Skip to content

Commit

Permalink
Only create copilot sidecars if interface requires (flyteorg#314)
Browse files Browse the repository at this point in the history
* not creating sidecar uploader or downloader unnecessarily

Signed-off-by: Daniel Rammer <[email protected]>

* check on nil map is unnecessary

Signed-off-by: Daniel Rammer <[email protected]>

---------

Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Feb 9, 2023
1 parent 699e4aa commit 86b6b2d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions flyteplugins/go/tasks/pluginmachinery/flytek8s/copilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func AddCoPilotToContainer(ctx context.Context, cfg config.FlyteCoPilotConfig, c
c.SecurityContext.Capabilities.Add = append(c.SecurityContext.Capabilities.Add, pTraceCapability)

if iFace != nil {
if iFace.Inputs != nil {
if iFace.Inputs != nil && len(iFace.Inputs.Variables) > 0 {
inPath := cfg.DefaultInputDataPath
if pilot.GetInputPath() != "" {
inPath = pilot.GetInputPath()
Expand All @@ -187,7 +187,7 @@ func AddCoPilotToContainer(ctx context.Context, cfg config.FlyteCoPilotConfig, c
})
}

if iFace.Outputs != nil {
if iFace.Outputs != nil && len(iFace.Outputs.Variables) > 0 {
outPath := cfg.DefaultOutputPath
if pilot.GetOutputPath() != "" {
outPath = pilot.GetOutputPath()
Expand All @@ -210,7 +210,7 @@ func AddCoPilotToPod(ctx context.Context, cfg config.FlyteCoPilotConfig, coPilot
shareProcessNamespaceEnabled := true
coPilotPod.ShareProcessNamespace = &shareProcessNamespaceEnabled
if iFace != nil {
if iFace.Inputs != nil {
if iFace.Inputs != nil && len(iFace.Inputs.Variables) > 0 {
inPath := cfg.DefaultInputDataPath
if pilot.GetInputPath() != "" {
inPath = pilot.GetInputPath()
Expand Down Expand Up @@ -240,7 +240,7 @@ func AddCoPilotToPod(ctx context.Context, cfg config.FlyteCoPilotConfig, coPilot
coPilotPod.InitContainers = append(coPilotPod.InitContainers, downloader)
}

if iFace.Outputs != nil {
if iFace.Outputs != nil && len(iFace.Outputs.Variables) > 0 {
outPath := cfg.DefaultOutputPath
if pilot.GetOutputPath() != "" {
outPath = pilot.GetOutputPath()
Expand Down Expand Up @@ -268,7 +268,6 @@ func AddCoPilotToPod(ctx context.Context, cfg config.FlyteCoPilotConfig, coPilot
}
coPilotPod.Containers = append(coPilotPod.Containers, sidecar)
}

}

return nil
Expand Down

0 comments on commit 86b6b2d

Please sign in to comment.