Skip to content

S3 controller does not report Status when adopted resource not found #2672

@knottnt

Description

@knottnt

Describe the bug
When attempting to adopt an S3 Bucket resource if the bucket name is not found no error is reported in the Status of the Bucket.

Steps to reproduce

  1. Create a new Bucket resource with adoption policy adopt and adoption field using a non-existent bucket name.
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
  annotations:
    services.k8s.aws/adoption-policy: "adopt"
    services.k8s.aws/adoption-fields: | 
        {
          "name": "name-not-matching-a-bucket"
        }
    services.k8s.aws/deletion-policy: retain
  name: my-sample-bucket
  1. Describe the Bucket resource and see that no status has been applied.
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
  annotations:
    services.k8s.aws/adoption-fields: |
      {
        "name": "name-not-matching-a-bucket"
      }
    services.k8s.aws/adoption-policy: adopt
    services.k8s.aws/deletion-policy: retain
  creationTimestamp: "2025-11-04T22:12:33Z"
  generation: 1
  name: my-sample-bucket
  namespace: default
  resourceVersion: "297959"
  uid: 5937c40b-6d7d-4465-9663-89ed48516b8a

In the controller logs we can also see that a ReconcileError is being reported, but not surfaced in the resource's Status.

{"level":"error","ts":"2025-11-04T14:15:22.042-0800","msg":"Reconciler error","controller":"bucket","controllerGroup":"s3.services.k8s.aws","controllerKind":"Bucket","Bucket":{"name":"my-sample-bucket","namespace":"default"},"namespace":"default","name":"my-sample-bucket","reconcileID":"5210391e-d139-488c-9b0f-65854bbac193","error":"adopted resource not found","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:347\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:294\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:255"}

Expected outcome
The error is surfaced through a Status condition to inform the user that the Bucket with the specified name cannot be found.

Environment

  • Kubernetes version: 1.32
  • Using EKS: No
  • AWS service targeted: S3

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.service/s3Indicates issues or PRs that are related to s3-controller.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions