@@ -25,6 +25,7 @@ type GRPCPluginConfig struct {
2525 Logger * zap.Logger
2626 ImageRef string
2727 RegistryToken string
28+ RegistryInsecure bool
2829 StartupConfig grpccommon.GRPCStartupParams
2930 Tracer trace.Tracer
3031 GetTraceAttributes grpccommon.GRPCTraceAttributeGetter
@@ -45,6 +46,7 @@ type GRPCPlugin struct {
4546
4647 registryUsername string
4748 registryPassword string
49+ registryInsecure bool
4850
4951 client * grpccommon.GRPCPluginClient
5052
@@ -63,7 +65,7 @@ func NewGRPCOCIPlugin(config GRPCPluginConfig) (*GRPCPlugin, error) {
6365 return nil , fmt .Errorf ("image source is required" )
6466 }
6567
66- if config .RegistryToken == "" {
68+ if config .RegistryToken == "" && ! config . RegistryInsecure {
6769 return nil , fmt .Errorf ("registry token is required" )
6870 }
6971
@@ -78,6 +80,7 @@ func NewGRPCOCIPlugin(config GRPCPluginConfig) (*GRPCPlugin, error) {
7880
7981 registryUsername : "router" ,
8082 registryPassword : config .RegistryToken ,
83+ registryInsecure : config .RegistryInsecure ,
8184
8285 tracer : config .Tracer ,
8386 startupConfig : config .StartupConfig ,
@@ -175,16 +178,22 @@ func (p *GRPCPlugin) cleanupPluginWorkDir() {
175178
176179// Start implements Plugin.
177180func (p * GRPCPlugin ) Start (ctx context.Context ) error {
178- desc , err := crane .Get (p .imgRef ,
179- crane .WithAuth (& authn.Basic {
180- Username : p .registryUsername ,
181- Password : p .registryPassword ,
182- }),
181+ opts := []crane.Option {
183182 crane .WithPlatform (& v1.Platform {
184183 Architecture : runtime .GOARCH ,
185184 OS : runtime .GOOS ,
186185 }),
187- )
186+ }
187+ if p .registryInsecure {
188+ opts = append (opts , crane .Insecure )
189+ } else {
190+ opts = append (opts , crane .WithAuth (& authn.Basic {
191+ Username : p .registryUsername ,
192+ Password : p .registryPassword ,
193+ }))
194+ }
195+
196+ desc , err := crane .Get (p .imgRef , opts ... )
188197
189198 if err != nil {
190199 return fmt .Errorf ("pulling image %s: %w" , p .imgRef , err )
0 commit comments