in images/controller/pkg/broker.go [154:173]
func ValidateImageRepo(repo, tag string, authorizedImagePattern *regexp.Regexp) error {
// Verifies that the image repo is in the correct format.
// Verifies pod broker has access to the repo.
// Verifies that node has access to the repo.
if !authorizedImagePattern.MatchString(repo) {
return fmt.Errorf("rejected image repository '%s' per broker config.", repo)
}
listResp, err := ListGCRImageTagsInternalMetadataToken(repo)
if err != nil {
return fmt.Errorf("failed to check image repository: '%s'", repo)
}
if len(listResp.Tags) == 0 {
return fmt.Errorf("invalid permissions or no tags found for image: '%s", repo)
}
return nil
}