@@ -17,7 +17,7 @@ import (
1717 "github.com/joelanford/kubectl-operator/internal/pkg/log"
1818)
1919
20- type AddCatalog struct {
20+ type CatalogAdd struct {
2121 config * Configuration
2222
2323 CatalogSourceName string
@@ -32,20 +32,20 @@ type AddCatalog struct {
3232 registry * containerdregistry.Registry
3333}
3434
35- func NewAddCatalog (cfg * Configuration ) * AddCatalog {
36- return & AddCatalog {
35+ func NewCatalogAdd (cfg * Configuration ) * CatalogAdd {
36+ return & CatalogAdd {
3737 config : cfg ,
3838 }
3939}
4040
41- func (a * AddCatalog ) BindFlags (fs * pflag.FlagSet ) {
41+ func (a * CatalogAdd ) BindFlags (fs * pflag.FlagSet ) {
4242 fs .StringVarP (& a .DisplayName , "display-name" , "d" , "" , "display name of the index" )
4343 fs .StringVarP (& a .Publisher , "publisher" , "p" , "" , "publisher of the index" )
4444 fs .DurationVarP (& a .AddTimeout , "timeout" , "t" , time .Minute , "the amount of time to wait before cancelling the catalog addition" )
4545 fs .DurationVar (& a .CleanupTimeout , "cleanup-timeout" , time .Minute , "the amount to time to wait before cancelling cleanup" )
4646}
4747
48- func (a * AddCatalog ) Run (ctx context.Context ) (* v1alpha1.CatalogSource , error ) {
48+ func (a * CatalogAdd ) Run (ctx context.Context ) (* v1alpha1.CatalogSource , error ) {
4949 var err error
5050 a .registry , err = containerdregistry .NewRegistry (a .RegistryOptions ... )
5151 if err != nil {
@@ -83,7 +83,7 @@ func (a *AddCatalog) Run(ctx context.Context) (*v1alpha1.CatalogSource, error) {
8383 return cs , nil
8484}
8585
86- func (a * AddCatalog ) labelsFor (ctx context.Context , indexImage string ) (map [string ]string , error ) {
86+ func (a * CatalogAdd ) labelsFor (ctx context.Context , indexImage string ) (map [string ]string , error ) {
8787 simpleRef := image .SimpleReference (indexImage )
8888 if err := a .registry .Pull (ctx , simpleRef ); err != nil {
8989 return nil , fmt .Errorf ("pull image: %v" , err )
@@ -95,7 +95,7 @@ func (a *AddCatalog) labelsFor(ctx context.Context, indexImage string) (map[stri
9595 return labels , nil
9696}
9797
98- func (a * AddCatalog ) setDefaults (labels map [string ]string ) {
98+ func (a * CatalogAdd ) setDefaults (labels map [string ]string ) {
9999 if a .DisplayName == "" {
100100 if v , ok := labels ["operators.operatorframework.io.index.display-name" ]; ok {
101101 a .DisplayName = v
@@ -108,7 +108,7 @@ func (a *AddCatalog) setDefaults(labels map[string]string) {
108108 }
109109}
110110
111- func (a * AddCatalog ) add (ctx context.Context , cs * v1alpha1.CatalogSource ) error {
111+ func (a * CatalogAdd ) add (ctx context.Context , cs * v1alpha1.CatalogSource ) error {
112112 if err := a .config .Client .Create (ctx , cs ); err != nil {
113113 return fmt .Errorf ("create catalogsource: %v" , err )
114114 }
@@ -133,7 +133,7 @@ func (a *AddCatalog) add(ctx context.Context, cs *v1alpha1.CatalogSource) error
133133 return nil
134134}
135135
136- func (a * AddCatalog ) cleanup (cs * v1alpha1.CatalogSource ) {
136+ func (a * CatalogAdd ) cleanup (cs * v1alpha1.CatalogSource ) {
137137 ctx , cancel := context .WithTimeout (context .Background (), a .CleanupTimeout )
138138 defer cancel ()
139139 if err := a .config .Client .Delete (ctx , cs ); err != nil {
0 commit comments