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

API Refactor: switch agent to use new server APIs #1789

Merged
merged 2 commits into from
Aug 13, 2020

Conversation

azdagron
Copy link
Member

This change updates the agent to use the new server APIs unconditionally and removes the experimental flag.

It is a little larger than expected, mostly due to updates to unit-tests that had a strong coupling/dependency on the agent client, in particular the manager tests. I was going to go for a larger refactor but that would be mostly wasted effort since we have planned work that will shake everything up in these layers quite a bit when we implement the agent feature to do a "soft" restart when it needs to re-attest.

@@ -7,6 +7,8 @@ import (
"crypto/rand"
"crypto/tls"
"crypto/x509"
"errors"
Copy link
Member Author

Choose a reason for hiding this comment

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

This file is mostly a renamed version of experimental_test.go.

Bundles map[string]*common.Bundle
}

func (u *Update) String() string {
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is not really used. The cache implementation already has rich logging of the changes to entries and such.

@@ -65,19 +63,20 @@ func (r *rotator) Run(ctx context.Context) error {

func (r *rotator) runRotation(ctx context.Context) error {
for {
if err := r.rotateSVID(ctx); err != nil {
Copy link
Member Author

@azdagron azdagron Aug 12, 2020

Choose a reason for hiding this comment

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

This change causes the rotator to evaluate the SVID for rotation right when Run is executed instead of waiting for the initial period (1.5s). The resolved a flaky unit-test and shouldn't have any real impact on production behavior as far as I can tell.

amartinezfayo
amartinezfayo previously approved these changes Aug 13, 2020
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Thank you @azdagron!

telemetry.RegistrationID: params[i].EntryId,
telemetry.Status: r.Status.Code,
telemetry.Error: r.Status.Message,
}).Warn("Fails to mint X509 SVID")
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
}).Warn("Fails to mint X509 SVID")
}).Warn("Failed to mint X509 SVID")

This change updates the agent to use the new server APIs
unconditionally and removes the experimental flag.

It is a little larger than expected, mostly due to updates to unit-tests
that had a strong coupling/dependency on the agent client, in particular
the manager tests. I was going to go for a larger refactor but that
would be mostly wasted effort since we have planned work that will shake
everything up in these layers quite a bit when we implement the agent
feature to do a "soft" restart when it needs to re-attest.

Signed-off-by: Andrew Harding <andrew.harding@hpe.com>
Also cleaned up some of the types conversion functions now used in the
tests.

Signed-off-by: Andrew Harding <andrew.harding@hpe.com>
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

🚀

@azdagron azdagron merged commit 6c9659b into spiffe:master Aug 13, 2020
@azdagron azdagron deleted the switch-agent-to-new-apis branch August 13, 2020 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants