Skip to content

Commit f98a1d8

Browse files
committed
fix
1 parent 3a14821 commit f98a1d8

File tree

4 files changed

+183
-38
lines changed

4 files changed

+183
-38
lines changed

helm-chart/splunk-enterprise/templates/enterprise_v4_indexercluster.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: List
44
items:
5-
{{- range default (default (until 1) .Values.sva.c3.indexerClusters) .Values.sva.m4.indexerClusters }}
5+
{{- range default (default (list (dict "name" .Values.indexerCluster.name)) .Values.sva.c3.indexerClusters) .Values.sva.m4.indexerClusters }}
66
- apiVersion: enterprise.splunk.com/v4
77
kind: IndexerCluster
88
metadata:
@@ -147,7 +147,7 @@ items:
147147
{{ toYaml . | indent 6 }}
148148
{{- end }}
149149
{{- end }}
150-
{{- if and ($.Values.sva.m4.enabled) (hasKey . "name") }}
150+
{{- if and ($.Values.sva.m4.enabled) (.name) }}
151151
affinity:
152152
nodeAffinity:
153153
requiredDuringSchedulingIgnoredDuringExecution:

test/index_and_ingestion_separation/index_and_ingestion_separation_test.go

Lines changed: 161 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ import (
1818
"fmt"
1919
"strings"
2020

21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
2123
"github.com/onsi/ginkgo/types"
2224
. "github.com/onsi/ginkgo/v2"
2325
. "github.com/onsi/gomega"
2426

2527
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
28+
"github.com/splunk/splunk-operator/pkg/splunk/enterprise"
2629

2730
"github.com/splunk/splunk-operator/test/testenv"
2831
)
@@ -118,41 +121,164 @@ var _ = Describe("indingsep test", func() {
118121
})
119122
})
120123

121-
// Context("Ingestor and Indexer deployment", func() {
122-
// It("indingsep, smoke, indingsep: Splunk Operator can deploy Ingestors and Indexers with additional configurations", func() {
123-
// // Create Service Account
124-
// testcaseEnvInst.Log.Info("Create Service Account")
125-
// testcaseEnvInst.CreateServiceAccount(serviceAccountName)
126-
127-
// // Deploy Ingestor Cluster
128-
// testcaseEnvInst.Log.Info("Deploy Ingestor Cluster")
129-
// _, err := deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, bus, pipelineConfig, serviceAccountName)
130-
// Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster")
131-
132-
// // Deploy Cluster Manager
133-
// testcaseEnvInst.Log.Info("Deploy Cluster Manager")
134-
// _, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec)
135-
// Expect(err).To(Succeed(), "Unable to deploy Cluster Manager")
136-
137-
// // Deploy Indexer Cluster
138-
// testcaseEnvInst.Log.Info("Deploy Indexer Cluster")
139-
// _, err = deployment.DeployIndexerCluster(ctx, deployment.GetName()+"-idxc", "", 3, deployment.GetName(), "", bus, pipelineConfig, serviceAccountName)
140-
// Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster")
141-
142-
// // Ensure that Ingestor Cluster is in Ready phase
143-
// testcaseEnvInst.Log.Info("Ensure that Ingestor Cluster is in Ready phase")
144-
// testenv.IngestorReady(ctx, deployment, testcaseEnvInst)
145-
146-
// // Ensure that Cluster Manager is in Ready phase
147-
// testcaseEnvInst.Log.Info("Ensure that Cluster Manager is in Ready phase")
148-
// testenv.ClusterManagerReady(ctx, deployment, testcaseEnvInst)
149-
150-
// // Ensure that Indexer Cluster is in Ready phase
151-
// testcaseEnvInst.Log.Info("Ensure that Indexer Cluster is in Ready phase")
152-
// testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst)
153-
154-
// })
155-
// })
124+
Context("Ingestor and Indexer deployment", func() {
125+
It("indingsep, smoke, indingsep: Splunk Operator can deploy Ingestors and Indexers with additional configurations", func() {
126+
// Create Service Account
127+
testcaseEnvInst.Log.Info("Create Service Account")
128+
testcaseEnvInst.CreateServiceAccount(serviceAccountName)
129+
130+
// Deploy Ingestor Cluster with additional configurations (similar to standalone app framework test)
131+
ic := &enterpriseApi.IngestorCluster{
132+
ObjectMeta: metav1.ObjectMeta{
133+
Name: deployment.GetName() + "-ingest",
134+
Namespace: deployment.GetName(),
135+
Labels: map[string]string{"test-type": "smoke"},
136+
Annotations: map[string]string{"test": "indingsep"},
137+
},
138+
Spec: enterpriseApi.IngestorClusterSpec{
139+
CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{
140+
ServiceAccount: serviceAccountName,
141+
LivenessInitialDelaySeconds: 600,
142+
ReadinessInitialDelaySeconds: 50,
143+
StartupProbe: &enterpriseApi.Probe{
144+
InitialDelaySeconds: 40,
145+
TimeoutSeconds: 30,
146+
PeriodSeconds: 30,
147+
FailureThreshold: 12,
148+
},
149+
LivenessProbe: &enterpriseApi.Probe{
150+
InitialDelaySeconds: 400,
151+
TimeoutSeconds: 30,
152+
PeriodSeconds: 30,
153+
FailureThreshold: 12,
154+
},
155+
ReadinessProbe: &enterpriseApi.Probe{
156+
InitialDelaySeconds: 20,
157+
TimeoutSeconds: 30,
158+
PeriodSeconds: 30,
159+
FailureThreshold: 12,
160+
},
161+
EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{
162+
EphemeralStorage: true,
163+
StorageCapacity: "20Gi",
164+
},
165+
VarVolumeStorageConfig: enterpriseApi.StorageClassSpec{
166+
EphemeralStorage: true,
167+
StorageCapacity: "20Gi",
168+
},
169+
Spec: enterpriseApi.Spec{
170+
ImagePullPolicy: "Always",
171+
Image: testcaseEnvInst.GetSplunkImage(),
172+
},
173+
},
174+
PushBus: bus,
175+
PipelineConfig: pipelineConfig,
176+
Replicas: 3,
177+
AppFrameworkConfig: enterpriseApi.AppFrameworkSpec{
178+
AppsRepoPollInterval: 90,
179+
Defaults: enterpriseApi.AppSourceDefaultSpec{
180+
VolName: "volume_app_repo",
181+
Scope: "local",
182+
},
183+
AppSources: []enterpriseApi.AppSourceSpec{
184+
{
185+
Name: "appsource1",
186+
Location: "s3://your-bucket/apps/",
187+
AppSourceDefaultSpec: enterpriseApi.AppSourceDefaultSpec{
188+
VolName: "volume_app_repo_1",
189+
Scope: enterpriseApi.ScopeLocal,
190+
},
191+
},
192+
},
193+
VolList: []enterpriseApi.VolumeSpec{
194+
{
195+
Name: "volume_app_repo",
196+
Endpoint: "https://s3.us-west-2.amazonaws.com",
197+
Path: "your-bucket/apps/",
198+
SecretRef: "s3-secret",
199+
Type: "s3",
200+
Provider: "aws",
201+
},
202+
},
203+
},
204+
},
205+
}
206+
207+
testcaseEnvInst.Log.Info("Deploy Ingestor Cluster with additional configurations")
208+
_, err := deployment.DeployIngestorClusterWithAdditionalConfiguration(ctx, ic)
209+
Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster")
210+
211+
// Deploy Cluster Manager
212+
testcaseEnvInst.Log.Info("Deploy Cluster Manager")
213+
_, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec)
214+
Expect(err).To(Succeed(), "Unable to deploy Cluster Manager")
215+
216+
// Deploy Indexer Cluster
217+
testcaseEnvInst.Log.Info("Deploy Indexer Cluster")
218+
_, err = deployment.DeployIndexerCluster(ctx, deployment.GetName()+"-idxc", "", 3, deployment.GetName(), "", bus, pipelineConfig, serviceAccountName)
219+
Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster")
220+
221+
// Ensure that Ingestor Cluster is in Ready phase
222+
testcaseEnvInst.Log.Info("Ensure that Ingestor Cluster is in Ready phase")
223+
testenv.IngestorReady(ctx, deployment, testcaseEnvInst)
224+
225+
// Ensure that Cluster Manager is in Ready phase
226+
testcaseEnvInst.Log.Info("Ensure that Cluster Manager is in Ready phase")
227+
testenv.ClusterManagerReady(ctx, deployment, testcaseEnvInst)
228+
229+
// Ensure that Indexer Cluster is in Ready phase
230+
testcaseEnvInst.Log.Info("Ensure that Indexer Cluster is in Ready phase")
231+
testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst)
232+
233+
// Verify Ingestor Cluster Pods have apps installed
234+
testcaseEnvInst.Log.Info("Verify Ingestor Cluster Pods have apps installed")
235+
ingestorPod := []string{fmt.Sprintf(testenv.IngestorPod, deployment.GetName()+"-ingest", 0)}
236+
ingestorAppSourceInfo := testenv.AppSourceInfo{
237+
CrKind: ic.Kind,
238+
CrName: ic.Name,
239+
CrAppSourceName: "appsource1",
240+
CrPod: ingestorPod,
241+
CrAppVersion: "V1",
242+
CrAppScope: enterpriseApi.ScopeLocal,
243+
CrAppList: []string{"app1", "app2"},
244+
CrAppFileList: []string{"app1.tgz", "app2.tgz"},
245+
CrReplicas: 3,
246+
}
247+
allAppSourceInfo := []testenv.AppSourceInfo{ingestorAppSourceInfo}
248+
splunkPodAge := testenv.GetPodsStartTime(testcaseEnvInst.GetName())
249+
testenv.AppFrameWorkVerifications(ctx, deployment, testcaseEnvInst, allAppSourceInfo, splunkPodAge, "")
250+
251+
// Verify additional probe configurations
252+
testcaseEnvInst.Log.Info("Verify probe configurations on Ingestor pods")
253+
scriptsNames := []string{enterprise.GetLivenessScriptName(), enterprise.GetReadinessScriptName(), enterprise.GetStartupScriptName()}
254+
allPods := testenv.DumpGetPods(testcaseEnvInst.GetName())
255+
testenv.VerifyFilesInDirectoryOnPod(ctx, deployment, testcaseEnvInst, testcaseEnvInst.GetName(), allPods, scriptsNames, enterprise.GetProbeMountDirectory(), false, true)
256+
257+
// // Verify storage configurations
258+
// testcaseEnvInst.Log.Info("Verify storage configurations")
259+
// ingestorPodName := fmt.Sprintf("%s-ingest-ingestor-0", deployment.GetName())
260+
261+
// // Check if ephemeral storage is being used
262+
// pod, err := testenv.GetPod(ctx, deployment, testcaseEnvInst.GetName(), ingestorPodName)
263+
// Expect(err).To(Succeed(), "Unable to get Ingestor pod")
264+
265+
// // Verify volume configurations match spec
266+
// foundEtcVolume := false
267+
// foundVarVolume := false
268+
// for _, volume := range pod.Spec.Volumes {
269+
// if volume.Name == "etc-volume" && volume.EmptyDir != nil {
270+
// foundEtcVolume = true
271+
// }
272+
// if volume.Name == "var-volume" && volume.EmptyDir != nil {
273+
// foundVarVolume = true
274+
// }
275+
// }
276+
// Expect(foundEtcVolume).To(BeTrue(), "etc-volume with ephemeral storage not found")
277+
// Expect(foundVarVolume).To(BeTrue(), "var-volume with ephemeral storage not found")
278+
279+
// testcaseEnvInst.Log.Info("All verifications completed successfully")
280+
})
281+
})
156282

157283
Context("Ingestor and Indexer deployment", func() {
158284
It("indingsep, integration, indingsep: Splunk Operator can deploy Ingestors and Indexers with correct setup", func() {

test/testenv/deployment.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,21 @@ func (d *Deployment) DeployIngestorCluster(ctx context.Context, name string, cou
460460
return deployed.(*enterpriseApi.IngestorCluster), err
461461
}
462462

463+
// DeployIngestorClusterWithAdditionalConfiguration deploys the ingestor cluster with additional configuration
464+
func (d *Deployment) DeployIngestorClusterWithAdditionalConfiguration(ctx context.Context, ic *enterpriseApi.IngestorCluster) (*enterpriseApi.IngestorCluster, error) {
465+
d.testenv.Log.Info("Deploying ingestor cluster with additional configuration", "name", ic.Name)
466+
467+
pdata, _ := json.Marshal(ic)
468+
469+
d.testenv.Log.Info("ingestor cluster spec", "cr", string(pdata))
470+
deployed, err := d.deployCR(ctx, ic.Name, ic)
471+
if err != nil {
472+
return nil, err
473+
}
474+
475+
return deployed.(*enterpriseApi.IngestorCluster), err
476+
}
477+
463478
// DeploySearchHeadCluster deploys a search head cluster
464479
func (d *Deployment) DeploySearchHeadCluster(ctx context.Context, name, ClusterManagerRef, LicenseManagerName string, ansibleConfig string, mcRef string) (*enterpriseApi.SearchHeadCluster, error) {
465480
d.testenv.Log.Info("Deploying search head cluster", "name", name)

test/testenv/testenv.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
"fmt"
2121
"net"
2222
"os"
23-
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
2423
"time"
2524

25+
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
26+
2627
enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3"
2728
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2829

@@ -77,6 +78,9 @@ const (
7778
// LicenseMasterPod Template String for standalone pod
7879
LicenseMasterPod = "splunk-%s-" + splcommon.LicenseManager + "-%d"
7980

81+
// IngestorPod Template String for ingestor pod
82+
IngestorPod = "splunk-%s-ingestor-%d"
83+
8084
// IndexerPod Template String for indexer pod
8185
IndexerPod = "splunk-%s-idxc-indexer-%d"
8286

0 commit comments

Comments
 (0)