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

Commit 6996bb8

Browse files
authored
Add DeleteResourceOnFinalize config (#184)
* 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>
1 parent 6e4c9c2 commit 6996bb8

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

go/tasks/pluginmachinery/flytek8s/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ type K8sPluginConfig struct {
100100

101101
// Flyte CoPilot Configuration
102102
CoPilot FlyteCoPilotConfig `json:"co-pilot" pflag:",Co-Pilot Configuration"`
103+
104+
// DeleteResourceOnFinalize instructs the system to delete the resource on finalize. This ensures that no resources
105+
// are kept around (potentially consuming cluster resources). This, however, will cause k8s log links to expire as
106+
// soon as the resource is finalized.
107+
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."`
103108
}
104109

105110
type FlyteCoPilotConfig struct {

go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags_test.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/tasks/pluginmachinery/k8s/plugin.go

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

5156
// Special context passed in to plugins when checking task phase

0 commit comments

Comments
 (0)