Skip to content

Commit a0b2162

Browse files
committed
Revert "feat: support granular aggressive mode config (#458)"
This reverts commit 83288cf.
1 parent 1ffcdfd commit a0b2162

File tree

5 files changed

+5
-44
lines changed

5 files changed

+5
-44
lines changed

castai/data_source_resource_rebalancing_schedule_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ func TestRebalancingScheduleDataSourceRead(t *testing.T) {
5050
"evictGracefully": false,
5151
"aggressiveMode": false,
5252
"aggressiveModeConfig": {
53-
"ignoreLocalPersistentVolumes": true,
54-
"ignoreProblemJobPods": true,
55-
"ignoreProblemRemovalDisabledPods": true,
56-
"ignoreProblemPodsWithoutController": true
53+
"ignoreLocalPersistentVolumes": true
5754
}
5855
},
5956
"numTargetedNodes": 20,
@@ -134,9 +131,6 @@ launch_configuration.# = 1
134131
launch_configuration.0.aggressive_mode = false
135132
launch_configuration.0.aggressive_mode_config.# = 1
136133
launch_configuration.0.aggressive_mode_config.0.ignore_local_persistent_volumes = true
137-
launch_configuration.0.aggressive_mode_config.0.ignore_problem_job_pods = true
138-
launch_configuration.0.aggressive_mode_config.0.ignore_problem_pods_without_controller = true
139-
launch_configuration.0.aggressive_mode_config.0.ignore_problem_removal_disabled_pods = true
140134
launch_configuration.0.execution_conditions.# = 1
141135
launch_configuration.0.execution_conditions.0.achieved_savings_percentage = 15
142136
launch_configuration.0.execution_conditions.0.enabled = true

castai/resource_rebalancing_schedule.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,7 @@ func resourceRebalancingSchedule() *schema.Resource {
131131
"ignore_local_persistent_volumes": {
132132
Type: schema.TypeBool,
133133
Required: true,
134-
Description: "Rebalance workloads that use local-path Persistent Volumes. THIS WILL RESULT IN DATA LOSS.",
135-
},
136-
"ignore_problem_job_pods": {
137-
Type: schema.TypeBool,
138-
Required: true,
139-
Description: "Pods spawned by Jobs or CronJobs will not prevent the Rebalancer from deleting a node on which they run. WARNING: When true, pods spawned by Jobs or CronJobs will be terminated if the Rebalancer picks a node that runs them. As such, they are likely to lose their progress.",
140-
},
141-
"ignore_problem_removal_disabled_pods": {
142-
Type: schema.TypeBool,
143-
Required: true,
144-
Description: `Pods that are marked with "removal disabled" will not prevent the Rebalancer from deleting a node on which they run. WARNING: When true, such pods will be evicted and disrupted.`,
145-
},
146-
"ignore_problem_pods_without_controller": {
147-
Type: schema.TypeBool,
148-
Required: true,
149-
Description: "Pods that don't have a controller (bare pods) will not prevent the Rebalancer from deleting a node on which they run. WARNING: When true, such pods might not restart, since they have no controller to do it.",
134+
Description: "Rebalance workloads using local-path Persistent Volumes. THIS WILL RESULT IN DATA LOSS.",
150135
},
151136
},
152137
},
@@ -329,10 +314,7 @@ func stateToSchedule(d *schema.ResourceData) (*sdk.ScheduledrebalancingV1Rebalan
329314
aggressiveModeConfigSection := launchConfigurationData["aggressive_mode_config"].([]any)
330315
if len(aggressiveModeConfigSection) != 0 {
331316
aggressiveModeConfig = &sdk.ScheduledrebalancingV1AggressiveModeConfig{
332-
IgnoreLocalPersistentVolumes: lo.ToPtr(aggressiveModeConfigSection[0].(map[string]any)["ignore_local_persistent_volumes"].(bool)),
333-
IgnoreProblemJobPods: lo.ToPtr(aggressiveModeConfigSection[0].(map[string]any)["ignore_problem_job_pods"].(bool)),
334-
IgnoreProblemRemovalDisabledPods: lo.ToPtr(aggressiveModeConfigSection[0].(map[string]any)["ignore_problem_removal_disabled_pods"].(bool)),
335-
IgnoreProblemPodsWithoutController: lo.ToPtr(aggressiveModeConfigSection[0].(map[string]any)["ignore_problem_pods_without_controller"].(bool)),
317+
IgnoreLocalPersistentVolumes: lo.ToPtr(aggressiveModeConfigSection[0].(map[string]any)["ignore_local_persistent_volumes"].(bool)),
336318
}
337319
}
338320

@@ -381,10 +363,7 @@ func scheduleToState(schedule *sdk.ScheduledrebalancingV1RebalancingSchedule, d
381363
if schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig != nil {
382364
launchConfig["aggressive_mode_config"] = []map[string]any{
383365
{
384-
"ignore_local_persistent_volumes": schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig.IgnoreLocalPersistentVolumes,
385-
"ignore_problem_job_pods": schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig.IgnoreProblemJobPods,
386-
"ignore_problem_removal_disabled_pods": schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig.IgnoreProblemRemovalDisabledPods,
387-
"ignore_problem_pods_without_controller": schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig.IgnoreProblemPodsWithoutController,
366+
"ignore_local_persistent_volumes": schedule.LaunchConfiguration.RebalancingOptions.AggressiveModeConfig.IgnoreLocalPersistentVolumes,
388367
},
389368
}
390369
}

castai/resource_rebalancing_schedule_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ func TestAccResourceRebalancingSchedule_basic(t *testing.T) {
3131
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "schedule.0.cron", "1 4 * * *"),
3232
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.aggressive_mode", "true"),
3333
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.aggressive_mode_config.0.ignore_local_persistent_volumes", "true"),
34-
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.aggressive_mode_config.0.ignore_problem_job_pods", "true"),
35-
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.aggressive_mode_config.0.ignore_problem_removal_disabled_pods", "true"),
36-
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.aggressive_mode_config.0.ignore_problem_pods_without_controller", "true"),
3734
),
3835
},
3936
{
@@ -101,9 +98,6 @@ resource "castai_rebalancing_schedule" "test" {
10198
aggressive_mode = true
10299
aggressive_mode_config {
103100
ignore_local_persistent_volumes = true
104-
ignore_problem_job_pods = true
105-
ignore_problem_removal_disabled_pods = true
106-
ignore_problem_pods_without_controller = true
107101
}
108102
selector = jsonencode({
109103
nodeSelectorTerms = [{

docs/data-sources/rebalancing_schedule.md

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

docs/resources/rebalancing_schedule.md

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

0 commit comments

Comments
 (0)