Skip to content

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

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
joelddiaz:new-credentials-field
Nov 11, 2020
Merged

Bug 1896918: add new credentials field for AWS Secrets#264
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
joelddiaz:new-credentials-field

Conversation

@joelddiaz
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

/assign @dgoodwin
/cc @sjenning

Copy link
Copy Markdown
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.

Comment thread pkg/aws/actuator/actuator.go Outdated

// 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
Copy Markdown
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.

Comment thread pkg/aws/actuator/actuator.go
Comment thread pkg/aws/actuator/actuator_test.go Outdated
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
Copy Markdown
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.

Comment thread pkg/aws/actuator/actuator_test.go Outdated
err = fakeClient.Get(context.TODO(), secretKey, secret)
require.NoError(t, err, "unexpected error retriving Secret")

require.Contains(t, secret.Data, "credentials")
Copy link
Copy Markdown
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.

credentialsRequestInfraMismatch = "InfrastructureMismatch"
)

var defaultRequeueTime = time.Hour + time.Minute*10
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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).
@joelddiaz joelddiaz force-pushed the new-credentials-field branch from 0885d7d to 452bbc4 Compare November 3, 2020 18:33
@sjenning
Copy link
Copy Markdown
Contributor

sjenning commented Nov 3, 2020

/test e2e-aws

@sjenning
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

sjenning commented Nov 6, 2020

/retest

@dgoodwin
Copy link
Copy Markdown
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
Copy Markdown
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

Details 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
Copy Markdown
Contributor

/retest

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

9 similar comments
@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

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

@openshift-bot
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

/cherrypick release-4.6

@openshift-cherrypick-robot
Copy link
Copy Markdown

@joelddiaz: new pull request created: #268

Details

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
Copy Markdown
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
Copy Markdown
Contributor

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

Bugzilla bug 1896918 has been moved to the MODIFIED state.

Details

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
Copy Markdown
Contributor Author

/cherrypick release-4.6

@openshift-cherrypick-robot
Copy link
Copy Markdown

@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

Details

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
Copy Markdown
Member

sdodson commented Nov 11, 2020

/cherrypick release-4.6

@openshift-cherrypick-robot
Copy link
Copy Markdown

@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

Details

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.

wking added a commit to wking/cloud-credential-operator that referenced this pull request Dec 23, 2024
Instead of the hard-coded "an hour ago".  Catching up with 452bbc4
(add new credentials field for AWS Secrets, 2020-11-03, openshift#264), which
created the syncPeriod variable.  This pivot avoids the risk of the
variable being updated and pushing the logs out of sync with the new
duration value.
wking added a commit to wking/cloud-credential-operator that referenced this pull request Dec 26, 2024
Instead of the hard-coded "an hour ago".  Catching up with 452bbc4
(add new credentials field for AWS Secrets, 2020-11-03, openshift#264), which
created the syncPeriod variable.  This pivot avoids the risk of the
variable being updated and pushing the logs out of sync with the new
duration value.
wking added a commit to wking/cloud-credential-operator that referenced this pull request Dec 26, 2024
Instead of the hard-coded "an hour ago".  Catching up with 452bbc4
(add new credentials field for AWS Secrets, 2020-11-03, openshift#264), which
created the syncPeriod variable.  This pivot avoids the risk of the
variable being updated and pushing the logs out of sync with the new
duration value.
wking added a commit to wking/cloud-credential-operator that referenced this pull request Jan 3, 2025
Instead of the hard-coded "an hour ago".  Catching up with 452bbc4
(add new credentials field for AWS Secrets, 2020-11-03, openshift#264), which
created the syncPeriod variable.  This pivot avoids the risk of the
variable being updated and pushing the logs out of sync with the new
duration value.
wking added a commit to wking/cloud-credential-operator that referenced this pull request Jan 3, 2025
Instead of the hard-coded "an hour ago".  Catching up with 452bbc4
(add new credentials field for AWS Secrets, 2020-11-03, openshift#264), which
created the syncPeriod variable.  This pivot avoids the risk of the
variable being updated and pushing the logs out of sync with the new
duration value.
ming1013 pushed a commit to ming1013/cloud-credential-operator that referenced this pull request Dec 15, 2025
add new credentials field for AWS Secrets
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.

8 participants