-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rds.rdsinstance: Add storage autoscaling (MaxAllocatedStorage) #794
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chlunde
force-pushed
the
rds-autoscaling
branch
from
August 9, 2021 18:25
e38051a
to
a1b188e
Compare
6 tasks
chlunde
force-pushed
the
rds-autoscaling
branch
from
September 12, 2021 09:20
a1b188e
to
8997b25
Compare
Rebased and retested. -- Fill disk (too fast for "graceful" autoscaling)
CREATE TABLE large_test (num1 bigint, num2 double precision, num3 double precision);
INSERT INTO large_test (num1, num2, num3)
SELECT round(random()*10), random(), random()*142
FROM generate_series(1, 200000000) s(i); apiVersion: database.aws.crossplane.io/v1beta1
kind: RDSInstance
metadata:
name: example-rds
spec:
forProvider:
allocatedStorage: 20
maxAllocatedStorage: 60
autoMinorVersionUpgrade: true
backupRetentionPeriod: 0
copyTagsToSnapshot: false
dbInstanceClass: db.t2.micro
deletionProtection: false
enableIAMDatabaseAuthentication: false
enablePerformanceInsights: false
engine: postgres
engineVersion: "12.4"
masterUsername: adminuser
multiAZ: false
publiclyAccessible: true
region: us-east-1
storageEncrypted: false
storageType: gp2
writeConnectionSecretToRef:
name: example-rdsinstance-out
namespace: crossplane-system |
@chlunde can you rebase again ? testet the future it is working |
This parameter defines the upper limit to which Amazon RDS can automatically scale the storage of the DB instance. For more information about this setting, including limitations that apply to it, see Managing capacity automatically with Amazon RDS storage autoscaling (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling) in the Amazon RDS User Guide. Make rds.CreatePatch exclude AllocatedStorage if autoscaling is enabled, and the requested AllocatedStorage is lower than was is currently allocated. This allows a user to manually scale *up* storage even if autoscaling is enabled, and prevents crossplane from attempting to scale *down* if AWS has performed autoscaling. One problem is that this change silently ignores any attempts to manually downscale when autoscaling is enabled. Since downscaling is not supported and it is not possible to distinguish this from autoscaling, I don't see any other solutions. I have added tests to verify the logic for omitting StorageSize and the up to date-test: --- FAIL: TestObserve (0.00s) --- FAIL: TestObserve/AutoscaledStorageIsUpToDate (0.00s) rdsinstance_test.go:354: r: -want, +got: managed.ExternalObservation{ ResourceExists: true, - ResourceUpToDate: true, + ResourceUpToDate: false, ResourceLateInitialized: false, ConnectionDetails: nil, Diff: "", } --- FAIL: TestUpdate (0.00s) --- FAIL: TestUpdate/AutoscaleExcludeStorage (0.00s) rdsinstance_test.go:674: r: -want, +got: interface{}( + e"cannot modify RDS instance: AllocatedStorage must not be set when on a modify request when AWS has autoscaled the storage", ) Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
chlunde
force-pushed
the
rds-autoscaling
branch
from
February 7, 2022 19:57
8997b25
to
5a0c4f5
Compare
@haarchri rebased |
haarchri
approved these changes
Feb 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - tested again it is working thanks for your efford @chlunde
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
Add storage autoscaling parameter MaxAllocatedStorage.
This parameter defines the upper limit to which Amazon RDS can automatically
scale the storage of the DB instance.
For more information about this setting, including limitations that apply
to it, see Managing capacity automatically with Amazon RDS storage autoscaling
(https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling)
in the Amazon RDS User Guide.
Make rds.CreatePatch exclude AllocatedStorage if autoscaling is enabled,
and the requested AllocatedStorage is lower than was is currently
allocated.
This allows a user to manually scale up storage even if autoscaling is
enabled, and prevents crossplane from attempting to scale down if
AWS has performed autoscaling.
One problem is that this change silently ignores any attempts to manually
downscale when autoscaling is enabled. Since downscaling is not
supported and it is not possible to distinguish this from autoscaling, I
don't see any other solutions.
I have added tests to verify the logic for omitting StorageSize and the
up to date-test:
Fixes #661
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested