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

Commit

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

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Support disabling DeleteResourceOnFinalize per individual k8s plugins

Signed-off-by: Haytham Abuelfutuh <[email protected]>
  • Loading branch information
EngHabu authored Jun 16, 2021
1 parent 6e4c9c2 commit 6996bb8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/tasks/pluginmachinery/flytek8s/config/config.go
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 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 6996bb8

Please sign in to comment.