Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Fix registry insecure flag #4890

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/pkg/epinject/ociregistry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ func (s *Server) getClient(ctx context.Context, repoStr string) (*http.Client, e
// auth as well as the bearer token protocol used when the server returns WWW-Authenticate.
// Plus it's well tested.

repo, err := name.NewRepository(repoStr)
opts := []name.Option{}
if strings.HasPrefix(s.Upstream, "http://") {
opts = append(opts, name.Insecure)
}

repo, err := name.NewRepository(repoStr, opts...)
if err != nil {
return nil, err
}
Expand Down