Skip to content

Conversation

@rmullinnix461332
Copy link

Issue #, if available: 2614

Description of changes:
DBCluster is not respecting only supplying major egineVersion. it is reporting a delta because RDS has major/minor version. This prevents FieldExports from being populated.

In addition, existing DBCluster where DatabaseInsightsMode is nil, new controller results in continuous modifications to the RDS DB Instances. if databaseInsightsMode is not set, do not report as a delta.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from knottnt and michaelhtm August 28, 2025 16:14
@ack-prow
Copy link

ack-prow bot commented Aug 28, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rmullinnix461332
Once this PR has been reviewed and has the lgtm label, please assign michaelhtm for approval by writing /assign @michaelhtm in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow
Copy link

ack-prow bot commented Aug 28, 2025

Hi @rmullinnix461332. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ack-prow ack-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 28, 2025
Copy link
Contributor

@knottnt knottnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmullinnix461332 Appreciate the contribution! Apologies for the delay in reviewing this.


// Handle case where auto update minor version is true
// DBCluster Engine Version is major version and RDS Cluster Version is major and minor
reconcileDBClusterEngineVersion(a, b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is generated. To make sure that this isn't accidentally removed in future changes this should be added to the delta_pre_compare.go.tpl hook. You'll also need to re-run the ack-generate tool to apply the changes to the hook. You can find information on how to do that in the contributor docs.

if a != nil && b != nil &&
a.ko.Spec.EngineVersion != nil && b.ko.Spec.EngineVersion != nil &&
strings.HasPrefix(*b.ko.Spec.EngineVersion, *a.ko.Spec.EngineVersion) &&
b.ko.Spec.AutoMinorVersionUpgrade != nil && *b.ko.Spec.AutoMinorVersionUpgrade {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be using the state of the desired AutoMinorVersionUpgrade instead of what we just read from AWS? If the latest value has drifted I don't think we'd want it to impact how the EngineVersion is handled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

}
if ackcompare.HasNilDifference(a.ko.Spec.DatabaseInsightsMode, b.ko.Spec.DatabaseInsightsMode) {
delta.Add("Spec.DatabaseInsightsMode", a.ko.Spec.DatabaseInsightsMode, b.ko.Spec.DatabaseInsightsMode)
if a.ko.Spec.DatabaseInsightsMode != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to share steps to reproduce this issue? Tested adopting a DB Cluster with adopt-or-create without setting spec.databaseInsightsMode and I don't see it repeatedly showing up in the delta.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been using the controller for 2-3 years. More than likely, the resources have been out there for a while. the manifest on the cluster does not have spec.databaseInsightsMode. It's marked as a delta.

spec:
  allocatedStorage: 1
  autoMinorVersionUpgrade: true
  availabilityZones:
  - us-east-1d
  - us-east-1c
  - us-east-1b
  backupRetentionPeriod: 7
  copyTagsToSnapshot: true
  databaseName: XXXXXXXX
  dbClusterIdentifier: XXXXXXXX
  dbClusterParameterGroupRef:
    from:
      name: XXXXXXXX
  dbSubnetGroupName: XXXXXXX
  deletionProtection: true
  enableCloudwatchLogsExports:
  - audit
  - error
  - slowquery
  engine: aurora-mysql
  engineMode: provisioned
  engineVersion: "8.0"
  kmsKeyID: arn:aws:kms:us-east-1:XXXXXXXXX
  masterUserPassword:
    key: password
    name: XXXXXXXXX
    namespace: XXXXXXXXX
  masterUsername: XXXXXXXX
  networkType: IPV4
  port: 3306
  preferredBackupWindow: 03:50-04:20
  preferredMaintenanceWindow: sun:12:00-sun:14:00
  storageEncrypted: true
  tags:

Copy link
Contributor

@knottnt knottnt Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried reproducing the issue by creating a DBCluster with a similar spec using the v1.5.0 version of the rds-controller/CRD and then upgrading the controller and CRD to the 1.6.0 versions. After upgrading I saw the controller detect databaseInsightsMode in the delta once and then update the DBCluster to reflect the value in AWS.

Just to confirm, did you update the DBCluster CRD along with the rds-controller deployment? I did see databaseInsightsMode repeatedly logged in the delta when the rds-controller has been upgraded to v1.6.0, but the CRD hasn't been re-applied to include the databaseInsightsMode field. The controller read the value from AWS, but when attempting to apply it to the DBCluster the patch failed with below error.

{"level":"info","ts":"2025-10-02T16:45:32.172-0700","logger":"KubeAPIWarningLogger","msg":"unknown field \"spec.databaseInsightsMode\""}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the crds are current. we use argo-cd and the helm chart from aws public ecr for install. databaseInsightsMode is present in the dbcluster crd.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default Helm3 doesn't install CRDs on upgrades if the CRD is already present. Are you able to see the databaseInsightsMode field when examining the CRD directly?

kubectl get crd dbclusters.rds.services.k8s.aws -o yaml

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argo-cd doesn't use helm3, it generates the desired manifest from the helm chart, but handles the sync itself. And yes, i did verify that the databaseInsightsMode is in the CRD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants