@@ -234,7 +234,7 @@ func Main(f *Flags, version string) error {
234234 }
235235 }
236236
237- controller , err := prepareController (clientset , namespace , tweakopts , f , ssclientset , keyRegistry )
237+ controller , err := prepareController (clientset , namespace , myNs , tweakopts , f , ssclientset , keyRegistry )
238238 if err != nil {
239239 return err
240240 }
@@ -258,7 +258,7 @@ func Main(f *Flags, version string) error {
258258 return err
259259 }
260260 if ns != namespace {
261- ctlr , err := prepareController (clientset , ns , tweakopts , f , ssclientset , keyRegistry )
261+ ctlr , err := prepareController (clientset , ns , myNs , tweakopts , f , ssclientset , keyRegistry )
262262 if err != nil {
263263 return err
264264 }
@@ -299,22 +299,23 @@ func Main(f *Flags, version string) error {
299299func prepareController (
300300 clientset kubernetes.Interface ,
301301 namespace string ,
302+ keyNamespace string ,
302303 tweakopts func (* metav1.ListOptions ),
303304 f * Flags ,
304305 ssclientset versioned.Interface ,
305306 keyRegistry * KeyRegistry ,
306307) (* Controller , error ) {
307- kinformer := initSecretInformerFactory (clientset , namespace , func (options * metav1.ListOptions ) {
308+ kinformer := initSecretInformerFactory (clientset , keyNamespace , func (options * metav1.ListOptions ) {
308309 options .LabelSelector = keySelector .String ()
309310 }, f .WatchForSecrets )
310- sinformer := initSecretInformerFactory (clientset , namespace , tweakopts , f .SkipRecreate )
311+ sinformer := initSecretInformerFactory (clientset , namespace , tweakopts , ! f .SkipRecreate )
311312 ssinformer := ssinformers .NewFilteredSharedInformerFactory (ssclientset , 0 , namespace , tweakopts )
312313 controller , err := NewController (clientset , ssclientset , ssinformer , sinformer , kinformer , keyRegistry , f .MaxRetries , f .KeyOrderPriority )
313314 return controller , err
314315}
315316
316317func initSecretInformerFactory (clientset kubernetes.Interface , ns string , tweakopts func (* metav1.ListOptions ), enabled bool ) informers.SharedInformerFactory {
317- if enabled {
318+ if ! enabled {
318319 return nil
319320 }
320321 return informers .NewSharedInformerFactoryWithOptions (clientset , 0 , informers .WithNamespace (ns ), informers .WithTweakListOptions (tweakopts ))
0 commit comments