Skip to content

fix(objectstore): S3 e2e failures from run 45100042373 - #962

Open
mxsrc wants to merge 6 commits into
mainfrom
fix/s3-e2e-failures
Open

mxsrc wants to merge 6 commits into
mainfrom
fix/s3-e2e-failures

Conversation

@mxsrc

@mxsrc mxsrc commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the product-side causes of the S3 e2e failures in run 45100042373, where 8 of 18 cases failed. Stacked on #943. The test-side fixes are in simplyblock/sbcli#1703.

One commit per failing test:

Test Commit Change
TC-S3-004 fix(objectstore): expand a bucket's PVC when capacityBytes grows Ready buckets expand their PVC when capacityBytes grows. A CEL transition rule rejects a decrease. A StorageClass without expansion is reported as a CapacityExpansionRefused event.
TC-S3-003 fix(gateway): answer a write to a full bucket with 507, not 409 versitygw v1.9.0 maps any link error, ENOSPC included, to 409 ExistingObjectIsDirectory. The gateway wrapper reclassifies it: still 409 when a directory or object really blocks the key, 507 InsufficientStorage when the volume is out of space, 500 otherwise.
TC-S3-014 fix(chart): serve the operator's metrics endpoint The chart passes --metrics-bind-address=:8443 and declares it as the container port metrics, behind operatorMetrics.enabled, which defaults to false. There is no Service, because the metrics belong to one pod.
S3MissingEnvFromSecretK8s fix(objectstore): leave Degraded when the missing reference appears Degraded → Provisioning when a Secret or ConfigMap named in envFrom is created or written after the ObjectStore degraded, or when the Certificate becomes Ready. Secrets and ConfigMaps are now watched.
TC-S3-002 fix(objectstore): hold an ObjectStore's delete while buckets reference it Finalizer storage.simplyblock.io/objectstore-buckets with condition BucketsRemaining. An S3Bucket whose ObjectStore is being deleted degrades with ObjectStoreNotFound.

The design docs and test plans are updated for both lifecycle decisions: deletion is blocked by buckets, and Degraded recovers.

Testing

  • Each regression test failed on the unchanged tree and passes with its fix.
  • The full operator suite (go test with envtest) and the gateway suite pass.
  • The house-style gate passes.
  • golangci-lint was not run locally: the pinned binary was built with Go 1.26 and panics under Go 1.27.
  • The chart change was checked with helm template, with the setting on and off.
  • Not yet verified on a cluster.

🤖 Generated with Claude Code

mxsrc and others added 3 commits November 19, 2026 13:48
The ObjectStore controller sets an owner reference with
blockOwnerDeletion when creating the gateway's ServiceAccount, which
requires update on the ObjectStore's finalizers subresource. That
permission was never granted, so the API server rejects the create and
the ObjectStore never becomes Ready. The S3Bucket controller already
has the equivalent permission; this brings ObjectStore in line.

SFAM-2858
…S3-004)

The CRD documents that an increase of S3Bucket.spec.capacityBytes reconciles
to a PVC expansion and that a decrease is rejected. Neither was implemented.
ensurePVC returned an existing PVC unchanged and the Ready path only ran mount
delivery, so in CI run 45100042373 the PVC still requested 1Gi ten minutes
after capacityBytes went to 3Gi.

The Ready path now raises the PVC's requested storage to capacityBytes when
the spec asks for more, and emits CapacityExpanding. A StorageClass that does
not allow expansion is reported as a CapacityExpansionRefused warning instead
of an error retried on every pass. A CEL transition rule rejects a decrease at
admission.

Tests I-14 and I-15 were red against the unchanged tree (PVC stayed at 50Mi,
decrease admitted) and are green with the fix.
…3-003)

versitygw v1.9.0's posix backend maps every error from linking a finished
object into place to ExistingObjectIsDirectory. On a pNFS mount that is where
a full volume surfaces: write() only fills the client's page cache, and the
server's ENOSPC comes back from the fsync and close inside the link. In CI run
45100042373 the 14th 64 MiB object into a 1 GiB bucket was refused with 409
ExistingObjectIsDirectory, which no S3 client treats as out of space.

The gateway's Backend wrapper now overrides PutObject, CopyObject, and
CompleteMultipartUpload. When versitygw answers ExistingObjectIsDirectory and
the key is not actually blocked by a directory or by an object in its path,
the bucket volume's free space decides: below the request size, or below 1%
of capacity when the size is unknown, the answer is 507 InsufficientStorage,
and otherwise 500 InternalError. versitygw discards the errno, so the cause is
inferred from statfs, not observed.

The full-volume and space-left cases were red against the unchanged wrapper
(409 ExistingObjectIsDirectory) and are green with the fix.
@mxsrc
mxsrc marked this pull request as ready for review November 23, 2026 23:56
Base automatically changed from fix/objectstore-finalizers-rbac to main November 23, 2026 23:59
@mxsrc
mxsrc force-pushed the fix/s3-e2e-failures branch from 6fb5215 to 4a20c94 Compare November 24, 2026 00:00
The operator records simplyblock_objectstore_bucket_provisioning_seconds and
the other ObjectStore/S3Bucket families on controller-runtime's registry, but
--metrics-bind-address defaults to "0" and only the kustomize deployment set
it. The Helm chart never did, so a chart-installed operator served no metrics
at all, and in CI run 45100042373 the histogram had no samples after six
buckets reached Ready.

The chart now passes --metrics-bind-address=:8443 and declares it as the
container port named metrics, both behind operatorMetrics.enabled (default
false). There is no Service: the metrics belong to one pod, so a scraper
addresses pods, and a PodMonitor can select the named port. The endpoint keeps
controller-runtime's secure serving: a scraper needs a token bound to the
existing simplyblock-operator-metrics-reader ClusterRole, and the manager role
already carries the tokenreviews and subjectaccessreviews it authorizes with.

The chart has no test suite to make red first. Verified by rendering with helm
template: the arg and port are absent with the default and appear with
operatorMetrics.enabled=true. The e2e scrape is fixed separately in sbcli, and
its workflow enables the endpoint.
…S3MissingEnvFromSecretK8s)

Degraded had no outgoing edge and Reconcile returned early on it, so an
ObjectStore that degraded because spec.envFrom named a Secret that did not
exist yet stayed Degraded after the Secret was created. In CI run 45100042373
s3-fn went Degraded at 05:53:41, the Secret was created the same second, and
the ObjectStore was still Degraded ten minutes later.

Degraded now returns to Provisioning with a fresh deadline when the cause may
be gone: a Secret or ConfigMap named in spec.envFrom was created or written
after the ObjectStore degraded, or, for an ObjectStore degraded on its
certificate, the Certificate reports Ready. The controller watches Secrets and
ConfigMaps and enqueues the ObjectStores whose envFrom names them. The
Certificate is unstructured and not watched, so a certificate-degraded
ObjectStore re-reads it once a minute. Nothing else leaves Degraded, so a
refusal is still not retried on every event. The design's state machine and
failure tables record the new edge.

U-20, U-22, and U-23 were red against the unchanged tree and are green with
the fix. U-21 guards against flapping and passed before and after.
…e it (TC-S3-002)

Deleting an ObjectStore removed its gateway Deployment and Service while the
S3Buckets that named it stayed Ready, so nothing served them and nothing said
so. In CI run 45100042373 tc002a was still Ready after its ObjectStore and
every gateway pod were gone.

The decision is that deletion is blocked until the buckets are gone. The
ObjectStore now carries the finalizer storage.simplyblock.io/objectstore-buckets.
On delete, the reconciler lists the S3Buckets that reference it, keeps the
finalizer while any remain, and sets BucketsRemaining True naming them. The
phase is unchanged and the owned objects stay, so the gateway keeps serving.
The controller watches S3Buckets and enqueues the ObjectStore each names, so
the last bucket's deletion releases the finalizer. An S3Bucket whose
ObjectStore is being deleted now counts it as missing and degrades with
ObjectStoreNotFound, so a new bucket cannot hold the delete open
indefinitely. The design docs record the decision.

I-08 and I-16 were red against the unchanged tree (the ObjectStore vanished
with a bucket still referencing it; the new bucket never degraded) and are
green with the fix. I-04 now asserts that a delete with no buckets completes
once the finalizer is released.
@mxsrc
mxsrc force-pushed the fix/s3-e2e-failures branch from 4a20c94 to 94b2f44 Compare November 24, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant