From 1dc3d3777a99e0315936df4307e838818603f065 Mon Sep 17 00:00:00 2001 From: Vivek Reddy Date: Tue, 19 Nov 2024 04:03:18 +0000 Subject: [PATCH] order changed for config creation --- pkg/splunk/enterprise/searchheadcluster.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/splunk/enterprise/searchheadcluster.go b/pkg/splunk/enterprise/searchheadcluster.go index 6cbef29f3..ec74a9edc 100644 --- a/pkg/splunk/enterprise/searchheadcluster.go +++ b/pkg/splunk/enterprise/searchheadcluster.go @@ -72,6 +72,14 @@ func ApplySearchHeadCluster(ctx context.Context, client splcommon.ControllerClie return result, err } + // create or update general config resources + namespaceScopedSecret, err := ApplySplunkConfig(ctx, client, cr, cr.Spec.CommonSplunkSpec, SplunkSearchHead) + if err != nil { + scopedLog.Error(err, "create or update general config failed", "error", err.Error()) + eventPublisher.Warning(ctx, "ApplySplunkConfig", fmt.Sprintf("create or update general config failed with error %s", err.Error())) + return result, err + } + // If the app framework is configured then do following things - // 1. Initialize the S3Clients based on providers // 2. Check the status of apps on remote storage. @@ -101,13 +109,7 @@ func ApplySearchHeadCluster(ctx context.Context, client splcommon.ControllerClie cr.Status.AdminPasswordChangedSecrets = make(map[string]bool) } - // create or update general config resources - namespaceScopedSecret, err := ApplySplunkConfig(ctx, client, cr, cr.Spec.CommonSplunkSpec, SplunkSearchHead) - if err != nil { - scopedLog.Error(err, "create or update general config failed", "error", err.Error()) - eventPublisher.Warning(ctx, "ApplySplunkConfig", fmt.Sprintf("create or update general config failed with error %s", err.Error())) - return result, err - } + // check if deletion has been requested if cr.ObjectMeta.DeletionTimestamp != nil {