-
Notifications
You must be signed in to change notification settings - Fork 0
Harden registry rename and startup recovery #197
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 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ec88514
Harden registry rename and startup recovery
bnema 637b278
Clarify startup recovery behavior and tests
bnema 2b371d2
Refresh auto-route domains and dedupe attachments
bnema 53f9355
Assert config load in registry matching tests
bnema 95b3044
Remove dead restart policy migration path
bnema 29c9fdd
Merge branch 'main' into feat/registry-rename-startup-recovery-hardening
bnema 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package app | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/bnema/zerowrap" | ||
|
|
||
| "github.com/bnema/gordon/internal/domain" | ||
| ) | ||
|
|
||
| // startupConfigService defines the route configuration needed during startup | ||
| // recovery. It intentionally excludes auto-route settings because reboot | ||
| // recovery always works from configured routes. | ||
| type startupConfigService interface { | ||
| GetRoutes(ctx context.Context) []domain.Route | ||
| } | ||
|
|
||
| // startupContainerService defines the container lifecycle operations needed | ||
| // during startup recovery. | ||
| type startupContainerService interface { | ||
| SyncContainers(ctx context.Context) error | ||
| AutoStart(ctx context.Context, routes []domain.Route) error | ||
| StartMonitor(ctx context.Context) | ||
| } | ||
|
|
||
| // syncAndRecoverConfiguredRoutes performs best-effort startup recovery for | ||
| // configured routes after listeners are ready. | ||
| func syncAndRecoverConfiguredRoutes( | ||
| ctx context.Context, | ||
| configSvc startupConfigService, | ||
| containerSvc startupContainerService, | ||
| log zerowrap.Logger, | ||
| ) { | ||
| defer containerSvc.StartMonitor(ctx) | ||
|
|
||
| if err := containerSvc.SyncContainers(ctx); err != nil { | ||
| log.Warn().Err(err).Msg("failed to sync existing containers") | ||
| } | ||
|
|
||
| routes := configSvc.GetRoutes(ctx) | ||
| if err := containerSvc.AutoStart(domain.WithInternalDeploy(ctx), routes); err != nil { | ||
| log.Warn().Err(err).Msg("failed to auto-start configured routes") | ||
| } | ||
| } |
Oops, something went wrong.
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.
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.
Refresh auto-route registry domains on hot reload.
Lines 1975-1977 bind
registryDomainandlegacyRegistryDomainsfrom the startupcfg, so later config reloads never update theautoRouteHandler. After changingserver.gordon_domainorserver.legacy_registry_domainsat runtime, image-push ownership checks will still use the old host set until Gordon is restarted, which breaks the staged-rename flow this PR is adding. Make the handler read the current domains fromconfigSvcper event, or rebuild/rebind it when config reload completes.🤖 Prompt for AI Agents