@@ -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 () {
0 commit comments