Documentation
¶
Index ¶
Constants ¶
const ( SchemaVersion = 1 DefaultConfigPath = "/etc/gha-fleet/rustfs-cache-identities.yaml" DefaultCredentialsDirectory = "/etc/garm/cache" DefaultCAFile = "/etc/gha-fleet/trust/rustfs-ca.pem" DefaultRootAccessKeyFile = "/etc/gha-fleet/secrets/rustfs-access-key" DefaultRootSecretKeyFile = "/etc/gha-fleet/secrets/rustfs-secret-key" DefaultClaimJournalFile = "/var/lib/gha-cache-broker/claims.json" DefaultClaimJournalLockFile = "/var/lib/gha-cache-broker/claims.lock" MaximumConfigBytes = 64 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ValidateEndpoint ¶
ValidateEndpoint accepts the deployment address while refusing DNS, credentials, alternate ports and non-origin URL components. The exact IP is estate data and must not be compiled into this public package.
Types ¶
type Config ¶
type Config struct {
SchemaVersion int `yaml:"schema_version" json:"schema_version"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
Region string `yaml:"region" json:"region"`
CAFile string `yaml:"ca_file" json:"ca_file"`
RootAccessKeyFile string `yaml:"root_access_key_file" json:"root_access_key_file"`
RootSecretKeyFile string `yaml:"root_secret_key_file" json:"root_secret_key_file"`
CredentialsDirectory string `yaml:"credentials_directory" json:"credentials_directory"`
Bucket string `yaml:"bucket" json:"bucket"`
QuotaBytes int64 `yaml:"quota_bytes" json:"quota_bytes"`
ClaimEndpoint string `yaml:"claim_endpoint" json:"claim_endpoint"`
ClaimJournalFile string `yaml:"claim_journal_file" json:"claim_journal_file"`
ClaimJournalLockFile string `yaml:"claim_journal_lock_file" json:"claim_journal_lock_file"`
Identities []Identity `yaml:"identities" json:"identities"`
}
func (Config) Repository ¶
Repository returns the exact repository authorized by all configured cache identities. Validate proves every role shares this root.
func (Config) SortedIdentities ¶
func (Config) ValidateProductionPaths ¶
ValidateProductionPaths pins mutable credential material to the reviewed host boundary. Validate intentionally permits a temporary directory so the filesystem and reconciliation contracts can be exercised without root.
type Credential ¶
type Delivery ¶
type Delivery struct {
Role string
Endpoint string
Region string
Bucket string
Prefix string
Mode string
AccessKey string
SecretKey []byte
CAPEM []byte
}
Delivery is the smallest cache identity representation allowed to cross the host-to-disposable-worker boundary. SecretKey and CAPEM remain byte slices so callers can erase their copies after Incus accepts the file.
func LoadDelivery ¶
func LoadDelivery(config Config, role string, credentialUID, credentialGID, caUID, caGID int) (Delivery, error)
LoadDelivery validates and reads exactly one reconciled identity. It does not accept root credentials and does not mutate either local or remote state. The caller supplies the reviewed host ownership contract so the same checks can be exercised without privileged test fixtures.
type HTTPRequester ¶
type HTTPRequester struct {
Endpoint string
Region string
Client *http.Client
Now func() time.Time
}
func NewHTTPRequester ¶
func NewHTTPRequester(config Config) (*HTTPRequester, error)
func (*HTTPRequester) Do ¶
func (r *HTTPRequester) Do( ctx context.Context, credential Credential, method, requestPath, contentType string, body []byte, ) (Response, error)
type IdentityResult ¶
type Result ¶
type Result struct {
SchemaVersion int `json:"schema_version"`
Applied bool `json:"applied"`
LocalState string `json:"local_state"`
StateBefore string `json:"state_before"`
StateAfter string `json:"state_after"`
Bucket string `json:"bucket"`
QuotaBytes int64 `json:"quota_bytes"`
Actions []string `json:"actions"`
Identities []IdentityResult `json:"identities"`
}