Skip to content

feat: use proto streams to increase maximum module files payload #18268

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 6, 2025

What this does

Protobuf has a maximum message size, configured to 4mb.

Dynamic parameters requires the remotely fetched module files located in ~/.terraform/modules for evaluation. These can exceed the maximum message size. To allow for templates with larger modules, this PR adds a proto stream to stream over the file in chunks. The resulting file is inserted to the database, and then referenced by filehash.

Note every template version for a given template will have the same module_files (assuming no provider changes). So most module files are deduplicated per version. In the future, it might be even more advantageous to upload individual modules to reuse across various templates.

Implementation

Coderd <-> Provisionerd

If the module_files are too large, it uses a new protobuf stream to send and upload the file before the CompleteJob fires:

// UploadFile streams files to be inserted into the database.
// The file upload_type should be used to determine how to handle the file.
rpc UploadFile(stream UploadFileRequest) returns (Empty);

The CompleteJob references the file uploaded by its hash and its type.

Provisionerd <-> Provisioner

This communication all happens in memory today right? No actual networks?

Since a stream is already used, DataUpload and ChunkPiece are added to the existing stream.

@Emyrk Emyrk force-pushed the stevenmasley/4mb branch from 4807dbc to 124d366 Compare June 6, 2025 14:19
@Emyrk Emyrk changed the title Stevenmasley/4mb feat: increase maximum module files payload using proto streams Jun 6, 2025
@Emyrk Emyrk changed the title feat: increase maximum module files payload using proto streams feat: use proto streams to increase maximum module files payload Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy