Skip to content

Commit

Permalink
Add DeleteResourceOnFinalize config (flyteorg#184)
Browse files Browse the repository at this point in the history
* Add DeleteResourceOnFinalize config

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>

* Support disabling DeleteResourceOnFinalize per individual k8s plugins

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
  • Loading branch information
EngHabu committed Jun 16, 2021
1 parent 7c143b2 commit f59c245
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ type K8sPluginConfig struct {

// Flyte CoPilot Configuration
CoPilot FlyteCoPilotConfig `json:"co-pilot" pflag:",Co-Pilot Configuration"`

// DeleteResourceOnFinalize instructs the system to delete the resource on finalize. This ensures that no resources
// are kept around (potentially consuming cluster resources). This, however, will cause k8s log links to expire as
// soon as the resource is finalized.
DeleteResourceOnFinalize bool `json:"delete-resource-on-finalize" pflag:",Instructs the system to delete the resource on finalize. This ensures that no resources are kept around (potentially consuming cluster resources). This, however, will cause k8s log links to expire as soon as the resource is finalized."`
}

type FlyteCoPilotConfig struct {
Expand Down

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

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

5 changes: 5 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ type PluginProperties struct {
DisableInjectFinalizer bool
// Specifies the length of TaskExecutionID generated name. default: 50
GeneratedNameMaxLength *int
// DisableDeleteResourceOnFinalize disables deleting the created resource on finalize. That behavior is controllable
// on the base K8sPluginConfig level but can be disabled for individual plugins. Plugins should generally not
// override that behavior unless the resource that gets created for this plugin does not consume resources (cluster's
// cpu/memory... etc. or external resources) once the plugin's Plugin.GetTaskPhase() returns a terminal phase.
DisableDeleteResourceOnFinalize bool
}

// Special context passed in to plugins when checking task phase
Expand Down

0 comments on commit f59c245

Please sign in to comment.