-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: add method to load BlobCacheConfigV2 from file
Add method to load BlobCacheConfigV2 from configuration file. Signed-off-by: Jiang Liu <[email protected]>
- Loading branch information
Showing
6 changed files
with
313 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Configuration file for Nydus Image Service | ||
|
||
type = "bootstrap" | ||
id = "image1" | ||
domain_id = "domain1" | ||
|
||
# Configuration file format version number, must be 2. | ||
[config_v2] | ||
version = 2 | ||
# Identifier for the instance. | ||
id = "my_id" | ||
# Optional file path for metadata blobs, for BlobCacheEntry only. | ||
metadata_path = "/path/to/rafs/meta/data/blob" | ||
|
||
[config_v2.backend] | ||
# Type of storage backend, valid values: "localfs", "oss", "registry" | ||
type = "localfs" | ||
|
||
[config_v2.backend.localfs] | ||
blob_file = "/tmp/nydus.blob.data" | ||
dir = "/tmp" | ||
alt_dirs = ["/var/nydus/cache"] | ||
|
||
[config_v2.backend.oss] | ||
# Oss http scheme, either 'http' or 'https' | ||
scheme = "http" | ||
# Oss endpoint | ||
endpoint = "my_endpoint" | ||
# Oss bucket name | ||
bucket_name = "my_bucket_name" | ||
# Prefix object_prefix to OSS object key, for example the simulation of subdirectory: | ||
object_prefix = "my_object_prefix" | ||
# Oss access key | ||
access_key_id = "my_access_key_id" | ||
# Oss secret | ||
access_key_secret = "my_access_key_secret" | ||
# Skip SSL certificate validation for HTTPS scheme. | ||
skip_verify = true | ||
# Drop the read request once http request timeout, in seconds. | ||
timeout = 10 | ||
# Drop the read request once http connection timeout, in seconds. | ||
connect_timeout = 10 | ||
# Retry count when read request failed. | ||
retry_limit = 5 | ||
|
||
[config_v2.backend.oss.proxy] | ||
# Access remote storage backend via proxy, e.g. Dragonfly dfdaemon server URL. | ||
url = "localhost:6789" | ||
# Proxy health checking endpoint. | ||
ping_url = "localhost:6789/ping" | ||
# Fallback to remote storage backend if proxy ping failed. | ||
fallback = true | ||
# Interval for proxy health checking, in seconds. | ||
check_interval = 5 | ||
# Replace URL to http to request source registry with proxy, and allow fallback to https if the proxy is unhealthy. | ||
use_http = false | ||
|
||
[[config_v2.backend.oss.mirrors]] | ||
# Mirror server URL, for example http://127.0.0.1:65001. | ||
host = "http://127.0.0.1:65001" | ||
# Ping URL to check mirror server health. | ||
ping_url = "http://127.0.0.1:65001/ping" | ||
# HTTP request headers to be passed to mirror server. | ||
# headers = | ||
# Whether the authorization process is through mirror, default to false. | ||
auth_through = true | ||
# Interval for mirror health checking, in seconds. | ||
health_check_interval = 5 | ||
# Maximum number of failures before marking a mirror as unusable. | ||
failure_limit = 5 | ||
|
||
[config_v2.backend.registry] | ||
# Registry http scheme, either 'http' or 'https' | ||
scheme = "https" | ||
# Registry url host | ||
host = "my.registry.com" | ||
# Registry image name, like 'library/ubuntu' | ||
repo = "nydus" | ||
# Base64_encoded(username:password), the field should be sent to registry auth server to get a bearer token. | ||
auth = "base64_encoded" | ||
# Skip SSL certificate validation for HTTPS scheme. | ||
skip_verify = true | ||
# Drop the read request once http request timeout, in seconds. | ||
timeout = 10 | ||
# Drop the read request once http connection timeout, in seconds. | ||
connect_timeout = 10 | ||
# Retry count when read request failed. | ||
retry_limit = 5 | ||
# The field is a bearer token to be sent to registry to authorize registry requests. | ||
registry_token = "bear_token" | ||
# The http scheme to access blobs. | ||
# It is used to workaround some P2P subsystem that requires a different scheme than the registry. | ||
blob_url_scheme = "https" | ||
# Redirect blob access to a different host regardless of the one specified in 'host'. | ||
blob_redirected_host = "redirect.registry.com" | ||
|
||
[config_v2.backend.registry.proxy] | ||
# Access remote storage backend via proxy, e.g. Dragonfly dfdaemon server URL. | ||
url = "localhost:6789" | ||
# Proxy health checking endpoint. | ||
ping_url = "localhost:6789/ping" | ||
# Fallback to remote storage backend if proxy ping failed. | ||
fallback = true | ||
# Interval for proxy health checking, in seconds. | ||
check_interval = 5 | ||
# Replace URL to http to request source registry with proxy, and allow fallback to https if the proxy is unhealthy. | ||
use_http = false | ||
|
||
[[config_v2.backend.registry.mirrors]] | ||
# Mirror server URL, for example http://127.0.0.1:65001. | ||
host = "http://127.0.0.1:65001" | ||
# Ping URL to check mirror server health. | ||
ping_url = "http://127.0.0.1:65001/ping" | ||
# HTTP request headers to be passed to mirror server. | ||
# headers = | ||
# Whether the authorization process is through mirror, default to false. | ||
auth_through = true | ||
# Interval for mirror health checking, in seconds. | ||
health_check_interval = 5 | ||
# Maximum number of failures before marking a mirror as unusable. | ||
failure_limit = 5 | ||
|
||
[config_v2.cache] | ||
# Type of blob cache: "blobcache", "filecache", "fscache", "dummycache" or "" | ||
type = "filecache" | ||
# Whether to cache compressed or uncompressed data. | ||
compressed = true | ||
# Whether to validate data read from the cache. | ||
validate = true | ||
|
||
[config_v2.cache.filecache] | ||
work_dir = "." | ||
|
||
[config_v2.cache.fscache] | ||
work_dir = "." | ||
|
||
[config_v2.cache.prefetch] | ||
# Whether to enable blob data prefetching. | ||
enable = true | ||
# Number of data prefetching working threads, valid values: 1-1024. | ||
threads = 8 | ||
# The batch size to prefetch data from backend, valid values: 0-0x10000000. | ||
batch_size = 1000000 | ||
# Network bandwidth rate limit in unit of Bytes and Zero means no limit. | ||
bandwidth_limit = 10000000 |
This file contains 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
Oops, something went wrong.