S3lock#137
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What does this PR do?
This PR bundles three new operator capabilities plus several supporting fixes
and API/doc improvements. The features are independent but share generated CRDs
and webhook plumbing.
1. S3 Object Lock (WORM) end-to-end
Configurable, validated S3 Object Lock support spanning grid → tenant → bucket.
StorageGrid.status.s3ObjectLockAvailable— operator probesGET /grid/compliance-globaland surfaces grid-wide capability(pkg/grid/objectlock.go,
internal/controller/storagegrid_controller.go).
S3ObjectLockSupportedcondition.S3Tenant/S3TenantAccount:spec.s3ObjectLock = { mode, maxRetentionInDays }defines the per-tenant ceiling (Disabled < Governance < Compliance) and the
cap on bucket retention.
modedefaults toDisabled,maxRetentionInDaysdefaults to0(forces user to choose explicitly).S3Bucket:spec.s3ObjectLock = { mode, retentionInDays }configures thedefault retention applied to new objects (existing objects keep their
prior settings — documented on the field).
(internal/webhook/objectlock_validation.go,
s3bucket_webhook.go,
s3tenant_webhook.go,
s3tenantAccount_webhook.go):
StorageGrid.status.s3ObjectLockAvailable=true.modeormaxRetentionInDaysis rejected if any ownedbucket would be left in violation.
test/e2e/chainsaw/s3bucket/governance/chainsaw-test.yaml.
2. S3 Bucket Lifecycle Management
Operator-managed bucket lifecycle with drift detection.
S3Bucket.spec.lifecycleManagement = { expirationInDays }(defaults to
{expirationInDays: 0}= lifecycle disabled / removed).expirationInDays > 0maps to a single S3Expiration.Daysrule appliedvia the bucket's S3 endpoint (pkg/s3/lifecycle.go).
Status.LastAppliedLifecyclefingerprint for drift detection; reconcilere-applies on drift.
LifecycleSyncedcondition; warning event emitted on versioned bucketsnoting that noncurrent versions are not removed by
Expiration.Days.test/e2e/chainsaw/s3bucket/lifecycle/chainsaw-test.yaml.
3. Connection-Details Secret synthesis
Crossplane-style mountable Secret for
S3BucketandS3Access.spec.connectionDetails = { mode, destinationSecret }onS3Bucketand
S3Access.mode: All(default) projects credentials + endpoint infointo AWS-style env keys;
mode: Disabledopts out.Status.ConnectionDetailsSecretReftracks the actually-deployed Secretname so renames and
Disabledtransitions clean up the previous Secret.S3Bucketand anS3Accessshare the same name in a namespace:s3bucket-<name>-connection-detailss3access-<name>-connection-detailsBuildConnectionDetailsData— assembles the AWS-style key/value map.ReconcileOwnedSecret— creates/updates an owned Secret, derives labelsfrom the owner GVK via the scheme, adopts orphan Secrets (no
controllerRef), and rejects foreign-controlled Secrets with
ErrSecretNotOwned(surfaced asOwnershipConflictevent + condition).DeleteOwnedSecret— idempotent name-based cleanup.S3EndpointConfig.URLandS3EndpointConfig.Protocol(defaulthttps)populated by the operator so consumers don't re-compose the endpoint URL.
test/e2e/chainsaw/s3bucket/connection-details/chainsaw-test.yaml.
Supporting fixes & polish
fix(s3tenant):maxRetentionInDaysdefaults to0so users mustexplicitly opt in to a retention ceiling (avoids surprising defaults).
chore(apidoc): improved kubebuilder doc comments across types for betterkubectl explain/ IDE tooltips.make generate manifests.Why is this change needed?
native APIs, with safety rails so users can't construct invalid grid/tenant/
bucket combinations.
aws s3api put-bucket-lifecycle-…step and keeps configuration declarative + drift-corrected.
can now
envFrom: - secretRef:a single Secret to gain S3 access.Related Issues
Type of Change
S3Bucket.spec.retentionInDaysremoved)Conventional Commit Format
Suggested PR title:
Included commits:
feat: introduce s3objectLock API to configure and manage wormfeat: introduce bucket lifecycle managementfeat(bucket/access): introduce connectiondetailsfix: include kind in secretnamechore(apidoc): improve tooltipsfix(s3tenant): set default maxRetention to 0 to force user to set something they needTesting Checklist
Test commands run:
E2E suites added:
— Object Lock matrix (grid/tenant/bucket mode validation, retention caps,
downgrade rejection).
— set / change / clear lifecycle, drift re-apply, versioned-bucket warning
event.
— default mode, rename via
destinationSecret, opt out, re-enable,ownership conflict.
Documentation Checklist
(s3_v1alpha1_s3bucket.yaml,
s3_v1alpha1_s3access.yaml,
s3_v1alpha1_s3tenant.yaml)
make generate manifestsSecurity Checklist
caps, downgrade safety)
Breaking Changes
Does this PR introduce breaking changes?
Migration:
S3Bucket.spec.retentionInDays→S3Bucket.spec.s3ObjectLock.retentionInDays(and set
s3ObjectLock.modetoGovernanceorComplianceto match priorintent). Existing buckets without the new field default to
Disabled.Users who previously relied on
retentionInDays > 0must update theirmanifests before applying.
spec.s3ObjectLock.maxRetentionInDays(default is0, which forbids anybucket retention).