Skip to content

Commit f4a7de1

Browse files
Merge branch 'develop' into CSPL555
2 parents 240d945 + 2c4e8bb commit f4a7de1

File tree

5 files changed

+301
-124
lines changed

5 files changed

+301
-124
lines changed

test/custom_resource_crud/custom_resource_crud_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
. "github.com/onsi/ginkgo"
2020
. "github.com/onsi/gomega"
21+
splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
2122
"github.com/splunk/splunk-operator/test/testenv"
2223
corev1 "k8s.io/api/core/v1"
2324
"k8s.io/apimachinery/pkg/api/resource"
@@ -69,7 +70,7 @@ var _ = Describe("crcrud test", func() {
6970
Expect(err).To(Succeed(), "Unable to deploy standalone instance with updated CR ")
7071

7172
// Verify Standalone is updating
72-
testenv.VerifyStandaloneUpdating(deployment, deployment.GetName(), standalone, testenvInstance)
73+
testenv.VerifyStandalonePhase(deployment, testenvInstance, deployment.GetName(), splcommon.PhaseUpdating)
7374

7475
// Verify Standalone goes to ready state
7576
testenv.StandaloneReady(deployment, deployment.GetName(), standalone, testenvInstance)

test/secret/secret_test.go

Lines changed: 173 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,21 @@ var _ = Describe("secret test", func() {
6363
// Wait for Standalone to be in READY status
6464
testenv.StandaloneReady(deployment, deployment.GetName(), standalone, testenvInstance)
6565

66-
// Modify Secret key with new value
67-
secretKey := testenv.SecretObject["HecToken"]
68-
standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)
69-
HecToken := testenv.GetMountedKey(deployment, standalonePodName, secretKey)
70-
modifiedHecToken := HecToken[:len(HecToken)-2] + "11"
71-
testenv.ModifySecretKey(deployment, testenvInstance.GetName(), secretKey, modifiedHecToken)
66+
// Verify MC Pod is Ready
67+
testenv.MCPodReady(testenvInstance.GetName(), deployment)
68+
69+
// Get Current Secrets
70+
secretName := fmt.Sprintf(testenv.SecretObjectName, testenvInstance.GetName())
71+
secretObj := testenv.GetSecretObject(deployment, testenvInstance.GetName(), secretName)
72+
73+
// Update Secret Values
74+
modifedKeyValue := "whatever"
75+
hecToken := testenv.DecodeBase64(secretObj.Data.HecToken)
76+
modifiedHecToken := hecToken[:len(hecToken)-2] + testenv.RandomDNSName(2)
77+
secretObj.Data.HecToken = testenv.EncodeBase64(modifiedHecToken)
78+
secretObj.Data.Password = testenv.EncodeBase64(modifedKeyValue)
79+
secretObj.Data.Pass4SymmKey = testenv.EncodeBase64(modifedKeyValue)
80+
testenv.UpdateSecret(deployment, testenvInstance.GetName(), secretObj)
7281

7382
// Ensure standalone is updating
7483
testenv.VerifyStandalonePhase(deployment, testenvInstance, deployment.GetName(), splcommon.PhaseUpdating)
@@ -82,27 +91,40 @@ var _ = Describe("secret test", func() {
8291
// Verify MC Pod is Ready
8392
testenv.MCPodReady(testenvInstance.GetName(), deployment)
8493

85-
//Once system is up after update check each pod for secret key update
94+
// Once system is up after update check each pod for secret key update
8695
standaloneSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "standalone", 2)
8796
licenseMasterSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "license-master", 2)
8897
monitoringConsoleSecretName := fmt.Sprintf(testenv.SecretObjectPodName, testenvInstance.GetName(), "monitoring-console", 2)
8998
verificationSecrets := []string{standaloneSecretName, licenseMasterSecretName, monitoringConsoleSecretName}
9099

91-
//Verify that each StatefulSet based secret has been update
92-
testenv.VerifySecretObjectUpdate(deployment, testenvInstance, verificationSecrets, secretKey, modifiedHecToken)
100+
// Verify that HEC TOKEN is updated
101+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
93102

94-
//All pods to be used to check for secret object update
103+
// Verify that Admin Password is updated
104+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
105+
106+
// Verify that Pass4SymmKey is updated
107+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
108+
109+
// All pods to be used to check for secret object update
110+
standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)
95111
licenseMasterPodName := fmt.Sprintf(testenv.LicenseMasterPod, deployment.GetName(), 0)
96112
monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, testenvInstance.GetName(), 0)
97113
verificationPods := []string{standalonePodName, licenseMasterPodName, monitoringConsolePodName}
98114

99-
//Verify that new token is mounted on each pod
100-
testenv.VerifySecretPodUpdate(deployment, testenvInstance, verificationPods, secretKey, modifiedHecToken)
115+
// Verify that HEC TOKEN is updated
116+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
117+
118+
// Verify that Admin Password is updated
119+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
120+
121+
// Verify that Pass4SymmKey is updated
122+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
101123
})
102124
})
103125

104126
Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() {
105-
It("secret: Secret update on indexers and search head cluster", func() {
127+
It("secret: secret update on indexers and search head cluster", func() {
106128

107129
// Download License File
108130
licenseFilePath, err := testenv.DownloadFromS3Bucket()
@@ -114,15 +136,47 @@ var _ = Describe("secret test", func() {
114136
err = deployment.DeploySingleSiteCluster(deployment.GetName(), 3, true /*shc*/)
115137
Expect(err).To(Succeed(), "Unable to deploy cluster")
116138

139+
// Wait for License Master to be in READY status
140+
testenv.LicenseMasterReady(deployment, testenvInstance)
141+
117142
// Ensure that the cluster-master goes to Ready phase
118143
testenv.ClusterMasterReady(deployment, testenvInstance)
119144

120-
// Modify Secret key with new value
121-
secretKey := testenv.SecretObject["HecToken"]
122-
clusterMasterPodName := fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName())
123-
HecToken := testenv.GetMountedKey(deployment, clusterMasterPodName, secretKey)
124-
modifiedHecToken := HecToken[:len(HecToken)-2] + "11"
125-
testenv.ModifySecretKey(deployment, testenvInstance.GetName(), secretKey, modifiedHecToken)
145+
// Ensure indexers go to Ready phase
146+
testenv.SingleSiteIndexersReady(deployment, testenvInstance)
147+
148+
// Ensure search head cluster go to Ready phase
149+
testenv.SearchHeadClusterReady(deployment, testenvInstance)
150+
151+
// Verify MC Pod is Ready
152+
testenv.MCPodReady(testenvInstance.GetName(), deployment)
153+
154+
// Verify RF SF is met
155+
testenv.VerifyRFSFMet(deployment, testenvInstance)
156+
157+
// Get Current Secrets
158+
secretName := fmt.Sprintf(testenv.SecretObjectName, testenvInstance.GetName())
159+
secretObj := testenv.GetSecretObject(deployment, testenvInstance.GetName(), secretName)
160+
161+
// Update Secret Values
162+
modifedKeyValue := "whatever"
163+
hecToken := testenv.DecodeBase64(secretObj.Data.HecToken)
164+
modifiedHecToken := hecToken[:len(hecToken)-2] + testenv.RandomDNSName(2)
165+
secretObj.Data.HecToken = testenv.EncodeBase64(modifiedHecToken)
166+
secretObj.Data.Password = testenv.EncodeBase64(modifedKeyValue)
167+
secretObj.Data.Pass4SymmKey = testenv.EncodeBase64(modifedKeyValue)
168+
secretObj.Data.IdxcSecret = testenv.EncodeBase64(modifedKeyValue)
169+
secretObj.Data.ShcSecret = testenv.EncodeBase64(modifedKeyValue)
170+
testenv.UpdateSecret(deployment, testenvInstance.GetName(), secretObj)
171+
172+
// Ensure that Cluster Master goes to update phase
173+
testenv.VerifyClusterMasterPhase(deployment, testenvInstance, splcommon.PhaseUpdating)
174+
175+
// Wait for License Master to be in READY status
176+
testenv.LicenseMasterReady(deployment, testenvInstance)
177+
178+
// Ensure that the cluster-master goes to Ready phase
179+
testenv.ClusterMasterReady(deployment, testenvInstance)
126180

127181
// Ensure indexers go to Ready phase
128182
testenv.SingleSiteIndexersReady(deployment, testenvInstance)
@@ -136,7 +190,7 @@ var _ = Describe("secret test", func() {
136190
// Verify RF SF is met
137191
testenv.VerifyRFSFMet(deployment, testenvInstance)
138192

139-
//Once system is up after update check each pod for secret key update
193+
// Once PODS are up after update check each pod for secret key update
140194
clusterMasterSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "cluster-master", 2)
141195
indexerSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "idxc-indexer", 2)
142196
licenseMasterSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "license-master", 2)
@@ -145,10 +199,23 @@ var _ = Describe("secret test", func() {
145199
monitoringConsoleSecretName := fmt.Sprintf(testenv.SecretObjectPodName, testenvInstance.GetName(), "monitoring-console", 2)
146200
verificationSecrets := []string{clusterMasterSecretName, indexerSecretName, licenseMasterSecretName, searchHeadDeployerSecretName, searchHeadSecretName, monitoringConsoleSecretName}
147201

148-
//Verify that each StatefulSet based secret has been update
149-
testenv.VerifySecretObjectUpdate(deployment, testenvInstance, verificationSecrets, secretKey, modifiedHecToken)
202+
// Verify that HEC TOKEN is updated
203+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
204+
205+
// Verify that Admin Password is updated
206+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
150207

151-
//All pods to be used to check for secret object update
208+
// Verify that Pass4SymmKey is updated
209+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
210+
211+
// Verify that IdxcPass4Symmkey is updated
212+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["IdxcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.IdxcSecret))
213+
214+
// Verify that ShcPass4Symmkey is updated
215+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["ShcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.ShcSecret))
216+
217+
// All pods to be used to check for secret object update
218+
clusterMasterPodName := fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName())
152219
licenseMasterPodName := fmt.Sprintf(testenv.LicenseMasterPod, deployment.GetName(), 0)
153220
monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, testenvInstance.GetName(), 0)
154221
indexerPodName0 := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), 0)
@@ -159,8 +226,20 @@ var _ = Describe("secret test", func() {
159226
SearchHeadPodName2 := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 2)
160227
verificationPods := []string{licenseMasterPodName, monitoringConsolePodName, clusterMasterPodName, indexerPodName1, indexerPodName2, indexerPodName0, SearchHeadPodName0, SearchHeadPodName1, SearchHeadPodName2}
161228

162-
//Verify that new token is mounted on each pod
163-
testenv.VerifySecretPodUpdate(deployment, testenvInstance, verificationPods, secretKey, modifiedHecToken)
229+
// Verify that HEC TOKEN is updated
230+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
231+
232+
// Verify that Admin Password is updated
233+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
234+
235+
// Verify that Pass4SymmKey is updated
236+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
237+
238+
// Verify that IdxcPass4Symmkey is updated
239+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["IdxcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.IdxcSecret))
240+
241+
// Verify that ShcPass4Symmkey is updated
242+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["ShcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.ShcSecret))
164243

165244
})
166245
})
@@ -179,29 +258,58 @@ var _ = Describe("secret test", func() {
179258
err = deployment.DeployMultisiteClusterWithSearchHead(deployment.GetName(), 1, siteCount)
180259
Expect(err).To(Succeed(), "Unable to deploy cluster")
181260

182-
// Ensure that the cluster-master goes to Ready phase
183-
testenv.ClusterMasterReady(deployment, testenvInstance)
184-
185-
// Modify Secret key with new value
186-
secretKey := testenv.SecretObject["HecToken"]
187-
clusterMasterPodName := fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName())
188-
HecToken := testenv.GetMountedKey(deployment, clusterMasterPodName, secretKey)
189-
modifiedHecToken := HecToken[:len(HecToken)-2] + "11"
190-
testenv.ModifySecretKey(deployment, testenvInstance.GetName(), secretKey, modifiedHecToken)
261+
// Wait for License Master to be in READY status
262+
testenv.LicenseMasterReady(deployment, testenvInstance)
191263

192264
// Ensure that the cluster-master goes to Ready phase
193265
testenv.ClusterMasterReady(deployment, testenvInstance)
194266

195267
// Ensure the indexers of all sites go to Ready phase
196268
testenv.IndexersReady(deployment, testenvInstance, siteCount)
197269

270+
// Ensure search head cluster go to Ready phase
271+
testenv.SearchHeadClusterReady(deployment, testenvInstance)
272+
198273
// Ensure cluster configured as multisite
199274
testenv.IndexerClusterMultisiteStatus(deployment, testenvInstance, siteCount)
200275

276+
// Verify MC Pod is Ready
277+
testenv.MCPodReady(testenvInstance.GetName(), deployment)
278+
279+
// Get Current Secrets
280+
secretName := fmt.Sprintf(testenv.SecretObjectName, testenvInstance.GetName())
281+
secretObj := testenv.GetSecretObject(deployment, testenvInstance.GetName(), secretName)
282+
283+
// Update Secret Values
284+
modifedKeyValue := "whatever"
285+
hecToken := testenv.DecodeBase64(secretObj.Data.HecToken)
286+
modifiedHecToken := hecToken[:len(hecToken)-2] + testenv.RandomDNSName(2)
287+
secretObj.Data.HecToken = testenv.EncodeBase64(modifiedHecToken)
288+
secretObj.Data.Password = testenv.EncodeBase64(modifedKeyValue)
289+
secretObj.Data.Pass4SymmKey = testenv.EncodeBase64(modifedKeyValue)
290+
secretObj.Data.IdxcSecret = testenv.EncodeBase64(modifedKeyValue)
291+
secretObj.Data.ShcSecret = testenv.EncodeBase64(modifedKeyValue)
292+
testenv.UpdateSecret(deployment, testenvInstance.GetName(), secretObj)
293+
294+
// Ensure that Cluster Master goes to update phase
295+
testenv.VerifyClusterMasterPhase(deployment, testenvInstance, splcommon.PhaseUpdating)
296+
297+
// Ensure that the cluster-master goes to Ready phase
298+
testenv.ClusterMasterReady(deployment, testenvInstance)
299+
300+
// Wait for License Master to be in READY status
301+
testenv.LicenseMasterReady(deployment, testenvInstance)
302+
303+
// Ensure the indexers of all sites go to Ready phase
304+
testenv.IndexersReady(deployment, testenvInstance, siteCount)
305+
201306
// Ensure search head cluster go to Ready phase
202307
testenv.SearchHeadClusterReady(deployment, testenvInstance)
203308

204-
//Once system is up after update check each pod for secret key update
309+
// Verify MC Pod is Ready
310+
testenv.MCPodReady(testenvInstance.GetName(), deployment)
311+
312+
// Once POS are up after update check each pod for secret key update
205313
clusterMasterSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "cluster-master", 2)
206314
licenseMasterSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "license-master", 2)
207315
searchHeadDeployerSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "shc-deployer", 2)
@@ -212,10 +320,23 @@ var _ = Describe("secret test", func() {
212320
site3IndexerSecretName := fmt.Sprintf(testenv.SecretObjectPodName, deployment.GetName(), "site3-indexer", 2)
213321
verificationSecrets := []string{site1IndexerSecretName, site3IndexerSecretName, site2IndexerSecretName, clusterMasterSecretName, licenseMasterSecretName, searchHeadDeployerSecretName, searchHeadSecretName, monitoringConsoleSecretName}
214322

215-
//Verify that each StatefulSet based secret has been update
216-
testenv.VerifySecretObjectUpdate(deployment, testenvInstance, verificationSecrets, secretKey, modifiedHecToken)
323+
// Verify that HEC TOKEN is updated
324+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
217325

218-
//All pods to be used to check for secret object update
326+
// Verify that Admin Password is updated
327+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
328+
329+
// Verify that Pass4SymmKey is updated
330+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
331+
332+
// Verify that IdxcPass4Symmkey is updated
333+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["IdxcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.IdxcSecret))
334+
335+
// Verify that ShcPass4Symmkey is updated
336+
testenv.VerifySecretObjectUpdated(deployment, testenvInstance, verificationSecrets, testenv.SecretObject["ShcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.ShcSecret))
337+
338+
// All pods to be used to check for secret object update
339+
clusterMasterPodName := fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName())
219340
licenseMasterPodName := fmt.Sprintf(testenv.LicenseMasterPod, deployment.GetName(), 0)
220341
monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, testenvInstance.GetName(), 0)
221342
SearchHeadPodName0 := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 0)
@@ -226,8 +347,20 @@ var _ = Describe("secret test", func() {
226347
Site3IndexerPodName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), 3, 0)
227348
verificationPods := []string{licenseMasterPodName, monitoringConsolePodName, clusterMasterPodName, SearchHeadPodName0, SearchHeadPodName1, SearchHeadPodName2, Site1IndexerPodName, Site2IndexerPodName, Site3IndexerPodName}
228349

229-
//Verify that new token is mounted on each pod
230-
testenv.VerifySecretPodUpdate(deployment, testenvInstance, verificationPods, secretKey, modifiedHecToken)
350+
// Verify that HEC TOKEN is updated
351+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["HecToken"], testenv.DecodeBase64(secretObj.Data.HecToken))
352+
353+
// Verify that Admin Password is updated
354+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["AdminPassword"], testenv.DecodeBase64(secretObj.Data.Password))
355+
356+
// Verify that Pass4SymmKey is updated
357+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["Pass4SymmKey"], testenv.DecodeBase64(secretObj.Data.Pass4SymmKey))
358+
359+
// Verify that IdxcPass4Symmkey is updated
360+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["IdxcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.IdxcSecret))
361+
362+
// Verify that ShcPass4Symmkey is updated
363+
testenv.VerifySecretsUpdatedOnPod(deployment, testenvInstance, verificationPods, testenv.SecretObject["ShcPass4Symmkey"], testenv.DecodeBase64(secretObj.Data.ShcSecret))
231364
})
232365
})
233366
})

0 commit comments

Comments
 (0)