@@ -1277,7 +1277,17 @@ func (mgr *indexerClusterPodManager) handlePullBusOrPipelineConfigChange(ctx con
1277
1277
}
1278
1278
splunkClient := newSplunkClientForPullBusPipeline (fmt .Sprintf ("https://%s:8089" , fqdnName ), "admin" , string (adminPwd ))
1279
1279
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 ) ||
1282
+ (newCR .Spec .PullBus .Type != "" && newCR .Status .PullBus .Type != "" && newCR .Spec .PullBus .Type != newCR .Status .PullBus .Type ) ||
1283
+ (newCR .Spec .PullBus .SQS .RetryPolicy != "" && newCR .Status .PullBus .SQS .RetryPolicy != "" && newCR .Spec .PullBus .SQS .RetryPolicy != newCR .Status .PullBus .SQS .RetryPolicy ) {
1284
+ if err := splunkClient .DeleteConfFileProperty ("outputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Status .PullBus .SQS .QueueName )); err != nil {
1285
+ updateErr = err
1286
+ }
1287
+ afterDelete = true
1288
+ }
1289
+
1290
+ pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields := getChangedPullBusAndPipelineFieldsIndexer (& newCR .Status , newCR , afterDelete )
1281
1291
1282
1292
for _ , pbVal := range pullBusChangedFieldsOutputs {
1283
1293
if err := splunkClient .UpdateConfFile ("outputs" , fmt .Sprintf ("remote_queue:%s" , newCR .Spec .PullBus .SQS .QueueName ), [][]string {pbVal }); err != nil {
@@ -1302,15 +1312,15 @@ func (mgr *indexerClusterPodManager) handlePullBusOrPipelineConfigChange(ctx con
1302
1312
return updateErr
1303
1313
}
1304
1314
1305
- func getChangedPullBusAndPipelineFieldsIndexer (oldCrStatus * enterpriseApi.IndexerClusterStatus , newCR * enterpriseApi.IndexerCluster ) (pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields [][]string ) {
1315
+ func getChangedPullBusAndPipelineFieldsIndexer (oldCrStatus * enterpriseApi.IndexerClusterStatus , newCR * enterpriseApi.IndexerCluster , afterDelete bool ) (pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs , pipelineChangedFields [][]string ) {
1306
1316
// Compare PullBus fields
1307
1317
oldPB := oldCrStatus .PullBus
1308
1318
newPB := newCR .Spec .PullBus
1309
1319
oldPC := oldCrStatus .PipelineConfig
1310
1320
newPC := newCR .Spec .PipelineConfig
1311
1321
1312
1322
// Push all PullBus fields
1313
- pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs = pullBusChanged (oldPB , newPB )
1323
+ pullBusChangedFieldsInputs , pullBusChangedFieldsOutputs = pullBusChanged (oldPB , newPB , afterDelete )
1314
1324
1315
1325
// Always set all pipeline fields, not just changed ones
1316
1326
pipelineChangedFields = pipelineConfigChanged (oldPC , newPC , oldCrStatus .PullBus .SQS .QueueName != "" , true )
@@ -1329,37 +1339,37 @@ func imageUpdatedTo9(previousImage string, currentImage string) bool {
1329
1339
return strings .HasPrefix (previousVersion , "8" ) && strings .HasPrefix (currentVersion , "9" )
1330
1340
}
1331
1341
1332
- func pullBusChanged (oldPullBus , newPullBus enterpriseApi.PushBusSpec ) (inputs , outputs [][]string ) {
1333
- if oldPullBus .Type != newPullBus .Type {
1342
+ func pullBusChanged (oldPullBus , newPullBus enterpriseApi.PushBusSpec , afterDelete bool ) (inputs , outputs [][]string ) {
1343
+ if oldPullBus .Type != newPullBus .Type || afterDelete {
1334
1344
inputs = append (inputs , []string {"remote_queue.type" , newPullBus .Type })
1335
1345
}
1336
- if oldPullBus .SQS .AuthRegion != newPullBus .SQS .AuthRegion {
1346
+ if oldPullBus .SQS .AuthRegion != newPullBus .SQS .AuthRegion || afterDelete {
1337
1347
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.auth_region" , newPullBus .Type ), newPullBus .SQS .AuthRegion })
1338
1348
}
1339
- if oldPullBus .SQS .Endpoint != newPullBus .SQS .Endpoint {
1349
+ if oldPullBus .SQS .Endpoint != newPullBus .SQS .Endpoint || afterDelete {
1340
1350
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.endpoint" , newPullBus .Type ), newPullBus .SQS .Endpoint })
1341
1351
}
1342
- if oldPullBus .SQS .LargeMessageStoreEndpoint != newPullBus .SQS .LargeMessageStoreEndpoint {
1352
+ if oldPullBus .SQS .LargeMessageStoreEndpoint != newPullBus .SQS .LargeMessageStoreEndpoint || afterDelete {
1343
1353
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.large_message_store.endpoint" , newPullBus .Type ), newPullBus .SQS .LargeMessageStoreEndpoint })
1344
1354
}
1345
- if oldPullBus .SQS .LargeMessageStorePath != newPullBus .SQS .LargeMessageStorePath {
1355
+ if oldPullBus .SQS .LargeMessageStorePath != newPullBus .SQS .LargeMessageStorePath || afterDelete {
1346
1356
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.large_message_store.path" , newPullBus .Type ), newPullBus .SQS .LargeMessageStorePath })
1347
1357
}
1348
- if oldPullBus .SQS .DeadLetterQueueName != newPullBus .SQS .DeadLetterQueueName {
1358
+ if oldPullBus .SQS .DeadLetterQueueName != newPullBus .SQS .DeadLetterQueueName || afterDelete {
1349
1359
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.dead_letter_queue.name" , newPullBus .Type ), newPullBus .SQS .DeadLetterQueueName })
1350
1360
}
1351
- if oldPullBus .SQS .MaxRetriesPerPart != newPullBus .SQS .MaxRetriesPerPart || oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy {
1361
+ if oldPullBus .SQS .MaxRetriesPerPart != newPullBus .SQS .MaxRetriesPerPart || oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy || afterDelete {
1352
1362
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 )})
1353
1363
}
1354
- if oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy {
1364
+ if oldPullBus .SQS .RetryPolicy != newPullBus .SQS .RetryPolicy || afterDelete {
1355
1365
inputs = append (inputs , []string {fmt .Sprintf ("remote_queue.%s.retry_policy" , newPullBus .Type ), newPullBus .SQS .RetryPolicy })
1356
1366
}
1357
1367
1358
1368
outputs = inputs
1359
- if oldPullBus .SQS .SendInterval != newPullBus .SQS .SendInterval {
1369
+ if oldPullBus .SQS .SendInterval != newPullBus .SQS .SendInterval || afterDelete {
1360
1370
outputs = append (outputs , []string {fmt .Sprintf ("remote_queue.%s.send_interval" , newPullBus .Type ), newPullBus .SQS .SendInterval })
1361
1371
}
1362
- if oldPullBus .SQS .EncodingFormat != newPullBus .SQS .EncodingFormat {
1372
+ if oldPullBus .SQS .EncodingFormat != newPullBus .SQS .EncodingFormat || afterDelete {
1363
1373
outputs = append (outputs , []string {fmt .Sprintf ("remote_queue.%s.encoding_format" , newPullBus .Type ), newPullBus .SQS .EncodingFormat })
1364
1374
}
1365
1375
0 commit comments