Skip to content

encryption: fix freezing key controller#615

Merged
openshift-merge-robot merged 4 commits intoopenshift:masterfrom
sttts:sttts-encryption-frozen-key-controller
Nov 28, 2019
Merged

encryption: fix freezing key controller#615
openshift-merge-robot merged 4 commits intoopenshift:masterfrom
sttts:sttts-encryption-frozen-key-controller

Conversation

@sttts
Copy link
Copy Markdown
Contributor

@sttts sttts commented Nov 28, 2019

The key controller was still just expecting one read-key, while with the recent change for backup/restore we always preserve one more key. This made the key controller freeze after the first two read-keys were in the config.

While fixing the upper, we also run into the case that during pruning this one more read-key is preserved, but this read-key must be backed. Hence, we have to preserve also all other unbacked read-keys in between.

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 28, 2019
@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 28, 2019
@sttts sttts force-pushed the sttts-encryption-frozen-key-controller branch from 54f1ce1 to 2977f17 Compare November 28, 2019 10:08
},

{
name: "create a new write key when the previous key expired and another read key exists",
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.

shouldn't we validate if a new key was created? (validateFunc function)

"list:pods:kms",
"get:secrets:kms",
"list:secrets:openshift-config-managed",
"create:secrets:openshift-config-managed",
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.

this only says that something was created ;)

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.

that's a general issue in this test, isn't it? But what else do we create in the key controller than keys? :)

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.

yeah, hard to beat that argument :)

for i, k := range recentFirstSortedKeys {
if allMigrated, missing, _ := MigratedFor(grs, k); allMigrated {
return recentFirstSortedKeys[:i+1]
if i+1 < len(recentFirstSortedKeys) {
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.

this looks to be safe, we could have a unit test for it.

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.

what do you want to test?

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.

we have tests that "one more read-key" is fine. So this is covered. The rest here is just Golang standard behaviour.

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.

sgtm.

@p0lyn0mial
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 28, 2019
@openshift-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: p0lyn0mial, sttts

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-merge-robot openshift-merge-robot merged commit 3cbe82d into openshift:master Nov 28, 2019
bertinatto pushed a commit to bertinatto/library-go that referenced this pull request Jul 2, 2020
…ey-controller

encryption: fix freezing key controller
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants