feat: support custom exec-based credential helper in proxy mode

This change allows users to run the registry as a pull-through cache
that can use a credential helper to authenticate against the upstream
registry.

Signed-off-by: Chun-Hung Hsiao <chhsiao@google.com>
This commit is contained in:
Chun-Hung Hsiao
2024-08-13 13:03:36 -07:00
parent 74b07a945f
commit eed9400d26
15 changed files with 839 additions and 6 deletions

View File

@@ -600,12 +600,28 @@ type Proxy struct {
// Password of the hub user
Password string `yaml:"password"`
// Exec specifies a custom exec-based command to retrieve credentials.
// If set, Username and Password are ignored.
Exec *ExecConfig `yaml:"exec,omitempty"`
// TTL is the expiry time of the content and will be cleaned up when it expires
// if not set, defaults to 7 * 24 hours
// If set to zero, will never expire cache
TTL *time.Duration `yaml:"ttl,omitempty"`
}
type ExecConfig struct {
// Command is the command to execute.
Command string `yaml:"command"`
// Lifetime is the expiry period of the credentials. The credentials
// returned by the command is reused through the configured lifetime, then
// the command will be re-executed to retrieve new credentials.
// If set to zero, the command will be executed for every request.
// If not set, the command will only be executed once.
Lifetime *time.Duration `yaml:"lifetime,omitempty"`
}
type Validation struct {
// Enabled enables the other options in this section. This field is
// deprecated in favor of Disabled.