Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/splunk/enterprise/clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ func ApplyClusterManager(ctx context.Context, client splcommon.ControllerClient,
}
cr.Status.Phase = phase

//Update MC configmap
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, true)
if err != nil {
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -217,13 +225,6 @@ func ApplyClusterManager(ctx context.Context, client splcommon.ControllerClient,
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
//Update MC configmap
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, true)
if err != nil {
return result, err
}
}

// Create podExecClient
podExecClient := splutil.GetPodExecClient(client, cr, "")
Expand Down
15 changes: 8 additions & 7 deletions pkg/splunk/enterprise/clustermaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ func ApplyClusterMaster(ctx context.Context, client splcommon.ControllerClient,
}
cr.Status.Phase = phase

//Update MC configmap
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, true)
if err != nil {
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -204,13 +212,6 @@ func ApplyClusterMaster(ctx context.Context, client splcommon.ControllerClient,
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
//Update MC configmap
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, true)
if err != nil {
return result, err
}
}

// Create podExecClient
podExecClient := splutil.GetPodExecClient(client, cr, "")
Expand Down
13 changes: 7 additions & 6 deletions pkg/splunk/enterprise/licensemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ func ApplyLicenseManager(ctx context.Context, client splcommon.ControllerClient,
}
cr.Status.Phase = phase

if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseManagerURL(cr, &cr.Spec.CommonSplunkSpec), true)
if err != nil {
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -156,12 +163,6 @@ func ApplyLicenseManager(ctx context.Context, client splcommon.ControllerClient,
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseManagerURL(cr, &cr.Spec.CommonSplunkSpec), true)
if err != nil {
return result, err
}
}

// Add a splunk operator telemetry app
if cr.Spec.EtcVolumeStorageConfig.EphemeralStorage || !cr.Status.TelAppInstalled {
Expand Down
13 changes: 7 additions & 6 deletions pkg/splunk/enterprise/licensemaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ func ApplyLicenseMaster(ctx context.Context, client splcommon.ControllerClient,
}
cr.Status.Phase = phase

if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseMasterURL(cr, &cr.Spec.CommonSplunkSpec), true)
if err != nil {
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -156,12 +163,6 @@ func ApplyLicenseMaster(ctx context.Context, client splcommon.ControllerClient,
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseMasterURL(cr, &cr.Spec.CommonSplunkSpec), true)
if err != nil {
return result, err
}
}

// Add a splunk operator telemetry app
if cr.Spec.EtcVolumeStorageConfig.EphemeralStorage || !cr.Status.TelAppInstalled {
Expand Down
13 changes: 7 additions & 6 deletions pkg/splunk/enterprise/searchheadcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ func ApplySearchHeadCluster(ctx context.Context, client splcommon.ControllerClie
finalResult = handleAppFrameworkActivity(ctx, client, cr, &cr.Status.AppContext, &cr.Spec.AppFrameworkConfig)
}

if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getSearchHeadEnv(cr), true)
if err != nil {
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -219,12 +226,6 @@ func ApplySearchHeadCluster(ctx context.Context, client splcommon.ControllerClie
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getSearchHeadEnv(cr), true)
if err != nil {
return result, err
}
}

// Reset secrets related status structs
cr.Status.ShcSecretChanged = []bool{}
Expand Down
15 changes: 8 additions & 7 deletions pkg/splunk/enterprise/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ func ApplyStandalone(ctx context.Context, client splcommon.ControllerClient, cr
}
cr.Status.Phase = phase

if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getStandaloneExtraEnv(cr, cr.Spec.Replicas), true)
if err != nil {
eventPublisher.Warning(ctx, "ApplyMonitoringConsoleEnvConfigMap", fmt.Sprintf("apply monitoring console environment config map failed %s", err.Error()))
return result, err
}
}

// no need to requeue if everything is ready
if cr.Status.Phase == enterpriseApi.PhaseReady {
//upgrade fron automated MC to MC CRD
Expand All @@ -233,13 +241,6 @@ func ApplyStandalone(ctx context.Context, client splcommon.ControllerClient, cr
eventPublisher.Warning(ctx, "DeleteReferencesToAutomatedMCIfExists", fmt.Sprintf("delete reference to automated MC if exists failed %s", err.Error()))
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getStandaloneExtraEnv(cr, cr.Spec.Replicas), true)
if err != nil {
eventPublisher.Warning(ctx, "ApplyMonitoringConsoleEnvConfigMap", fmt.Sprintf("apply monitoring console environment config map failed %s", err.Error()))
return result, err
}
}

finalResult := handleAppFrameworkActivity(ctx, client, cr, &cr.Status.AppContext, &cr.Spec.AppFrameworkConfig)
result = *finalResult
Expand Down
Loading