Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/aws-controllers-k8s/runtime => github.com/michaelhtm/ack-runtime v0.49.1-0.20251127030001-28136dd1e8e3
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/aws-controllers-k8s/runtime v0.54.1 h1:0mbCJELz3t7jbG4abNecF0yeRd8YeFZQPr7nnzr8DC8=
github.com/aws-controllers-k8s/runtime v0.54.1/go.mod h1:OkUJN+Ds799JLYZsMJrO2vDJ4snxUeHK2MgrQHbU+Qc=
github.com/aws/aws-sdk-go v1.49.0 h1:g9BkW1fo9GqKfwg2+zCD+TW/D36Ux+vtfJ8guF4AYmY=
github.com/aws/aws-sdk-go v1.49.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go-v2 v1.34.0 h1:9iyL+cjifckRGEVpRKZP3eIxVlL06Qk1Tk13vreaVQU=
Expand Down Expand Up @@ -117,6 +115,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/michaelhtm/ack-runtime v0.49.1-0.20251127030001-28136dd1e8e3 h1:Aiv5oeUAdkJLwzkVLXzFgf/KwPTLuBOWaNNq/5ge7nw=
github.com/michaelhtm/ack-runtime v0.49.1-0.20251127030001-28136dd1e8e3/go.mod h1:OkUJN+Ds799JLYZsMJrO2vDJ4snxUeHK2MgrQHbU+Qc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/resources/bucket_adopt_no_fields.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: $RANDOM_BUCKET_NAME
annotations:
services.k8s.aws/adoption-policy: $ADOPTION_POLICY
services.k8s.aws/deletion-policy: retain
20 changes: 18 additions & 2 deletions test/e2e/tests/test_bucket_adoption_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from e2e.replacement_values import REPLACEMENT_VALUES

CREATE_WAIT_AFTER_SECONDS = 10
MODIFY_WAIT_AFTER_SECONDS = 20
MODIFY_WAIT_AFTER_SECONDS = 10
DELETE_WAIT_AFTER_SECONDS = 10
ACK_SYSTEM_TAG_PREFIX = "services.k8s.aws/"
AWS_SYSTEM_TAG_PREFIX = "aws:"
Expand Down Expand Up @@ -150,6 +150,20 @@ def test_adopt_policy(
assert latest is not None
versioning = latest.Versioning()
assert versioning.status == status

@pytest.mark.resource_data({'adoption-policy': AdoptionPolicy.ADOPT, 'filename': 'bucket_adopt_no_fields', 'resource-name': 'adopt'})
def test_adopt_policy_missing_fields(
self, s3_client, bucket_adoption_policy, s3_resource
):
(ref, cr) = bucket_adoption_policy

k8s.wait_on_condition(ref, "ACK.ResourceSynced", "Unknown", wait_periods=5)

condition = k8s.get_resource_condition(ref, "ACK.ResourceSynced")
assert condition is not None

expected_msg = "adoption-fields is not defined"
assert expected_msg in condition['reason']

@pytest.mark.resource_data({'adoption-policy': AdoptionPolicy.ADOPT_OR_CREATE, 'filename': 'bucket_adopt_or_create', 'resource-name': 'adopt-or-create'})
def test_adopt_or_create_policy(
Expand All @@ -162,7 +176,9 @@ def test_adopt_or_create_policy(
assert 'spec' in cr
assert 'name' in cr['spec']
bucket_name = cr['spec']['name']


# Wait for tags to appear on describe
time.sleep(MODIFY_WAIT_AFTER_SECONDS)
latest = get_bucket(s3_resource, bucket_name)
assert latest is not None
tagging = latest.Tagging()
Expand Down