Skip to content
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

feat(oci): set token expiration for oci client #2417

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/oci/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const MAX_LAYER_COUNT: usize = 500;
/// rather than pushing as a separate layer
const DEFAULT_CONTENT_REF_INLINE_MAX_SIZE: usize = 128;

/// Default token expiration when pushing/pulling an image to/from a registry.
/// This value is used by the underyling OCI client when the token expiration
/// is unspecified on a claim.
/// This essentially equates to a timeout for push/pull.
const DEFAULT_TOKEN_EXPIRATION_SECS: usize = 300;

/// Mode of assembly of a Spin application into an OCI image
enum AssemblyMode {
/// Assemble the application as one layer per component and one layer for
Expand Down Expand Up @@ -643,6 +649,7 @@ impl Client {

oci_distribution::client::ClientConfig {
protocol,
default_token_expiration_secs: DEFAULT_TOKEN_EXPIRATION_SECS,
..Default::default()
}
}
Expand Down
Loading