-
Notifications
You must be signed in to change notification settings - Fork 511
Use UpstreamAuthority.SubscribeToLocalBundle RPC #6090
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
base: main
Are you sure you want to change the base?
Conversation
85660f5
to
ad8c3f6
Compare
89f91df
to
1379d0d
Compare
1379d0d
to
85193c8
Compare
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
85193c8
to
9728575
Compare
err := util.RunTasks(ctx, | ||
func(ctx context.Context) error { | ||
return r.rotateEvery(ctx, rotateInterval) | ||
}, | ||
func(ctx context.Context) error { | ||
var lastError error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may we move this to Subscribe?
and only start when we really need to subscribe
@@ -151,6 +151,43 @@ func TestUpstreamClientPublishJWTKey_NotImplemented(t *testing.T) { | |||
require.Nil(t, jwtKeys) | |||
} | |||
|
|||
func TestUpstreamClientSubscribeToLocalBundle(t *testing.T) { | |||
client, updater, ua := setUpUpstreamClientTest(t, fakeupstreamauthority.Config{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client, updater, ua := setUpUpstreamClientTest(t, fakeupstreamauthority.Config{ | |
client, updater, ua := setupUpstreamClientTest(t, fakeupstreamauthority.Config{ |
// We should get an update with the initial CA and a list of empty JWT keys since | ||
// the fakeupstreamauthority does not create one by default. | ||
require.Equal(t, ua.X509Roots(), updater.WaitForAppendedX509Roots(t)) | ||
spiretest.RequireProtoListEqual(t, []*common.PublicKey{}, updater.WaitForAppendedJWTKeys(t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Empty?
@@ -32,6 +32,16 @@ type UpstreamAuthority interface { | |||
// the upstream authority does not support streaming updates, the stream | |||
// will return io.EOF when called. | |||
PublishJWTKey(ctx context.Context, jwtKey *common.PublicKey) (jwtAuthorities []*common.PublicKey, stream UpstreamJWTAuthorityStream, err error) | |||
|
|||
// GetUpstreamAuthorities can be used to sync the local trust bundle with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// GetUpstreamAuthorities can be used to sync the local trust bundle with | |
// SubscribeToLocalBundle can be used to sync the local trust bundle with |
} | ||
|
||
x509Authorities, err := s.v1.parseX509Authorities(resp.UpstreamX509Roots) | ||
if len(resp.UpstreamX509Roots) != 0 && err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why to verify roots length? parse may return no error only when there was something to parse, right?
@@ -1,5 +1,7 @@ | |||
#!/bin/bash | |||
|
|||
pwd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this?
Pull Request check list
Affected functionality
UpstreamAuthority plugins.
Description of change
If the UpstreamAuthority plugin implements the GetTrustBundle RPC use it to keep the trust bundle of the trust domain in sync. This allows us to get bundle updates before we create a new CA or key.
Which issue this PR fixes
fixes #6083