@@ -1277,7 +1277,25 @@ func (mgr *indexerClusterPodManager) handlePullBusOrPipelineConfigChange(ctx con
12771277 }
12781278 splunkClient := newSplunkClientForPullBusPipeline (fmt .Sprintf ("https://%s:8089" , fqdnName ), "admin" , string (adminPwd ))
12791279
1280- pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields := getChangedPullBusAndPipelineFieldsIndexer (& newCR .Status , newCR )
1280+ afterDelete := false
1281+ if (newCR .Spec .PullBus .SQS .QueueName != "" && newCR .Status .PullBus .SQS .QueueName != "" && newCR .Spec .PullBus .SQS .QueueName != newCR .Status .PullBus .SQS .QueueName ) || (newCR .Spec .PullBus .Type != "" && newCR .Status .PullBus .Type != "" && newCR .Spec .PullBus .Type != newCR .Status .PullBus .Type ) {
1282+ if err := splunkClient .DeleteConfFileProperty ("outputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Status .PullBus .SQS .QueueName )); err != nil {
1283+ updateErr = err
1284+ }
1285+ afterDelete = true
1286+ }
1287+
1288+ if (newCR .Spec .PullBus .SQS .RetryPolicy != "" && newCR .Status .PullBus .SQS .RetryPolicy != "" && newCR .Spec .PullBus .SQS .RetryPolicy != newCR .Status .PullBus .SQS .RetryPolicy ) && ! afterDelete {
1289+ if err := splunkClient .DeleteConfFilePropertyValue ("outputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Spec .PullBus .SQS .QueueName ), []string {fmt .Sprintf ("remote_queue.%s.%s.max_retries_per_part" , newCR .Spec .PullBus .SQS .RetryPolicy , newCR .Spec .PullBus .Type ), fmt .Sprintf ("%d" , newCR .Spec .PullBus .SQS .MaxRetriesPerPart )}); err != nil {
1290+ updateErr = err
1291+ }
1292+
1293+ if err := splunkClient .DeleteConfFilePropertyValue ("inputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Spec .PullBus .SQS .QueueName ), []string {fmt .Sprintf ("remote_queue.%s.%s.max_retries_per_part" , newCR .Spec .PullBus .SQS .RetryPolicy , newCR .Spec .PullBus .Type ), fmt .Sprintf ("%d" , newCR .Spec .PullBus .SQS .MaxRetriesPerPart )}); err != nil {
1294+ updateErr = err
1295+ }
1296+ }
1297+
1298+ pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields := getChangedPullBusAndPipelineFieldsIndexer (& newCR .Status , newCR , afterDelete )
12811299
12821300 for _ , pbVal := range pullBusChangedFieldsOutputs {
12831301 if err := splunkClient .UpdateConfFile ("outputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Spec .PullBus .SQS .QueueName ), [][]string {pbVal }); err != nil {
@@ -1302,15 +1320,15 @@ func (mgr *indexerClusterPodManager) handlePullBusOrPipelineConfigChange(ctx con
13021320 return updateErr
13031321}
13041322
1305- func getChangedPullBusAndPipelineFieldsIndexer (oldCrStatus * enterpriseApi.IndexerClusterStatus , newCR * enterpriseApi.IndexerCluster ) (pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields [][]string ) {
1323+ func getChangedPullBusAndPipelineFieldsIndexer (oldCrStatus * enterpriseApi.IndexerClusterStatus , newCR * enterpriseApi.IndexerCluster , afterDelete bool ) (pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields [][]string ) {
13061324 // Compare PullBus fields
13071325 oldPB := oldCrStatus .PullBus
13081326 newPB := newCR .Spec .PullBus
13091327 oldPC := oldCrStatus .PipelineConfig
13101328 newPC := newCR .Spec .PipelineConfig
13111329
13121330 // Push all PullBus fields
1313- pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs = pullBusChanged (oldPB , newPB )
1331+ pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs = pullBusChanged (oldPB , newPB , afterDelete )
13141332
13151333 // Always set all pipeline fields, not just changed ones
13161334 pipelineChangedFields = pipelineConfigChanged (oldPC , newPC , oldCrStatus .PullBus .SQS .QueueName != "" , true )
@@ -1329,37 +1347,37 @@ func imageUpdatedTo9(previousImage string, currentImage string) bool {
13291347 return strings .HasPrefix (previousVersion , "8" ) && strings .HasPrefix (currentVersion , "9" )
13301348}
13311349
1332- func pullBusChanged (oldPullBus , newPullBus enterpriseApi.PushBusSpec ) (inputs , outputs [][]string ) {
1333- if oldPullBus .Type != newPullBus .Type {
1350+ func pullBusChanged (oldPullBus , newPullBus enterpriseApi.PushBusSpec , afterDelete bool ) (inputs , outputs [][]string ) {
1351+ if oldPullBus .Type != newPullBus .Type || afterDelete {
13341352 inputs = append (inputs , []string {"remote_queue.type" , newPullBus .Type })
13351353 }
1336- if oldPullBus .SQS .AuthRegion != newPullBus .SQS .AuthRegion {
1354+ if oldPullBus .SQS .AuthRegion != newPullBus .SQS .AuthRegion || afterDelete {
13371355 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.auth_region" , newPullBus .Type ), newPullBus .SQS .AuthRegion })
13381356 }
1339- if oldPullBus .SQS .Endpoint != newPullBus .SQS .Endpoint {
1357+ if oldPullBus .SQS .Endpoint != newPullBus .SQS .Endpoint || afterDelete {
13401358 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.endpoint" , newPullBus .Type ), newPullBus .SQS .Endpoint })
13411359 }
1342- if oldPullBus .SQS .LargeMessageStoreEndpoint != newPullBus .SQS .LargeMessageStoreEndpoint {
1360+ if oldPullBus .SQS .LargeMessageStoreEndpoint != newPullBus .SQS .LargeMessageStoreEndpoint || afterDelete {
13431361 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.large_message_store.endpoint" , newPullBus .Type ), newPullBus .SQS .LargeMessageStoreEndpoint })
13441362 }
1345- if oldPullBus .SQS .LargeMessageStorePath != newPullBus .SQS .LargeMessageStorePath {
1363+ if oldPullBus .SQS .LargeMessageStorePath != newPullBus .SQS .LargeMessageStorePath || afterDelete {
13461364 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.large_message_store.path" , newPullBus .Type ), newPullBus .SQS .LargeMessageStorePath })
13471365 }
1348- if oldPullBus .SQS .DeadLetterQueueName != newPullBus .SQS .DeadLetterQueueName {
1366+ if oldPullBus .SQS .DeadLetterQueueName != newPullBus .SQS .DeadLetterQueueName || afterDelete {
13491367 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.dead_letter_queue.name" , newPullBus .Type ), newPullBus .SQS .DeadLetterQueueName })
13501368 }
1351- if oldPullBus .SQS .MaxRetriesPerPart != newPullBus .SQS .MaxRetriesPerPart || oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy {
1369+ if oldPullBus .SQS .MaxRetriesPerPart != newPullBus .SQS .MaxRetriesPerPart || oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy || afterDelete {
13521370 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.%s.max_retries_per_part" , newPullBus .SQS .RetryPolicy , newPullBus .Type ), fmt .Sprintf ("%d" , newPullBus .SQS .MaxRetriesPerPart )})
13531371 }
1354- if oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy {
1372+ if oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy || afterDelete {
13551373 inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.retry_policy" , newPullBus .Type ), newPullBus .SQS .RetryPolicy })
13561374 }
13571375
13581376 outputs = inputs
1359- if oldPullBus .SQS .SendInterval != newPullBus .SQS .SendInterval {
1377+ if oldPullBus .SQS .SendInterval != newPullBus .SQS .SendInterval || afterDelete {
13601378 outputs = append (outputs , []string {fmt .Sprintf ("remote_queue.%s.send_interval" , newPullBus .Type ), newPullBus .SQS .SendInterval })
13611379 }
1362- if oldPullBus .SQS .EncodingFormat != newPullBus .SQS .EncodingFormat {
1380+ if oldPullBus .SQS .EncodingFormat != newPullBus .SQS .EncodingFormat || afterDelete {
13631381 outputs = append (outputs , []string {fmt .Sprintf ("remote_queue.%s.encoding_format" , newPullBus .Type ), newPullBus .SQS .EncodingFormat })
13641382 }
13651383
0 commit comments