pub enum ConnectSpec {
Filesystem {
path: PathBuf,
},
S3 {
bucket: String,
endpoint: Option<String>,
prefix: Option<String>,
region: Option<String>,
disable_tls: bool,
disable_tls_verification: bool,
ambient_credentials: bool,
},
Azure {
container: String,
storage_account: Option<String>,
prefix: Option<String>,
},
Gcs {
bucket: String,
prefix: Option<String>,
credentials_file: Option<String>,
},
B2 {
bucket: String,
prefix: Option<String>,
},
Sftp {
host: String,
path: String,
port: Option<u16>,
username: Option<String>,
keyfile: Option<String>,
known_hosts: Option<String>,
},
WebDav {
url: String,
},
Rclone {
remote_path: String,
config_file: Option<String>,
startup_timeout: Option<String>,
},
Gdrive {
folder_id: String,
credentials_file: Option<String>,
},
FromConfig {
file: Option<String>,
token: Option<String>,
},
Server {
url: String,
fingerprint: Option<String>,
},
}Expand description
A typed description of how to reach a kopia repository. This is the input to
KopiaClient::repository_connect / KopiaClient::repository_create.
Externally-tagged so exactly one backend is representable (mirrors the API
crate’s Backend discipline, though this is a separate, simpler type with
no kube dependency).
§Credentials are NOT here
Secrets are supplied two ways, never on argv. Env-delivered secrets (set with
KopiaClientBuilder::env) cover the backends kopia reads from the
environment; file-delivered secrets are written to a file by the caller (the
mover) and the path is passed in the relevant ConnectSpec field. Either
way only non-secret identifiers (bucket, host, path, …) and file paths live
in ConnectSpec, so a secret never leaks into a ConfigMap, a process listing,
or an error message. The relevant kopia inputs by backend:
- S3:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN(env) - Azure:
AZURE_STORAGE_KEY/AZURE_STORAGE_SAS_TOKEN(env; or SP env) - B2:
B2_KEY_ID,B2_KEY(env) - WebDAV:
KOPIA_WEBDAV_USERNAME,KOPIA_WEBDAV_PASSWORD(env) - GCS:
Gcs::credentials_file→--credentials-file(a JSON file path) - SFTP:
Sftp::keyfile/known_hosts→--keyfile/--known-hosts(file paths) - rclone:
Rclone::config_file→ rclone--config(a file path) - all:
KOPIA_PASSWORD(the repository encryption password; env)
This is the full set of kopia 0.23 repository connect/create backends. The
operator’s CRD Backend enum maps onto the first eight; Gdrive,
FromConfig, and Server are exposed for client completeness (a kopia
client connecting to an existing kopia API server is a legitimate backend —
distinct from running a server, which the operator deliberately does not do).
Variants§
Filesystem
Filesystem backend at a local path (used in-cluster for hostPath/PVC repos and in tests).
S3
S3-compatible backend.
Fields
disable_tls: boolTalk plain HTTP to the endpoint (--disable-tls). For HTTP-only
endpoints (in-cluster MinIO/RustFS); kopia otherwise assumes HTTPS.
ambient_credentials: boolAuthenticate via the ambient AWS credential chain (IRSA web-identity,
EKS Pod Identity, IMDS) instead of static keys — the workload-identity
path. kopia 0.23 marks --access-key/--secret-access-key as
required flags (env-bound to AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY),
but its storage layer skips empty static credentials and falls through
minio-go’s chain — so this renders the flags explicitly empty
(--access-key=), which satisfies the parser and engages the chain.
Azure
Azure Blob Storage backend.
Fields
Gcs
Google Cloud Storage backend.
Fields
B2
Backblaze B2 backend.
Sftp
SFTP/SSH backend.
Fields
WebDav
WebDAV backend.
Rclone
Rclone backend (shells out to an rclone binary).
Fields
Gdrive
Google Drive backend.
Fields
FromConfig
Reconnect from a kopia configuration token/file (repository connect from-config). Exactly one of file/token is meaningful.
Fields
Server
Connect to an existing kopia API server as a client.
Implementations§
Source§impl ConnectSpec
impl ConnectSpec
Sourcepub fn kind_str(&self) -> &'static str
pub fn kind_str(&self) -> &'static str
Stable discriminant string for logging/metrics (mirrors
kopiur_api::backend::Backend::kind_str).
use std::path::PathBuf;
use kopiur_kopia::ConnectSpec;
let fs = ConnectSpec::Filesystem { path: PathBuf::from("/repo") };
assert_eq!(fs.kind_str(), "filesystem");
let s3 = ConnectSpec::S3 {
bucket: "backups".into(),
endpoint: Some("https://minio.local".into()),
prefix: None,
region: None,
disable_tls: false,
disable_tls_verification: false,
ambient_credentials: false,
};
assert_eq!(s3.kind_str(), "s3");Sourcepub fn direct_credential_env_names(&self) -> &'static [&'static str]
pub fn direct_credential_env_names(&self) -> &'static [&'static str]
The environment-variable names kopia reads this backend’s credentials from
directly (no intermediate file). These are exactly the vars the
replication mover remaps from their KOPIUR_DEST_-prefixed copies onto their
plain names for the sync-to subprocess, so the destination authenticates
with its own keys instead of the source’s identically named ones (issue #200).
Exhaustive over ConnectSpec so a new backend cannot compile until its
credential-delivery mechanism is decided. File-based backends (GCS/SFTP/
Rclone/Gdrive) deliver credentials as a materialized file whose path is on
argv, so they read no direct credential env var and return &[] — the mover
stages their destination file separately. AWS_WEB_IDENTITY_TOKEN_FILE and
the other ambient-chain hints are deliberately excluded: they belong to the
pod’s ServiceAccount (a workload-identity destination), not to a credential
Secret, and must never be remapped or unset.
Trait Implementations§
Source§impl Clone for ConnectSpec
impl Clone for ConnectSpec
Source§fn clone(&self) -> ConnectSpec
fn clone(&self) -> ConnectSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectSpec
impl Debug for ConnectSpec
Source§impl PartialEq for ConnectSpec
impl PartialEq for ConnectSpec
Source§fn eq(&self, other: &ConnectSpec) -> bool
fn eq(&self, other: &ConnectSpec) -> bool
self and other values to be equal, and is used by ==.