Skip to content
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

Bug 1896918: add new credentials field for AWS Secrets #264

Merged

Conversation

joelddiaz
Copy link
Contributor

@joelddiaz joelddiaz commented Nov 2, 2020

Start storing a usable AWS credentials config file in the 'credentials' field of the Secret. This should allow a consumer of the credentials to just point to the config stored in that field when setting up an AWS client.

Also make sure we are re-queuing CredentialsRequest objects every 1hr10min (so that we are at least periodically doing a full reconcile to restore any lost credentials).

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 2, 2020
@joelddiaz
Copy link
Contributor Author

/assign @dgoodwin
/cc @sjenning

Copy link
Contributor

@dgoodwin dgoodwin left a comment

Choose a reason for hiding this comment

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

Looking great just a few nits and questions.


// Make sure we update old Secrets that don't have the new "credentials" field
if credentialsKey == "" || credentialsKey != string(generateAWSCredentialsConfig(accessKey, secretKey)) {
logger.Debugf("Secret %s key needs updating, will update Secret contents", secretDataCredentialsKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

Infof as I think this is low occurrence high value.

pkg/aws/actuator/actuator.go Show resolved Hide resolved
require.NoError(t, err, "unexpected error creating/updating Secret")

secret := &corev1.Secret{}
secretKey := types.NamespacedName{Name: cr.Spec.SecretRef.Name, Namespace: cr.Spec.SecretRef.Namespace}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest secretNSN or similar, key might be a little misleading here. I'm thinking Data[key] when I see that var.

err = fakeClient.Get(context.TODO(), secretKey, secret)
require.NoError(t, err, "unexpected error retriving Secret")

require.Contains(t, secret.Data, "credentials")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we be pedantic and also check the old keys are there as expected as well.

@@ -71,6 +71,8 @@ const (
credentialsRequestInfraMismatch = "InfrastructureMismatch"
)

var defaultRequeueTime = time.Hour + time.Minute*10
Copy link
Contributor

Choose a reason for hiding this comment

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

An hour is conceptually easier to explain to people, is the 10 minute buying us anything? I could see a random jitter like we do in hive but really not a big concern for the scale CCO works at.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also please add a comment on why we're doing a requeue instead of just waiting for events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we explicitly don't re-reconcile more than once every hour, I was just thinking if there is a small difference between when the object is requeued and the lastSync values (where it requeues just before 1 hour so the lastSync is still less than 1 hour ago), then we could effectively slip out to reconciling to every 2 hours. Not a huge deal, but it is double the intended reconcile rate.

@dgoodwin
Copy link
Contributor

dgoodwin commented Nov 3, 2020

Good to squash.

Start storing a usable AWS credentials config file in the 'credentials' field of the Secret. This should allow a consumer of the credentials to just point to the config stored in that field when setting up an AWS client.

Also make sure we are re-queueing CredentialsRequest objects every 1hr10min (so that we are at least periodically doing a full reconcile to reestore any lost credentials).
@sjenning
Copy link
Contributor

sjenning commented Nov 3, 2020

/test e2e-aws

@sjenning
Copy link
Contributor

sjenning commented Nov 4, 2020

seems e2e-aws is failing because CCO clusteroperator is not reporting it's version

                "versions": [
                    {
                        "name": "operator",
                        "version": ""
                    }
                ]

even though the operator is Progressing=False and Available=True

@twiest twiest removed their request for review November 4, 2020 19:03
@dgoodwin
Copy link
Contributor

dgoodwin commented Nov 5, 2020

I think all e2e is broken because of https://bugzilla.redhat.com/show_bug.cgi?id=1891759. @akhil-rane is working on it over in #263, and I think they're actually going to be reverting the OpenShift change entirely, though that will take a little longer to make it to the build clusters.

@sjenning
Copy link
Contributor

sjenning commented Nov 6, 2020

/retest

@dgoodwin
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin, joelddiaz

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:

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

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

9 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 850faf1 into openshift:master Nov 11, 2020
@joelddiaz
Copy link
Contributor Author

/cherrypick release-4.6

@openshift-cherrypick-robot

@joelddiaz: new pull request created: #268

In response to this:

/cherrypick release-4.6

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.

@joelddiaz
Copy link
Contributor Author

/retitle Bug 1896918: add new credentials field for AWS Secrets

@openshift-ci-robot openshift-ci-robot changed the title add new credentials field for AWS Secrets Bug 1896918: add new credentials field for AWS Secrets Nov 11, 2020
@openshift-ci-robot
Copy link
Contributor

@joelddiaz: All pull requests linked via external trackers have merged:

Bugzilla bug 1896918 has been moved to the MODIFIED state.

In response to this:

Bug 1896918: add new credentials field for AWS Secrets

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.

@joelddiaz
Copy link
Contributor Author

/cherrypick release-4.6

@openshift-cherrypick-robot

@joelddiaz: failed to push cherry-picked changes in GitHub: pushing failed, output: "To https://github.com/openshift-cherrypick-robot/cloud-credential-operator\n ! [rejected] cherry-pick-264-to-release-4.6 -> cherry-pick-264-to-release-4.6 (non-fast-forward)\nerror: failed to push some refs to 'https://openshift-cherrypick-robot:CENSORED@github.com/openshift-cherrypick-robot/cloud-credential-operator'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Integrate the remote changes (e.g.\nhint: 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n", error: exit status 1

In response to this:

/cherrypick release-4.6

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.

@sdodson
Copy link
Member

sdodson commented Nov 11, 2020

/cherrypick release-4.6

@openshift-cherrypick-robot

@sdodson: failed to push cherry-picked changes in GitHub: pushing failed, output: "To https://github.com/openshift-cherrypick-robot/cloud-credential-operator\n ! [rejected] cherry-pick-264-to-release-4.6 -> cherry-pick-264-to-release-4.6 (non-fast-forward)\nerror: failed to push some refs to 'https://openshift-cherrypick-robot:CENSORED@github.com/openshift-cherrypick-robot/cloud-credential-operator'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Integrate the remote changes (e.g.\nhint: 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n", error: exit status 1

In response to this:

/cherrypick release-4.6

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants