Normalize image name

Provide consistency with how image names in function deployments
are normalized.

Signed-off-by: Han Verstraete <welteki@pm.me>
This commit is contained in:
Han Verstraete 2022-03-02 13:21:33 +00:00 committed by Alex Ellis
parent a574a0c06f
commit e668beef13

View File

@ -19,6 +19,7 @@ import (
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci" "github.com/containerd/containerd/oci"
gocni "github.com/containerd/go-cni" gocni "github.com/containerd/go-cni"
"github.com/docker/distribution/reference"
"github.com/openfaas/faasd/pkg/cninetwork" "github.com/openfaas/faasd/pkg/cninetwork"
"github.com/openfaas/faasd/pkg/service" "github.com/openfaas/faasd/pkg/service"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -107,7 +108,14 @@ func (s *Supervisor) Start(svcs []Service) error {
for _, svc := range svcs { for _, svc := range svcs {
fmt.Printf("Preparing %s with image: %s\n", svc.Name, svc.Image) fmt.Printf("Preparing %s with image: %s\n", svc.Name, svc.Image)
img, err := service.PrepareImage(ctx, s.client, svc.Image, defaultSnapshotter, faasServicesPullAlways) r, err := reference.ParseNormalizedNamed(svc.Image)
if err != nil {
return err
}
imgRef := reference.TagNameOnly(r).String()
img, err := service.PrepareImage(ctx, s.client, imgRef, defaultSnapshotter, faasServicesPullAlways)
if err != nil { if err != nil {
return err return err
} }