Skip to content

Commit 4104a06

Browse files
authored
fix: ignore attributes update empty (#96)
Issue [#2247](aws-controllers-k8s/community#2247) Description of changes: This change is required for users migrating from an older sqs controller (pre sdk v2 migration) to the latest one. In aws sdk go v1, the sdk update was able to send empty attributes, and no error was returned. When we migrated to v2, empty attributes when calling SetQueueAttributes was no longer an option. We were able to mitigate this issue by late initializing the defaulted fields when creating a queue to avoid exposing them in the delta. This mitigation did not handle cases in which users migrate to the latest version, as the resource is not late initialized if update fails. With this change, we will avoid calling update if there are no attributes defined by the user In sdk v1, the attributes input was a `*map[string]string`, so if it was not set, it would just be a No-Op In sdk v2, attributes is `map[string]string`, so if it's not set, it would default to an empty map, which started causing issues By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent e9b0e67 commit 4104a06

File tree

9 files changed

+45
-5
lines changed

9 files changed

+45
-5
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-11-29T03:36:21Z"
3-
build_hash: 23c7074fa310ad1ccb38946775397c203b49f024
2+
build_date: "2025-12-11T23:39:26Z"
3+
build_hash: 5c8b9050006ef6c7d3a97c279e7b1bc163f20a0a
44
go_version: go1.25.4
5-
version: v0.56.0
5+
version: v0.56.0-3-g5c8b905
66
api_directory_checksum: 2627dc306e3a83c86c04050c6c4336451459e728
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: b332aeda9a33b58316273296754ee470b9568b59
10+
file_checksum: 7d19f3bad5c4ff9efc3550284a2e9284212afb28
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ resources:
2020
template_path: hooks/queue/sdk_get_attributes_post_set_output.go.tpl
2121
sdk_update_pre_build_request:
2222
template_path: hooks/queue/sdk_update_pre_build_request.go.tpl
23+
sdk_update_post_build_request:
24+
template_path: hooks/queue/sdk_update_post_build_request.go.tpl
2325
print:
2426
add_age_column: true
2527
add_synced_column: true

generator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ resources:
2020
template_path: hooks/queue/sdk_get_attributes_post_set_output.go.tpl
2121
sdk_update_pre_build_request:
2222
template_path: hooks/queue/sdk_update_pre_build_request.go.tpl
23+
sdk_update_post_build_request:
24+
template_path: hooks/queue/sdk_update_post_build_request.go.tpl
2325
print:
2426
add_age_column: true
2527
add_synced_column: true

helm/crds/services.k8s.aws_iamroleselectors.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ spec:
6363
required:
6464
- names
6565
type: object
66+
resourceLabelSelector:
67+
description: LabelSelector is a label query over a set of resources.
68+
properties:
69+
matchLabels:
70+
additionalProperties:
71+
type: string
72+
type: object
73+
required:
74+
- matchLabels
75+
type: object
6676
resourceTypeSelector:
6777
items:
6878
properties:

helm/templates/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ spec:
5151
- "$(AWS_REGION)"
5252
- --aws-endpoint-url
5353
- "$(AWS_ENDPOINT_URL)"
54+
{{- if .Values.aws.identity_endpoint_url }}
55+
- --aws-identity-endpoint-url
56+
- "$(AWS_IDENTITY_ENDPOINT_URL)"
57+
{{- end }}
58+
{{- if .Values.aws.allow_unsafe_aws_endpoint_urls }}
59+
- --allow-unsafe-aws-endpoint-urls
60+
{{- end }}
5461
{{- if .Values.log.enable_development_logging }}
5562
- --enable-development-logging
5663
{{- end }}
@@ -109,6 +116,8 @@ spec:
109116
value: {{ .Values.aws.region }}
110117
- name: AWS_ENDPOINT_URL
111118
value: {{ .Values.aws.endpoint_url | quote }}
119+
- name: AWS_IDENTITY_ENDPOINT_URL
120+
value: {{ .Values.aws.identity_endpoint_url | quote }}
112121
- name: ACK_WATCH_NAMESPACE
113122
value: {{ include "ack-sqs-controller.watch-namespace" . }}
114123
- name: ACK_WATCH_SELECTORS

helm/values.schema.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,16 @@
171171
"region": {
172172
"type": "string"
173173
},
174-
"endpoint": {
174+
"endpoint_url": {
175175
"type": "string"
176176
},
177+
"identity_endpoint_url": {
178+
"type": "string"
179+
},
180+
"allow_unsafe_aws_endpoint_urls": {
181+
"type": "boolean",
182+
"default": false
183+
},
177184
"credentials": {
178185
"description": "AWS credentials information",
179186
"properties": {

helm/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ aws:
9090
# If specified, use the AWS region for AWS API calls
9191
region: ""
9292
endpoint_url: ""
93+
identity_endpoint_url: ""
94+
allow_unsafe_aws_endpoint_urls: false
9395
credentials:
9496
# If specified, Secret with shared credentials file to use.
9597
secretName: ""

pkg/resource/queue/sdk.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// ignore updates if attributes are not defined.
2+
if len(input.Attributes) == 0 {
3+
return &resource{desired.ko.DeepCopy()}, nil
4+
}

0 commit comments

Comments
 (0)