Skip to content

Commit 3e0a4a0

Browse files
authored
Return error immeditely in function-runner if image doesn't exist (kptdev#381)
1 parent def901b commit 3e0a4a0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

func/internal/podevaluator.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"net/http"
2525
"os"
2626
"path/filepath"
27+
"regexp"
2728
"strconv"
2829
"strings"
2930
"sync"
@@ -804,6 +805,10 @@ func (pm *podManager) getImage(ctx context.Context, ref name.Reference, auth aut
804805
// Attempt image pull with given custom TLS cert
805806
img, tlsErr := remote.Image(ref, remote.WithAuth(auth), remote.WithContext(ctx), remote.WithTransport(transport))
806807
if tlsErr != nil {
808+
// If manifest doesn't exist, return immediately without retry
809+
if matched, _ := regexp.MatchString("manifest[_ ]unknown", strings.ToLower(tlsErr.Error())); matched {
810+
return nil, tlsErr
811+
}
807812
// Attempt without given custom TLS cert but with default keychain
808813
klog.Errorf("Pulling image %s with the provided TLS Cert has failed with error %v", image, tlsErr)
809814
klog.Infof("Attempting image pull with default keychain instead of provided TLS Cert")

0 commit comments

Comments
 (0)