-
Notifications
You must be signed in to change notification settings - Fork 105
Add token file watcher #979
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
Merged
Merged
Changes from 77 commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
1a17cd5
support reading token from file via config
sean-breen c4b962d
remove empty file
sean-breen d68fe7e
simplify token validation and add unit tests
sean-breen 1b2b029
add unit tests for transport credentials funtions
sean-breen a43cb53
address PR feedback
sean-breen 2ecf102
proto updates
sean-breen 6872207
fix function name
sean-breen 2c30d2c
fix lint error: lll
sean-breen 2ee40ed
add missing PR feedback
sean-breen 3cbf80a
remove error log message
sean-breen 95403c9
fix unit test
sean-breen b36e5fd
Fix apk test package naming (#961)
sean-breen 36f9e3c
Update agent config defaults and format (#959)
aphralG 81a70e1
Add config apply request queue (#949)
dhurley e096397
add unit tests for transport credentials funtions
sean-breen df3b793
fix test name
sean-breen a44ca08
fix error message
sean-breen 8d61593
fix lint error: lll
sean-breen 459c0d5
modify error messages
sean-breen f26c45e
remove error logging and modify messages
sean-breen 371c72b
fall back to token field if error occurs when reading file
sean-breen cd74bd4
Merge branch 'v3' into key-via-file-path
sean-breen c9d792d
fix bad merge
sean-breen e19afb4
restarting gRPC conn
sean-breen e4656a9
remove code from testing
sean-breen 369f19e
fix lint errors: whitespace, revive
sean-breen 1d48001
add new topic for handling Token file updates
sean-breen 4747c13
add CredentialWatcherService
sean-breen a570d6d
adding initial watcher for credential files
sean-breen 572c529
trigger connection reset after credential update
sean-breen 794a184
added ConnectionResetTopic and event processing
sean-breen fcdcc39
Automatically add token-path to Credential watcher
sean-breen f5b6f7f
add function to check credential paths defined in agent config
sean-breen 05b3eae
fix lint
sean-breen 7472cf8
use tokenpath as config option, fixes problem with cli param parsing
sean-breen d488768
add CredentialWatcherService + tests
sean-breen 1b34be4
fix lint errors
sean-breen e909d03
updates to generated files
sean-breen 0100645
Send create connection after disconnect from management plane (#967)
aphralG 7c46a7d
correct yaml key in AuthConfig
sean-breen 7b92819
fix: flaky test (#968)
ryepup 2139a0a
update tests
sean-breen 095ac1d
update tests
sean-breen a011222
wait for create connection
aphralG 5783936
PR feedback
aphralG 082e85d
fix race condition
aphralG c50e333
clean up
aphralG 94893c7
Merge branch 'v3' into start-subscribe-after-connection-created
aphralG 45a9714
clean up
aphralG 0b7c24b
Merge branch 'v3' into add-token-file-watcher
sean-breen 8620567
update grpc connection in command and file plugins
sean-breen 743924a
Merge branch 'start-subscribe-after-connection-created' into add-toke…
sean-breen e821c1d
move log message and fix file_plugin_test.go
sean-breen 687ab69
fix lint
sean-breen 0ebaf6b
Merge branch 'v3' into add-token-file-watcher
sean-breen 87e6c56
handle command and file service client updates after grpc reset
sean-breen b98b24b
update FakeCommandService
sean-breen 0bfa34f
add unit tests
sean-breen afc0d69
fix bad test
sean-breen 889e5da
formatting
sean-breen 04db672
remove test
sean-breen 61b17d7
increase timeout before checking connection after restart
sean-breen 7bc684a
set isConnected to false when handling subscribe errors
sean-breen 5a69209
increase code coverage
sean-breen dcda07a
lint fix
sean-breen cabdd20
fieldalignment
sean-breen 5645b19
remove unused fake
sean-breen dd559aa
PR feedback
sean-breen 9d60914
update fake command service
sean-breen 562c312
more PR feedback
sean-breen 40cd06c
PR feedback: disable watcher during config apply
sean-breen 85cc17a
Merge branch 'v3' into add-token-file-watcher
sean-breen 005cc02
don't pause credential watcher during config apply
sean-breen c895042
debug log messages
sean-breen 071dba7
Add mutex around updating client in the CommandService
sean-breen 23d1193
undo change to metric name
sean-breen 74cf2b7
update test
sean-breen d728fcf
Merge branch 'v3' into add-token-file-watcher
sean-breen 5f579aa
lock watcher when replacing grpc connection
sean-breen cfefced
add lock around subscibe client access
sean-breen 3c7b001
fix lint error
sean-breen 189ed6d
unlock watcher mutex in error case
sean-breen 3c7913c
return with no blank line
sean-breen e0f8169
lint error ?
sean-breen 6a421be
handle rename cases
sean-breen 1f816a9
remove unneccessary cases from switch
sean-breen 95b1027
rewrite switch as if
sean-breen 69176f2
handling kubernetes secret update case
sean-breen a9a14cc
fix test
sean-breen ef4364c
save connection status when resetting file manager service
sean-breen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,8 @@ func (fp *FilePlugin) Info() *bus.Info { | |
|
|
||
| func (fp *FilePlugin) Process(ctx context.Context, msg *bus.Message) { | ||
| switch msg.Topic { | ||
| case bus.ConnectionResetTopic: | ||
| fp.handleConnectionReset(ctx, msg) | ||
| case bus.ConnectionCreatedTopic: | ||
| fp.fileManagerService.SetIsConnected(true) | ||
| case bus.NginxConfigUpdateTopic: | ||
|
|
@@ -81,6 +83,7 @@ func (fp *FilePlugin) Process(ctx context.Context, msg *bus.Message) { | |
|
|
||
| func (fp *FilePlugin) Subscriptions() []string { | ||
| return []string{ | ||
| bus.ConnectionResetTopic, | ||
| bus.ConnectionCreatedTopic, | ||
| bus.NginxConfigUpdateTopic, | ||
| bus.ConfigUploadRequestTopic, | ||
|
|
@@ -91,6 +94,19 @@ func (fp *FilePlugin) Subscriptions() []string { | |
| } | ||
| } | ||
|
|
||
| func (fp *FilePlugin) handleConnectionReset(ctx context.Context, msg *bus.Message) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above with the lock just wondering if when it is being reset the connection needs to be locked |
||
| slog.DebugContext(ctx, "File plugin received connection reset message") | ||
| if newConnection, ok := msg.Data.(grpc.GrpcConnectionInterface); ok { | ||
| err := fp.conn.Close(ctx) | ||
| if err != nil { | ||
| slog.ErrorContext(ctx, "File plugin: unable to close connection", "error", err) | ||
| } | ||
| fp.conn = newConnection | ||
| fp.fileManagerService = NewFileManagerService(fp.conn.FileServiceClient(), fp.config) | ||
| slog.DebugContext(ctx, "File plugin: client reset successfully") | ||
| } | ||
| } | ||
|
|
||
| func (fp *FilePlugin) handleConfigApplyComplete(ctx context.Context, msg *bus.Message) { | ||
| response, ok := msg.Data.(*mpi.DataPlaneResponse) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.