gcrane

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 15 Imported by: 21

Documentation

Overview

Package gcrane holds libraries used to implement the gcrane CLI.

Index

Constants

This section is empty.

Variables

Keychain tries to use google-specific credential sources, falling back to the DefaultKeychain (config-file based).

Functions

func Copy

func Copy(src, dst string, opts ...Option) error

Copy copies a remote image or index from src to dst.

func CopyRepository

func CopyRepository(ctx context.Context, src, dst string, opts ...Option) error

CopyRepository copies everything from the src GCR repository to the dst GCR repository.

func GCRBackoff

func GCRBackoff() retry.Backoff

GCRBackoff returns a retry.Backoff that is suitable for use with gcr.io.

These numbers are based on GCR's posted quotas: https://cloud.google.com/container-registry/quotas - 30k requests per 10 minutes. - 500k requests per 24 hours.

On error, we will wait for: - 6 seconds (in case of very short term 429s from GCS), then - 1 minute (in case of temporary network issues), then - 10 minutes (to get around GCR 10 minute quotas), then fail.

TODO: In theory, we could keep retrying until the next day to get around the 500k limit.

Types

type Option

type Option func(*options)

Option is a functional option for gcrane operations.

func WithAuth added in v0.6.0

func WithAuth(auth authn.Authenticator) Option

WithAuth is a functional option for overriding the default authenticator for remote operations.

By default, gcrane will use gcrane.Keychain.

func WithContext added in v0.6.0

func WithContext(ctx context.Context) Option

WithContext is a functional option for setting the context.

func WithJobs

func WithJobs(jobs int) Option

WithJobs sets the number of concurrent jobs to run.

The default number of jobs is GOMAXPROCS.

func WithKeychain added in v0.6.0

func WithKeychain(keys authn.Keychain) Option

WithKeychain is a functional option for overriding the default authenticator for remote operations, using an authn.Keychain to find credentials.

By default, gcrane will use gcrane.Keychain.

func WithTransport added in v0.6.0

func WithTransport(t http.RoundTripper) Option

WithTransport is a functional option for overriding the default transport for remote operations.

func WithUserAgent added in v0.5.0

func WithUserAgent(ua string) Option

WithUserAgent adds the given string to the User-Agent header for any HTTP requests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL