Skip to content

Add GlobalCluster object/api #33

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

Merged
merged 2 commits into from
Oct 6, 2021

Conversation

rbranche
Copy link
Contributor

Issue #, if available: aws-controllers-k8s/community#973

Description of changes:
This change adds the GlobalCluster object/api to rds-controller.

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

@ack-bot
Copy link
Collaborator

ack-bot commented Sep 22, 2021

Hi @rbranche. 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-bot ack-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 22, 2021
Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Thanks @rbranche! :) Everything looks kosher to me.

@jaypipes
Copy link
Collaborator

/lgtm

@ack-bot
Copy link
Collaborator

ack-bot commented Sep 22, 2021

@jaypipes: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@RedbackThomson
Copy link
Contributor

/hold

@ack-bot ack-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 22, 2021
@RedbackThomson
Copy link
Contributor

/ok-to-test

@ack-bot ack-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 22, 2021
@RedbackThomson
Copy link
Contributor

/unhold

Just waiting for tests to pass now

@ack-bot ack-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 22, 2021
@RedbackThomson
Copy link
Contributor

/lgtm

@ack-bot ack-bot added lgtm Indicates that a PR is ready to be merged. approved labels Sep 22, 2021
@rbranche
Copy link
Contributor Author

rbranche commented Sep 22, 2021

@jaypipes or @RedbackThomson : are you familiar with how the e2e tests work and can point me in the right direction for this test failure:

�[31m�[1m______________ TestDBCluster.test_create_delete_mysql_serverless _______________�[0m
[gw0] linux -- Python 3.8.12 /usr/local/bin/python

self = <e2e.tests.test_db_cluster.TestDBCluster object at 0x7fb7ccd64c70>
rds_client = <botocore.client.RDS object at 0x7fb7ccd71940>
master_user_pass_secret = ('default', 'dbclustersecrets', 'master_user_password')

    def test_create_delete_mysql_serverless(
            self,
            rds_client,
            master_user_pass_secret,
    ):
        db_cluster_id = "my-aurora-mysql"
        db_name = "mydb"
        mup_sec_ns, mup_sec_name, mup_sec_key = master_user_pass_secret
    
        replacements = REPLACEMENT_VALUES.copy()
        replacements['COPY_TAGS_TO_SNAPSHOT'] = "False"
        replacements["DB_CLUSTER_ID"] = db_cluster_id
        replacements["DB_NAME"] = db_name
        replacements["MASTER_USER_PASS_SECRET_NAMESPACE"] = mup_sec_ns
        replacements["MASTER_USER_PASS_SECRET_NAME"] = mup_sec_name
        replacements["MASTER_USER_PASS_SECRET_KEY"] = mup_sec_key
    
        resource_data = load_rds_resource(
            "db_cluster_mysql_serverless",
            additional_replacements=replacements,
        )
    
        ref = k8s.CustomResourceReference(
            CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL,
            db_cluster_id, namespace="default",
        )
        k8s.create_custom_resource(ref, resource_data)
        cr = k8s.wait_resource_consumed_by_controller(ref)
    
        assert cr is not None
    
        # Let's check that the DB cluster appears in RDS
        aws_res = rds_client.describe_db_clusters(DBClusterIdentifier=db_cluster_id)
        assert aws_res is not None
        assert len(aws_res['DBClusters']) == 1
        dbc_rec = aws_res['DBClusters'][0]
    
        now = datetime.datetime.now()
        timeout = now + datetime.timedelta(seconds=CREATE_TIMEOUT_SECONDS)
    
        # TODO(jaypipes): Move this into generic AWS-side waiter
        while dbc_rec['Status'] != "available":
            if datetime.datetime.now() >= timeout:
                pytest.fail("failed to find available DBCluster before timeout")
            time.sleep(CREATE_INTERVAL_SLEEP_SECONDS)
            aws_res = rds_client.describe_db_clusters(DBClusterIdentifier=db_cluster_id)
            assert len(aws_res['DBClusters']) == 1
            dbc_rec = aws_res['DBClusters'][0]
    
        # We're now going to modify the CopyTagsToSnapshot field of the DB
        # instance, wait some time and verify that the RDS server-side resource
        # shows the new value of the field.
        assert dbc_rec['CopyTagsToSnapshot'] == False
        updates = {
            "spec": {"copyTagsToSnapshot": True},
        }
        k8s.patch_custom_resource(ref, updates)
        time.sleep(MODIFY_WAIT_AFTER_SECONDS)
    
        aws_res = rds_client.describe_db_clusters(DBClusterIdentifier=db_cluster_id)
        assert aws_res is not None
        assert len(aws_res['DBClusters']) == 1
        dbc_rec = aws_res['DBClusters'][0]
>       assert dbc_rec['CopyTagsToSnapshot'] == True
�[1m�[31mE       assert False == True�[0m
�[1m�[31mE         +False�[0m
�[1m�[31mE         -True�[0m

Test results

Also as a side note, it appears that @jaypipes's new e2e test for updating DBInstance status is also flaky (failed once and passed once for my testing on this PR): Link to test results

>       assert cr['status']['dbInstanceStatus'] != 'creating'
�[1m�[31mE       AssertionError: assert 'creating' != 'creating'�[0m

@rbranche
Copy link
Contributor Author

/test rds-kind-e2e

@jaypipes
Copy link
Collaborator

@rbranche I'm not ignoring this :) I'm in the process of getting the rds-controller up to our code-gen and common runtime v0.14.1. After that, I'll ask you to rebase and see if that fixes anything

@rbranche rbranche force-pushed the add-global-cluster branch from 393a3a9 to f1cc289 Compare October 6, 2021 00:08
@ack-bot ack-bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2021
@rbranche
Copy link
Contributor Author

rbranche commented Oct 6, 2021

Rebased this on top of @jaypipes changes.

@RedbackThomson
Copy link
Contributor

Awesome. Thanks for waiting patiently!

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2021
@ack-bot
Copy link
Collaborator

ack-bot commented Oct 6, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaypipes, rbranche, RedbackThomson

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [RedbackThomson,jaypipes]

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

@ack-bot ack-bot merged commit cbe4828 into aws-controllers-k8s:main Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants