🤖 fix: enable best-effort SSA create-on-update fallback#82
Merged
Conversation
Allow aggregated storage Update() to fall back to Create() when forceAllowCreate=true and the target coder template/workspace does not exist. This unblocks SSA create-on-update requests while keeping existing update validation and defensive assertions for normal update flows. Added a prominent FIXME in both storage implementations documenting that this is a compatibility hack and outlining future options, with the preferred long-term fix being first-class metadata support in Coder/codersdk. Also added storage tests for both codertemplates and coderworkspaces to validate create-on-update behavior, and documented the SSA limitation and roadmap in the aggregated API deployment guide. --- _Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$2.58`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=2.58 -->
Member
Author
|
@codex review Please review this SSA create-on-update compatibility fallback for aggregated storage, including the FIXME guidance and new coverage. |
Member
Author
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Enable a best-effort create-on-update fallback in aggregated storage for
coderworkspacesandcodertemplateswhen Kubernetes callsUpdatewithforceAllowCreate=true(SSA apply create path).Background
Our aggregated API is a stateless proxy to Coder. SSA (
kubectl apply --server-side) uses PATCH apply semantics that route through update with create-on-missing behavior. We previously rejected that path with405 Method Not Allowed, which blocked SSA users from creating resources via server-side apply.Implementation
TemplateStorage.UpdateandWorkspaceStorage.Updateto:NotFoundon existing object lookup whenforceAllowCreate=trueobjInfo.UpdatedObject(ctx, s.New())Create(...)and returncreated=trueFIXMEcomments in both storage implementations documenting this as a compatibility hack and listing future options:TestTemplateStorageUpdateForceAllowCreateCreatesWhenMissingTestWorkspaceStorageUpdateForceAllowCreateCreatesWhenMissingdocs/how-to/deploy-aggregated-apiserver.md) with SSA behavior and limitations.Validation
make verify-vendorgo test ./internal/aggregated/storage -count=1make testmake buildmake lintmake docs-checkRisks
metadata.managedFieldsis not persisted in the Coder backend.Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$2.58