diff --git a/weed/worker/tasks/s3_lifecycle/handler.go b/weed/worker/tasks/s3_lifecycle/handler.go index 3b4aad99f..caaf125b7 100644 --- a/weed/worker/tasks/s3_lifecycle/handler.go +++ b/weed/worker/tasks/s3_lifecycle/handler.go @@ -143,6 +143,15 @@ func (h *Handler) Descriptor() *plugin_pb.JobTypeDescriptor { }, }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ + // On by default: S3 lifecycle is a standard bucket feature + // (PutBucketLifecycleConfiguration is part of the S3 API), + // and a bucket with rules set but no worker running silently + // retains data past its declared expiration. Operators who + // want the worker off can still disable it in the admin UI; + // the default error is "data lingers" not "worker burns CPU + // on empty rule sets" (the worker fast-exits with no + // configured rules). + Enabled: true, DetectionIntervalMinutes: 24 * 60, // daily DetectionTimeoutSeconds: 60, MaxJobsPerDetection: 1, diff --git a/weed/worker/tasks/s3_lifecycle/handler_test.go b/weed/worker/tasks/s3_lifecycle/handler_test.go index 1ea8331fc..5ed1beca4 100644 --- a/weed/worker/tasks/s3_lifecycle/handler_test.go +++ b/weed/worker/tasks/s3_lifecycle/handler_test.go @@ -348,6 +348,20 @@ func TestDescriptor_AdminRuntimeDefaultsDailyCadence(t *testing.T) { assert.Equal(t, int32(1), d.AdminRuntimeDefaults.MaxJobsPerDetection) } +func TestDescriptor_AdminRuntimeDefaultsEnabledByDefault(t *testing.T) { + // S3 lifecycle is a standard bucket feature — operators set + // PutBucketLifecycleConfiguration expecting it to actually fire. + // Default-off would silently retain data past declared expiration + // until an operator notices and flips it on. Document the choice + // here so a future change to disabled-by-default fails the test + // and surfaces a conscious revisit. + h := NewHandler(nil) + d := h.Descriptor() + require.NotNil(t, d.AdminRuntimeDefaults) + assert.True(t, d.AdminRuntimeDefaults.Enabled, + "s3_lifecycle defaults must enable the scheduler so configured rules fire without operator opt-in") +} + // ---------- Execute ---------- // recordingExecSender captures Execute-side messages. The Execute path