@@ -537,10 +537,11 @@ func (h *Handler) Handle(event v1.Event) error {
537
537
configChanged := false
538
538
configChangeRequiresUpsert := false
539
539
configChangeRequiresImportErrorUpdate := false
540
+ registryChanged := false
540
541
unskippedStreams := map [string ]bool {}
541
542
unskippedTemplates := map [string ]bool {}
542
543
if cfg .Spec .ManagementState == cfg .Status .ManagementState {
543
- configChanged , configChangeRequiresUpsert , configChangeRequiresImportErrorUpdate , unskippedStreams , unskippedTemplates = h .VariableConfigChanged (cfg )
544
+ configChanged , configChangeRequiresUpsert , configChangeRequiresImportErrorUpdate , registryChanged , unskippedStreams , unskippedTemplates = h .VariableConfigChanged (cfg )
544
545
logrus .Debugf ("config changed %v upsert needed %v import error upd needed %v exists/true %v progressing/false %v op version %s status version %s" ,
545
546
configChanged ,
546
547
configChangeRequiresUpsert ,
@@ -561,7 +562,7 @@ func (h *Handler) Handle(event v1.Event) error {
561
562
// and see if any samples were deleted while samples operator was down
562
563
h .buildFileMaps (cfg , false )
563
564
// passing in false means if the samples is present, we leave it alone
564
- return h .createSamples (cfg , false , unskippedStreams , unskippedTemplates )
565
+ return h .createSamples (cfg , false , registryChanged , unskippedStreams , unskippedTemplates )
565
566
}
566
567
// if config changed requiring an upsert, but a prior config action is still in progress,
567
568
// reset in progress to false and return; the next event should drive the actual
@@ -670,7 +671,7 @@ func (h *Handler) Handle(event v1.Event) error {
670
671
return err
671
672
}
672
673
673
- err = h .createSamples (cfg , true , unskippedStreams , unskippedTemplates )
674
+ err = h .createSamples (cfg , true , registryChanged , unskippedStreams , unskippedTemplates )
674
675
if err != nil {
675
676
h .processError (cfg , v1 .ImageChangesInProgress , corev1 .ConditionUnknown , err , "error creating samples: %v" )
676
677
logrus .Printf ("CRDUPDATE setting in progress to unknown" )
@@ -787,7 +788,7 @@ func (h *Handler) setSampleManagedLabelToFalse(kind, name string) error {
787
788
return nil
788
789
}
789
790
790
- func (h * Handler ) createSamples (cfg * v1.Config , updateIfPresent bool , unskippedStreams , unskippedTemplates map [string ]bool ) error {
791
+ func (h * Handler ) createSamples (cfg * v1.Config , updateIfPresent , registryChanged bool , unskippedStreams , unskippedTemplates map [string ]bool ) error {
791
792
// first, got through the list and prime our upsert cache
792
793
// prior to any actual upserts
793
794
imagestreams := []* imagev1.ImageStream {}
@@ -835,6 +836,13 @@ func (h *Handler) createSamples(cfg *v1.Config, updateIfPresent bool, unskippedS
835
836
return err
836
837
}
837
838
}
839
+
840
+ // if after initial startup, and not migration, the only cfg change was changing the registry, since that does not impact
841
+ // the templates, we can move on
842
+ if len (unskippedTemplates ) == 0 && registryChanged && cfg .ConditionTrue (v1 .SamplesExist ) && cfg .ConditionFalse (v1 .MigrationInProgress ) {
843
+ return nil
844
+ }
845
+
838
846
for _ , fileName := range h .templateFile {
839
847
template , err := h .Filetemplategetter .Get (fileName )
840
848
if err != nil {
0 commit comments