provider-upjet-aws: [Bug]: RDS Instance creation, resource already exists
Is there an existing issue for this?
- I have searched the existing issues
Affected Resource(s)
No response
Resource MRs required to reproduce the bug
apiVersion: rds.aws.upbound.io/v1beta2
kind: Instance
metadata:
annotations:
crossplane.io/external-create-pending: "2024-06-06T17:43:44Z"
crossplane.io/external-create-succeeded: "2024-06-06T17:43:44Z"
creationTimestamp: "2024-06-06T15:55:19Z"
finalizers:
- finalizer.managedresource.crossplane.io
generateName: ci-aseks6062802
generation: 3
labels:
clusterId: ci-aseks6062802
name: ci-aseks6062802qrvcs
resourceVersion: "67343"
uid: 48919564-24f7-43fb-b1ba-9dbbd8a9b1fa
spec:
deletionPolicy: Delete
forProvider:
allocatedStorage: 256
applyImmediately: true
autoGeneratePassword: true
backupRetentionPeriod: 3
copyTagsToSnapshot: true
dbSubnetGroupName: ci-aseks6062802k28ws
dbSubnetGroupNameRef:
name: ci-aseks6062802k28ws
dbSubnetGroupNameSelector:
matchLabels:
clusterId: ci-aseks6062802
engine: sqlserver-se
engineVersion: 15.00.4236.7.v1
identifier: ci-aseks6062802
instanceClass: db.m5.xlarge
licenseModel: license-included
maxAllocatedStorage: 1000
multiAz: false
passwordSecretRef:
key: password
name: ci-aseks6062802
namespace: sfd-ci-aseks6062802
publiclyAccessible: true
region: us-east-1
skipFinalSnapshot: true
storageEncrypted: true
storageType: gp2
username: testadmin
vpcSecurityGroupIdRefs:
- name: ci-aseks6062802-redis-mssql-sg2qb9w
vpcSecurityGroupIdSelector:
matchLabels:
clusterId: ci-aseks6062802
crossplane.io/forResource: redis-mssql
vpcSecurityGroupIds:
- sg-0ee65bd8753e2fdb8
initProvider: {}
managementPolicies:
- '*'
providerConfigRef:
name: service-fabric
writeConnectionSecretToRef:
name: mssql-creds
namespace: sfd-ci-aseks6062802
Steps to Reproduce
- Created an RDS Instance on a kind cluster running crossplane.
- It gets stuck sometimes with a resource already exists error, even though initially there was no such instance.
What happened?
- A single RDS Instance should have been created.
Relevant Error Output Snippet
- lastTransitionTime: "2024-06-06T17:44:46Z"
message: "async create failed: failed to create the resource: [{0 creating RDS
DB Instance (ci-aseks6062802): DBInstanceAlreadyExists: DB instance already
exists\n\tstatus code: 400, request id: 1be9b4f8-31de-42e5-89f5-99cdd8885597
\ []}]"
### Crossplane Version
1.16.1
### Provider Version
1.2.0
### Kubernetes Version
1.29
### Kubernetes Distribution
Kind
### Additional Info
_No response_
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (3 by maintainers)
I think we have enough evidence for this issue being fixed, therefore Iβm closing it. Feel free to reopen, or preferably, to open a new one. Thank you everyone for your contribution π
@mergenci I can confirm the issue is now fixed with version
v1.11.0. Although I had to recreate the claim. Thanks for fix!@mergenci, we are currently using version
v1.6.0we are going to try the latest version, and I will report back if the upgrade resolves the issue@karlderkaefer, thank you for your well-prepared report. Which provider version are you using?
The upstream Terraform fix that addresses the issue was consumed in https://github.com/crossplane-contrib/provider-upjet-aws/pull/1406, which was released in v1.10.0 β latest provider version is v1.11.0 by the way.
RDS creation errors are still possible in versions v1.10.0 or newer, simply because creation takes very long and something may timeout, like credentials do in your case. But such errors should be recovered from automatically in the next reconciliation loop, because now we receive the RDS ID (even if something timed out) with which we can successfully detect that the instance exists. In other words, we detect that the creation that we thought failed indeed succeeded.
In case your provider cannot detect that the instance was created successfully, and therefore is trying to recreate it and fail, it means there is another edge case we have yet to cover.
I faced same issue. It is producible but only for a specific instanceIdentifier. We tried other claims in same configuration, there were created just fine. I can share some details to these question
Yes identifier exists on managed resource. The instance name in the aws console was the same. Yes crossplane tags are set on actual rds instance:
crossplane-kind,crossplane-name,crossplane-providerconfig. We see following diff after the Session Token expired: allocated_storage:Itβs reproducible and it takes
2minfrom initial successful create event to error statetmp-logs.txt
Also here are cloudtrail request logs from first successful create event and first failing event tmp-success-redacted.json tmp-failing-reducted.json
Maybe worth to mention we set the identifier in our composition:
@mergenci Awesome stuff! Thank you very much for your work!