From fc9097f5ebbb1217e7504bb041435cc20a182eaf Mon Sep 17 00:00:00 2001 From: Alex Barbato Date: Tue, 26 Dec 2023 15:04:41 -0500 Subject: [PATCH] Initial commit --- pkg/vendir/config/directory.go | 2 ++ pkg/vendir/fetch/image/imgpkg.go | 3 ++- pkg/vendir/fetch/image/sync.go | 1 + pkg/vendir/fetch/imgpkgbundle/sync.go | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/vendir/config/directory.go b/pkg/vendir/config/directory.go index 66ac73e1..406691a6 100644 --- a/pkg/vendir/config/directory.go +++ b/pkg/vendir/config/directory.go @@ -116,6 +116,7 @@ type DirectoryContentsImage struct { // +optional SecretRef *DirectoryContentsLocalRef `json:"secretRef,omitempty"` + ResponseHeaderTimeout int `json:"responseHeaderTimeout,omitempty"` DangerousSkipTLSVerify bool `json:"dangerousSkipTLSVerify,omitempty"` } @@ -134,6 +135,7 @@ type DirectoryContentsImgpkgBundle struct { // +optional SecretRef *DirectoryContentsLocalRef `json:"secretRef,omitempty"` + ResponseHeaderTimeout int `json:"responseHeaderTimeout,omitempty"` DangerousSkipTLSVerify bool `json:"dangerousSkipTLSVerify,omitempty"` Recursive bool `json:"recursive,omitempty"` } diff --git a/pkg/vendir/fetch/image/imgpkg.go b/pkg/vendir/fetch/image/imgpkg.go index 40565060..01a73b22 100644 --- a/pkg/vendir/fetch/image/imgpkg.go +++ b/pkg/vendir/fetch/image/imgpkg.go @@ -26,6 +26,7 @@ const ( type ImgpkgOpts struct { SecretRef *ctlconf.DirectoryContentsLocalRef DangerousSkipTLSVerify bool + ResponseHeaderTimeout int EnvironFunc func() []string } @@ -158,7 +159,7 @@ func (t *Imgpkg) RegistryOpts() (registry.Opts, error) { opts := registry.Opts{ VerifyCerts: !t.opts.DangerousSkipTLSVerify, Insecure: false, - ResponseHeaderTimeout: 30 * time.Second, + ResponseHeaderTimeout: time.Duration(t.opts.ResponseHeaderTimeout|30) * time.Second, RetryCount: 5, EnvironFunc: func() []string { return append(envVariables, t.opts.EnvironFunc()...) diff --git a/pkg/vendir/fetch/image/sync.go b/pkg/vendir/fetch/image/sync.go index 78dd2ea8..1590b320 100644 --- a/pkg/vendir/fetch/image/sync.go +++ b/pkg/vendir/fetch/image/sync.go @@ -21,6 +21,7 @@ func NewSync(opts ctlconf.DirectoryContentsImage, refFetcher ctlfetch.RefFetcher imgpkgOpts := ImgpkgOpts{ SecretRef: opts.SecretRef, DangerousSkipTLSVerify: opts.DangerousSkipTLSVerify, + ResponseHeaderTimeout: opts.ResponseHeaderTimeout, } return &Sync{opts, NewImgpkg(imgpkgOpts, refFetcher, c)} } diff --git a/pkg/vendir/fetch/imgpkgbundle/sync.go b/pkg/vendir/fetch/imgpkgbundle/sync.go index c003dbb8..1d293dc7 100644 --- a/pkg/vendir/fetch/imgpkgbundle/sync.go +++ b/pkg/vendir/fetch/imgpkgbundle/sync.go @@ -21,6 +21,7 @@ func NewSync(opts ctlconf.DirectoryContentsImgpkgBundle, refFetcher ctlfetch.Ref imgpkgOpts := ctlimg.ImgpkgOpts{ SecretRef: opts.SecretRef, DangerousSkipTLSVerify: opts.DangerousSkipTLSVerify, + ResponseHeaderTimeout: opts.ResponseHeaderTimeout, } return &Sync{opts, ctlimg.NewImgpkg(imgpkgOpts, refFetcher, c)} }