@@ -11,6 +11,8 @@ import (
1111
1212 "github.com/operator-framework/operator-registry/alpha/action"
1313 "github.com/operator-framework/operator-registry/alpha/declcfg"
14+ "github.com/operator-framework/operator-registry/cmd/opm/internal/util"
15+ containerd "github.com/operator-framework/operator-registry/pkg/image/containerdregistry"
1416 "github.com/operator-framework/operator-registry/pkg/sqlite"
1517)
1618
@@ -44,6 +46,29 @@ func NewCmd() *cobra.Command {
4446 // returned from render.Run and logged as fatal errors.
4547 logrus .SetOutput (ioutil .Discard )
4648
49+ skipTLSVerify , useHTTP , err := util .GetTLSOptions (cmd )
50+ if err != nil {
51+ log .Fatal (err )
52+ }
53+
54+ cacheDir , err := os .MkdirTemp ("" , "render-registry-" )
55+ if err != nil {
56+ log .Fatal (err )
57+ }
58+
59+ reg , err := containerd .NewRegistry (
60+ containerd .WithCacheDir (cacheDir ),
61+ containerd .SkipTLSVerify (skipTLSVerify ),
62+ containerd .WithPlainHTTP (useHTTP ),
63+ containerd .WithLog (nullLogger ()),
64+ )
65+ if err != nil {
66+ log .Fatalf ("creating containerd registry: %v" , err )
67+ }
68+ defer reg .Destroy ()
69+
70+ render .Registry = reg
71+
4772 cfg , err := render .Run (cmd .Context ())
4873 if err != nil {
4974 log .Fatal (err )
@@ -55,5 +80,13 @@ func NewCmd() *cobra.Command {
5580 },
5681 }
5782 cmd .Flags ().StringVarP (& output , "output" , "o" , "json" , "Output format (json|yaml)" )
83+ cmd .Flags ().Bool ("skip-tls-verify" , false , "disable TLS verification" )
84+ cmd .Flags ().Bool ("use-http" , false , "use plain HTTP" )
5885 return cmd
5986}
87+
88+ func nullLogger () * logrus.Entry {
89+ logger := logrus .New ()
90+ logger .SetOutput (ioutil .Discard )
91+ return logrus .NewEntry (logger )
92+ }
0 commit comments