Skip to content

coordinator: add POST /v1/manifest handler - #2564

Open
charludo wants to merge 1 commit into
ch/sdk-select-versionfrom
ch/post-manifest
Open

coordinator: add POST /v1/manifest handler #2564
charludo wants to merge 1 commit into
ch/sdk-select-versionfrom
ch/post-manifest

Conversation

@charludo

@charludo charludo commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@charludo charludo added the no changelog PRs not listed in the release notes label Aug 4, 2026
@charludo
charludo changed the base branch from main to ch/sdk-select-version August 4, 2026 13:07
Comment thread apitypes/manifest.go
Comment on lines +12 to +14
// PreviousTransitionHash is the expected hash of the latest transition, used for
// compare-and-swap. If unset, the update is not conditional.
PreviousTransitionHash []byte `json:"previous_transition_hash,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mandatory signature is over the candidate transition, which includes the previous transition hash. Thus, the signature is sufficient to guarantee atomicity, and we don't need this argument.

Comment thread apitypes/manifest.go
// Over HTTP this is the only supported way to authorize an update to an existing
// manifest, because the Coordinator can't authenticate the caller by its client
// certificate as it does for aTLS-based gRPC calls.
Signature []byte `json:"signature,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did not care too much about 0/1/N signatures in proto because that's all the same encoding: https://protobuf.dev/programming-guides/proto3/#conditionally-safe-changes. That does not hold in JSON, so we should go for a slice of signatures to allow for future multi-party manifest updates. The code today should assert that it's either 0 or 1, though.

Comment thread apitypes/manifest.go
Comment on lines +27 to +32
// RootCA is the PEM-encoded certificate of the deployment's root CA.
RootCA []byte `json:"root_ca"`
// MeshCA is the PEM-encoded certificate of the deployment's mesh CA.
MeshCA []byte `json:"mesh_ca"`
// SeedSharesDoc is only set when the initial manifest was set.
SeedSharesDoc *SeedShareDocument `json:"seed_shares_doc,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all not trustworthy until covered by attestation - we could create reportdata content similar to /attest, though.

Comment on lines +21 to +23
// maxSetManifestBodySize limits the accepted request body size. A manifest and its policies
// are much smaller than this, but they're the largest input the Coordinator accepts.
const maxSetManifestBodySize = 16 << 20 // 16 MiB

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming a typical policy entry of 128B, this allows for > 100k entries. I had trouble estimating that without doing the calculation, maybe leave a hint.

Slightly unrealistic upper bound: 150k pods, and each pod having a unique policy.

Totally unrealistic upper bound: 130k nodes * 110 pods/node

Comment on lines +46 to +55
contentType := r.Header.Get("Content-Type")
mediaType, _, err := mime.ParseMediaType(contentType)
if err != nil {
writeJSONError(w, http.StatusBadRequest, err)
return
}
if mediaType != "application/json" {
writeJSONError(w, http.StatusUnsupportedMediaType, errContentType)
return
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably common to all endpoints. A pattern I liked was the mux middleware, but we can also just have a common checkMediaType function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PRs not listed in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants