Skip to content

Commit 23c2253

Browse files
committed
fix: use HEAD instead of GET when monitoring an image in to by-pass docker hub quotas
1 parent 51dff02 commit 23c2253

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/registry/registry.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/google/go-containerregistry/pkg/authn"
1212
"github.com/google/go-containerregistry/pkg/name"
13+
v1 "github.com/google/go-containerregistry/pkg/v1"
1314
"github.com/google/go-containerregistry/pkg/v1/remote"
1415
corev1 "k8s.io/api/core/v1"
1516
)
@@ -27,7 +28,7 @@ func ContainerAnnotationKey(containerName string, initContainer bool) string {
2728
return fmt.Sprintf(template, containerName)
2829
}
2930

30-
func GetDescriptor(imageName string, pullSecrets []corev1.Secret, insecureRegistries []string, rootCAs *x509.CertPool) (*remote.Descriptor, error) {
31+
func GetDescriptor(imageName string, pullSecrets []corev1.Secret, insecureRegistries []string, rootCAs *x509.CertPool) (*v1.Descriptor, error) {
3132
keychains, err := GetKeychains(imageName, pullSecrets)
3233
if err != nil {
3334
return nil, err
@@ -41,7 +42,7 @@ func GetDescriptor(imageName string, pullSecrets []corev1.Secret, insecureRegist
4142
var returnedErr error
4243
for _, keychain := range keychains {
4344
opts := options(sourceRef, keychain, insecureRegistries, rootCAs)
44-
desc, err := remote.Get(sourceRef, opts...)
45+
desc, err := remote.Head(sourceRef, opts...)
4546

4647
if err == nil { // stops at the first success
4748
return desc, nil

0 commit comments

Comments
 (0)