Skip to content

Commit b16a299

Browse files
Fix DBinstance enableCloudwatchLogsExports updates (#260)
Issue #, if available: aws-controllers-k8s/community#2128 Description of changes: By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d9fef91 commit b16a299

File tree

12 files changed

+134
-6
lines changed

12 files changed

+134
-6
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ack_generate_info:
2-
build_date: "2025-11-29T03:44:25Z"
3-
build_hash: 23c7074fa310ad1ccb38946775397c203b49f024
4-
go_version: go1.25.4
5-
version: v0.56.0
2+
build_date: "2025-12-17T01:17:18Z"
3+
build_hash: 5c8b9050006ef6c7d3a97c279e7b1bc163f20a0a
4+
go_version: go1.25.1
5+
version: v0.56.0-3-g5c8b905
66
api_directory_checksum: 90b0d1adcc91f4a1b1f1b436e3ac0c30d9271678
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6

config/crd/common/bases/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:

config/crd/common/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
resources:
6-
- bases/services.k8s.aws_iamroleselectors.yaml
76
- bases/services.k8s.aws_fieldexports.yaml
7+
- bases/services.k8s.aws_iamroleselectors.yaml

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-rds-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/db_instance/hooks.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"context"
1818
"errors"
1919
"fmt"
20+
"slices"
2021
"strings"
2122

2223
svcapitypes "github.com/aws-controllers-k8s/rds-controller/apis/v1alpha1"
@@ -585,3 +586,22 @@ func needStorageUpdate(
585586
return strings.Contains(*r.ko.Status.DBInstanceStatus, "storage-full") &&
586587
delta.DifferentAt("Spec.AllocatedStorage")
587588
}
589+
590+
func getCloudwatchLogExportsConfigDifferences(cloudwatchLogExportsConfigDesired []*string, cloudwatchLogExportsConfigLatest []*string) ([]*string, []*string) {
591+
logsTypesToEnable := []*string{}
592+
logsTypesToDisable := []*string{}
593+
desired := aws.ToStringSlice(cloudwatchLogExportsConfigDesired)
594+
latest := aws.ToStringSlice(cloudwatchLogExportsConfigLatest)
595+
596+
for _, config := range cloudwatchLogExportsConfigDesired {
597+
if !slices.Contains(latest, *config) {
598+
logsTypesToEnable = append(logsTypesToEnable, config)
599+
}
600+
}
601+
for _, config := range cloudwatchLogExportsConfigLatest {
602+
if !slices.Contains(desired, *config) {
603+
logsTypesToDisable = append(logsTypesToDisable, config)
604+
}
605+
}
606+
return logsTypesToEnable, logsTypesToDisable
607+
}

pkg/resource/db_instance/sdk.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/hooks/db_instance/sdk_read_many_post_set_output.go.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,9 @@
114114
ko.Spec.DBParameterGroupName = ko.Status.DBParameterGroups[0].DBParameterGroupName
115115
}
116116
}
117+
118+
// We currently do not set spec value for EnableCloudwatchLogsExports
119+
// and instead only set the status field.
120+
// Adding DBInstance.enableCloudwatchLogsExports doesn't update the RDS instance
121+
// https://github.com/aws-controllers-k8s/community/issues/2128
122+
ko.Spec.EnableCloudwatchLogsExports = ko.Status.EnabledCloudwatchLogsExports

0 commit comments

Comments
 (0)