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

encryption provider #347

Merged

Conversation

p0lyn0mial
Copy link
Contributor

No description provided.

@p0lyn0mial
Copy link
Contributor Author

/assign @sttts

@p0lyn0mial p0lyn0mial force-pushed the with-encryption-provider branch 2 times, most recently from 4e64656 to 0f15957 Compare April 1, 2020 09:07
}
if changed, newEncryptedGRsToManageSet := haveGRsChanged(p.currentEncryptedGRs, newEncryptedGRsToManage); changed {
p.eventRecorder.Eventf("EncryptedGRsChanged", "The new GroupResource list this operator will manage is %v", newEncryptedGRsToManageSet.List())
p.currentEncryptedGRs = newEncryptedGRsToManage
Copy link
Contributor

Choose a reason for hiding this comment

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

this is wrong spot. Also state like this is an anti-pattern. Side-effects from a getter like this are very unexpected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which getter? the value is read from the cache and won't change once set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the state (currentEncryptedGRs) was introduced to emit an event only once it has changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is wrong spot.

why ? we assign to currentEncryptedGRs only when it has changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't clear with my comment. Emitting events from a getter like this seems to be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wouldn't it be nice to know that the list have changed (debuggability)?
frequent events might indicate errors.

@p0lyn0mial
Copy link
Contributor Author

/retest

@@ -67,37 +61,18 @@ func (p *encryptionProvider) EncryptedGRs() []schema.GroupResource {
return p.allEncryptedGRs // case 1 - we are in charge
}

// case 2 - CAO is in charge, reduce the list
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could make the reduced list to be static too

Copy link
Contributor

Choose a reason for hiding this comment

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

or have a subtract func

@sttts
Copy link
Contributor

sttts commented Apr 2, 2020

/lgtm
/approve

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

[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

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2020
@openshift-merge-robot openshift-merge-robot merged commit bfca8fe into openshift:master Apr 2, 2020
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

4 participants