Repository navigation
fix(compute/serve): provide default override_host to Viceroy via temporary manifest and support IPv6 hostnames - #1940
Conversation
|
Hi @Tyagiquamar - please use our PR template: |
|
Done — the PR description now follows the template. I also merged current |
philippschulte
left a comment
There was a problem hiding this comment.
Thanks for your contribution and for working on this fix! We appreciate you taking the time to address this issue and add regression test coverage.
I've left a couple of comments regarding some potential edge cases and the handling of the manifest file.
WhiteAbeLincoln
left a comment
There was a problem hiding this comment.
I agree with @philippschulte, we probably want to write the new config to a temporary file as was suggested in #1435.
|
Thanks for the reviews and feedback @philippschulte and @WhiteAbeLincoln! I have updated the implementation to address both items:
All tests pass cleanly. |
philippschulte
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous feedback! LGTM.
|
@Tyagiquamar can you please fix the following linter error: After that this is good to be merged. Thanks! |
Signed-off-by: Tyagiquamar <[email protected]>
|
@philippschulte Fixed the gocritic \elseif\ linter warning in \pkg/commands/compute/serve_internal_test.go\ in commit 6b12db4. Thanks! |
|
@WhiteAbeLincoln @philippschulte I have updated setBackendsWithDefaultOverrideHostIfMissing in commit d485d26 to write the temporary manifest file atomically: |
|
@Tyagiquamar thanks for the update! One minor question: Do we actually need the additional staging file and rename here? Since the temporary manifest path isn't passed to Viceroy until after Unless there's another reason for requiring an atomic rename, could we keep the simpler single-temporary-file approach? |
philippschulte
left a comment
There was a problem hiding this comment.
@Tyagiquamar thanks for the update and for simplifying the temporary manifest handling!
The changes look good to me now. I appreciate you taking the time to address all the feedback and add regression test coverage.
Thanks for your contribution!
Request changes have been applied.
Change summary
Fixes #1435. When
fastly compute serveruns, if local server backends are missingoverride_hostand use a hostname URL:override_hostto a temporary file passed to Viceroy (-C), keeping the user's projectfastly.tomluntouched on disk, and cleans up the temporary file on exit viadefer os.Remove. If no backends require defaultoverride_host, the original manifest path is used without creating a temporary file.u.Hostname()instead of splitting on:so IPv6 addresses (such ashttp://[::1]:8080) are correctly recognized bynet.ParseIP()and skipped as IP backends rather than incorrectly treated as hostnames.serve_internal_test.gocovering temporary manifest generation, non-mutation of user files, cleanup, and backend URL variants (hostname with/without port, IPv4, IPv6, existingoverride_host).All Submissions:
New Feature Submissions:
Changes to Core Features:
User Impact
Running
fastly compute serveno longer permanently modifies the user'sfastly.tomlfile when defaultoverride_hostvalues are applied for Viceroy. IPv6 backend URLs likehttp://[::1]:8080are now correctly recognized as IP addresses without bracket extraction errors.Are there any considerations that need to be addressed for release?
None: no breaking changes or flags introduced.