Skip to content

Commit 1c77634

Browse files
committed
CSPL-3551 Fixes
1 parent 56aa780 commit 1c77634

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

pkg/splunk/enterprise/afwscheduler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var appPhaseInfoStatuses = map[enterpriseApi.AppPhaseStatusType]bool{
5555
// isFanOutApplicableToCR confirms if a given CR needs fanOut support
5656
func isFanOutApplicableToCR(cr splcommon.MetaObject) bool {
5757
switch cr.GetObjectKind().GroupVersionKind().Kind {
58-
case "Standalone":
58+
case "Standalone", "IngestorCluster":
5959
return true
6060
default:
6161
return false
@@ -1514,6 +1514,8 @@ func afwGetReleventStatefulsetByKind(ctx context.Context, cr splcommon.MetaObjec
15141514
instanceID = SplunkClusterManager
15151515
case "MonitoringConsole":
15161516
instanceID = SplunkMonitoringConsole
1517+
case "IngestorCluster":
1518+
instanceID = SplunkIngestor
15171519
default:
15181520
return nil
15191521
}
@@ -2175,6 +2177,7 @@ func afwSchedulerEntry(ctx context.Context, client splcommon.ControllerClient, c
21752177

21762178
podExecClient := splutil.GetPodExecClient(client, cr, podName)
21772179
appsPathOnPod := filepath.Join(appBktMnt, appSrcName)
2180+
21782181
// create the dir on Splunk pod/s where app/s will be copied from operator pod
21792182
err = createDirOnSplunkPods(ctx, cr, *sts.Spec.Replicas, appsPathOnPod, podExecClient)
21802183
if err != nil {

pkg/splunk/enterprise/finalizers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ func DeleteSplunkPvc(ctx context.Context, cr splcommon.MetaObject, c splcommon.C
5656
components = append(components, splcommon.ClusterManager)
5757
case "MonitoringConsole":
5858
components = append(components, "monitoring-console")
59+
case "IngestorCluster":
60+
components = append(components, "ingestor")
5961
default:
6062
scopedLog.Info("Skipping PVC removal")
6163
return nil

pkg/splunk/enterprise/ingestorcluster.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
214214

215215
// No need to requeue if everything is ready
216216
if cr.Status.Phase == enterpriseApi.PhaseReady {
217-
// TODO: Make it work when HPA scales replicas - all new pods should get the configuration
218217
_, err = handlePushBusOrPipelineConfigChange(ctx, cr, client)
219218
if err != nil {
220219
scopedLog.Error(err, "Failed to update conf file for PushBus/Pipeline config change after pod creation")
@@ -264,8 +263,8 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
264263
// validateIngestorClusterSpec checks validity and makes default updates to a IngestorClusterSpec and returns error if something is wrong
265264
func validateIngestorClusterSpec(ctx context.Context, c splcommon.ControllerClient, cr *enterpriseApi.IngestorCluster) error {
266265
// We cannot have 0 replicas in IngestorCluster spec since this refers to number of ingestion pods in an ingestor cluster
267-
if cr.Spec.Replicas == 0 {
268-
cr.Spec.Replicas = 1
266+
if cr.Spec.Replicas < 3 {
267+
cr.Spec.Replicas = 3
269268
}
270269

271270
if !reflect.DeepEqual(cr.Status.AppContext.AppFrameworkConfig, cr.Spec.AppFrameworkConfig) {
@@ -280,7 +279,15 @@ func validateIngestorClusterSpec(ctx context.Context, c splcommon.ControllerClie
280279

281280
// getIngestorStatefulSet returns a Kubernetes StatefulSet object for Splunk Enterprise ingestors
282281
func getIngestorStatefulSet(ctx context.Context, client splcommon.ControllerClient, cr *enterpriseApi.IngestorCluster) (*appsv1.StatefulSet, error) {
283-
return getSplunkStatefulSet(ctx, client, cr, &cr.Spec.CommonSplunkSpec, SplunkIngestor, cr.Spec.Replicas, make([]corev1.EnvVar, 0))
282+
ss, err := getSplunkStatefulSet(ctx, client, cr, &cr.Spec.CommonSplunkSpec, SplunkIngestor, cr.Spec.Replicas, []corev1.EnvVar{})
283+
if err != nil {
284+
return nil, err
285+
}
286+
287+
// Setup App framework staging volume for apps
288+
setupAppsStagingVolume(ctx, client, cr, &ss.Spec.Template, &cr.Spec.AppFrameworkConfig)
289+
290+
return ss, nil
284291
}
285292

286293
// Checks if only PushBus or Pipeline config changed, and updates the conf file if so

0 commit comments

Comments
 (0)