@@ -97,6 +97,7 @@ type IndexImageCatalogCreator struct {
97
97
HasFBCLabel bool
98
98
FBCContent string
99
99
PackageName string
100
+ ImagePullPolicy string
100
101
IndexImage string
101
102
InitImage string
102
103
BundleImage string
@@ -138,6 +139,13 @@ func (c *IndexImageCatalogCreator) BindFlags(fs *pflag.FlagSet) {
138
139
"while pulling bundles" )
139
140
fs .BoolVar (& c .UseHTTP , "use-http" , false , "use plain HTTP for container image registries " +
140
141
"while pulling bundles" )
142
+ fs .StringVar (& c .ImagePullPolicy , "image-pull-policy" , string (corev1 .PullAlways ), "image pull policy for the registry pod" )
143
+ _ = fs .MarkHidden ("image-pull-policy" )
144
+ pullIfNotPresent := false
145
+ fs .BoolVar (& pullIfNotPresent , "pull-if-not-present" , false , "pull the image only if it is not present locally" )
146
+ if pullIfNotPresent {
147
+ c .ImagePullPolicy = string (corev1 .PullIfNotPresent )
148
+ }
141
149
142
150
// default to Legacy
143
151
c .SecurityContext = SecurityContext {ContextType : Legacy }
@@ -531,6 +539,7 @@ func (c IndexImageCatalogCreator) createAnnotatedRegistry(ctx context.Context, c
531
539
InitImage : c .InitImage ,
532
540
FBCContent : c .FBCContent ,
533
541
SecurityContext : c .SecurityContext .String (),
542
+ ImagePullPolicy : corev1 .PullPolicy (c .ImagePullPolicy ),
534
543
}
535
544
536
545
pod , err = fbcRegistryPod .Create (ctx , c .cfg , cs )
@@ -548,6 +557,7 @@ func (c IndexImageCatalogCreator) createAnnotatedRegistry(ctx context.Context, c
548
557
SkipTLSVerify : c .SkipTLSVerify ,
549
558
UseHTTP : c .UseHTTP ,
550
559
SecurityContext : c .SecurityContext .String (),
560
+ ImagePullPolicy : corev1 .PullPolicy (c .ImagePullPolicy ),
551
561
}
552
562
553
563
if registryPod .DBPath , err = c .getDBPath (ctx ); err != nil {
0 commit comments