Skip to content

Commit 7be7f2c

Browse files
committed
Avoid upgrade path during enterprise deployments creation.
1 parent d6ccab9 commit 7be7f2c

File tree

8 files changed

+72
-37
lines changed

8 files changed

+72
-37
lines changed

go.mod

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ require (
88
github.com/google/go-cmp v0.6.0
99
github.com/joho/godotenv v1.5.1
1010
github.com/minio/minio-go/v7 v7.0.16
11-
github.com/onsi/ginkgo/v2 v2.20.2
12-
github.com/onsi/gomega v1.34.2
11+
github.com/onsi/ginkgo/v2 v2.21.0
12+
github.com/onsi/gomega v1.35.1
1313
github.com/pkg/errors v0.9.1
1414
github.com/prometheus/client_golang v1.14.0
1515
github.com/stretchr/testify v1.8.4
@@ -44,7 +44,7 @@ require (
4444
github.com/golang/protobuf v1.5.3 // indirect
4545
github.com/google/gnostic v0.5.7-v3refs // indirect
4646
github.com/google/gofuzz v1.1.0 // indirect
47-
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
47+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
4848
github.com/google/uuid v1.3.0 // indirect
4949
github.com/imdario/mergo v0.3.12 // indirect
5050
github.com/jmespath/go-jmespath v0.4.0 // indirect
@@ -70,17 +70,17 @@ require (
7070
github.com/spf13/pflag v1.0.5 // indirect
7171
go.uber.org/atomic v1.7.0 // indirect
7272
go.uber.org/multierr v1.6.0 // indirect
73-
golang.org/x/crypto v0.26.0 // indirect
74-
golang.org/x/net v0.28.0 // indirect
73+
golang.org/x/crypto v0.28.0 // indirect
74+
golang.org/x/net v0.30.0 // indirect
7575
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
76-
golang.org/x/sys v0.24.0 // indirect
77-
golang.org/x/term v0.23.0 // indirect
78-
golang.org/x/text v0.17.0 // indirect
76+
golang.org/x/sys v0.26.0 // indirect
77+
golang.org/x/term v0.25.0 // indirect
78+
golang.org/x/text v0.19.0 // indirect
7979
golang.org/x/time v0.3.0 // indirect
80-
golang.org/x/tools v0.24.0 // indirect
80+
golang.org/x/tools v0.26.0 // indirect
8181
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
8282
google.golang.org/appengine v1.6.7 // indirect
83-
google.golang.org/protobuf v1.34.1 // indirect
83+
google.golang.org/protobuf v1.35.1 // indirect
8484
gopkg.in/inf.v0 v0.9.1 // indirect
8585
gopkg.in/ini.v1 v1.66.4 // indirect
8686
gopkg.in/yaml.v2 v2.4.0 // indirect

go.sum

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
174174
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
175175
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA=
176176
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
177+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
178+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
177179
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
178180
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
179181
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
@@ -256,8 +258,12 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
256258
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
257259
github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4=
258260
github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag=
261+
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
262+
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
259263
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
260264
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
265+
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
266+
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
261267
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
262268
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
263269
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -343,6 +349,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
343349
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
344350
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
345351
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
352+
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
353+
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
346354
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
347355
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
348356
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -407,6 +415,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su
407415
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
408416
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
409417
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
418+
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
419+
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
410420
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
411421
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
412422
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -468,11 +478,15 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc
468478
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
469479
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
470480
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
481+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
482+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
471483
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
472484
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
473485
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
474486
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
475487
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
488+
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
489+
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
476490
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
477491
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
478492
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -482,6 +496,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
482496
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
483497
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
484498
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
499+
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
500+
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
485501
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
486502
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
487503
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -533,6 +549,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
533549
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
534550
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
535551
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
552+
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
553+
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
536554
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
537555
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
538556
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -619,6 +637,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
619637
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
620638
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
621639
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
640+
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
641+
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
622642
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
623643
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
624644
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/splunk/enterprise/clustermanager.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,13 @@ func ApplyClusterManager(ctx context.Context, client splcommon.ControllerClient,
185185
return result, err
186186
}
187187

188-
// check if the ClusterManager is ready for version upgrade, if required
189-
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
190-
if err != nil || !continueReconcile {
191-
return result, err
188+
// CSPL-3060 - If statefulSet is not created, avoid upgrade path validation
189+
if !statefulSet.CreationTimestamp.IsZero() {
190+
// check if the ClusterManager is ready for version upgrade, if required
191+
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
192+
if err != nil || !continueReconcile {
193+
return result, err
194+
}
192195
}
193196

194197
clusterManagerManager := splctrl.DefaultStatefulSetPodManager{}

pkg/splunk/enterprise/indexercluster.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,14 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
201201
}
202202
}
203203

204-
// check if the IndexerCluster is ready for version upgrade
205204
cr.Kind = "IndexerCluster"
206-
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, &mgr)
207-
if err != nil || !continueReconcile {
208-
return result, err
205+
// CSPL-3060 - If statefulSet is not created, avoid upgrade path validation
206+
if !statefulSet.CreationTimestamp.IsZero() {
207+
// check if the IndexerCluster is ready for version upgrade
208+
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, &mgr)
209+
if err != nil || !continueReconcile {
210+
return result, err
211+
}
209212
}
210213

211214
// check if version upgrade is set
@@ -453,11 +456,14 @@ func ApplyIndexerCluster(ctx context.Context, client splcommon.ControllerClient,
453456
}
454457
}
455458

456-
// check if the IndexerCluster is ready for version upgrade
457459
cr.Kind = "IndexerCluster"
458-
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, &mgr)
459-
if err != nil || !continueReconcile {
460-
return result, err
460+
// CSPL-3060 - If statefulSet is not created, avoid upgrade path validation
461+
if !statefulSet.CreationTimestamp.IsZero() {
462+
// check if the IndexerCluster is ready for version upgrade
463+
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, &mgr)
464+
if err != nil || !continueReconcile {
465+
return result, err
466+
}
461467
}
462468

463469
// check if version upgrade is set
@@ -628,8 +634,8 @@ func ApplyIdxcSecret(ctx context.Context, mgr *indexerClusterPodManager, replica
628634
// If namespace scoped secret revision is the same ignore
629635
if len(mgr.cr.Status.NamespaceSecretResourceVersion) == 0 {
630636
// First time, set resource version in CR
631-
scopedLog.Info("Setting CrStatusNamespaceSecretResourceVersion for the first time")
632637
mgr.cr.Status.NamespaceSecretResourceVersion = namespaceSecret.ObjectMeta.ResourceVersion
638+
scopedLog.Info("Setting CrStatusNamespaceSecretResourceVersion for the first time")
633639
return nil
634640
} else if mgr.cr.Status.NamespaceSecretResourceVersion == namespaceSecret.ObjectMeta.ResourceVersion {
635641
// If resource version hasn't changed don't return
@@ -777,6 +783,7 @@ func (mgr *indexerClusterPodManager) Update(ctx context.Context, c splcommon.Con
777783
}
778784
} else {
779785
mgr.log.Info("Cluster Manager is not ready yet", "reason ", err)
786+
return enterpriseApi.PhaseError, err
780787
}
781788

782789
// Get the podExecClient with empty targetPodName.

pkg/splunk/enterprise/monitoringconsole.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,13 @@ func ApplyMonitoringConsole(ctx context.Context, client splcommon.ControllerClie
141141
return result, err
142142
}
143143

144-
// check if the Monitoring Console is ready for version upgrade, if required
145-
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
146-
if err != nil || !continueReconcile {
147-
return result, err
144+
// CSPL-3060 - If statefulSet is not created, avoid upgrade path validation
145+
if !statefulSet.CreationTimestamp.IsZero() {
146+
// check if the Monitoring Console is ready for version upgrade, if required
147+
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
148+
if err != nil || !continueReconcile {
149+
return result, err
150+
}
148151
}
149152

150153
mgr := splctrl.DefaultStatefulSetPodManager{}

pkg/splunk/enterprise/monitoringconsole_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ func TestApplyMonitoringConsole(t *testing.T) {
9898
"app.kubernetes.io/component": "versionedSecrets",
9999
"app.kubernetes.io/managed-by": "splunk-operator",
100100
}
101+
101102
listOpts := []client.ListOption{
102103
client.InNamespace("test"),
103104
client.MatchingLabels(labels),
104105
}
105-
106106
listOpts2 := []client.ListOption{
107107
client.InNamespace("test"),
108108
}
@@ -112,8 +112,8 @@ func TestApplyMonitoringConsole(t *testing.T) {
112112
{ListOpts: listOpts2},
113113
}
114114

115-
createCalls := map[string][]spltest.MockFuncCall{"Get": funcCalls, "Create": {funcCalls[0], funcCalls[3], funcCalls[4], funcCalls[7], funcCalls[9], funcCalls[10], funcCalls[5]}, "Update": {funcCalls[0], funcCalls[10]}, "List": {listmockCall[0], listmockCall[1], listmockCall[1], listmockCall[1], listmockCall[1], listmockCall[1]}}
116-
updateCalls := map[string][]spltest.MockFuncCall{"Get": updateFuncCalls, "Update": {updateFuncCalls[4]}, "List": {listmockCall[0], listmockCall[1], listmockCall[1], listmockCall[1], listmockCall[1], listmockCall[1]}}
115+
createCalls := map[string][]spltest.MockFuncCall{"Get": funcCalls, "Create": {funcCalls[0], funcCalls[3], funcCalls[4], funcCalls[7], funcCalls[9], funcCalls[10], funcCalls[5]}, "Update": {funcCalls[0], funcCalls[10]}, "List": {listmockCall[0]}}
116+
updateCalls := map[string][]spltest.MockFuncCall{"Get": updateFuncCalls, "Update": {updateFuncCalls[4]}, "List": {listmockCall[0]}}
117117

118118
current := enterpriseApi.MonitoringConsole{
119119
TypeMeta: metav1.TypeMeta{

pkg/splunk/enterprise/searchheadcluster.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ func ApplySearchHeadCluster(ctx context.Context, client splcommon.ControllerClie
166166
return result, err
167167
}
168168

169-
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
170-
if err != nil || !continueReconcile {
171-
return result, err
169+
// CSPL-3060 - If statefulSet is not created, avoid upgrade path validation
170+
if !statefulSet.CreationTimestamp.IsZero() {
171+
continueReconcile, err := UpgradePathValidation(ctx, client, cr, cr.Spec.CommonSplunkSpec, nil)
172+
if err != nil || !continueReconcile {
173+
return result, err
174+
}
172175
}
173176

174177
deployerManager := splctrl.DefaultStatefulSetPodManager{}

pkg/splunk/enterprise/searchheadcluster_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func TestApplySearchHeadCluster(t *testing.T) {
8181
{MetaName: "*v1.Secret-test-splunk-test-secret"},
8282
{MetaName: "*v1.Secret-test-splunk-stack1-deployer-secret-v1"},
8383

84-
{MetaName: "*v1.StatefulSet-test-splunk-stack1-search-head"},
8584
{MetaName: "*v1.StatefulSet-test-splunk-stack1-deployer"},
8685
{MetaName: "*v1.StatefulSet-test-splunk-stack1-search-head"},
8786

@@ -108,7 +107,7 @@ func TestApplySearchHeadCluster(t *testing.T) {
108107
{MetaName: "*v1.ConfigMap-test-splunk-test-probe-configmap"},
109108
{MetaName: "*v1.Secret-test-splunk-test-secret"},
110109
{MetaName: "*v1.Secret-test-splunk-stack1-deployer-secret-v1"},
111-
{MetaName: "*v1.StatefulSet-test-splunk-stack1-search-head"},
110+
//{MetaName: "*v1.StatefulSet-test-splunk-stack1-search-head"},
112111
{MetaName: "*v1.StatefulSet-test-splunk-stack1-deployer"},
113112
{MetaName: "*v1.StatefulSet-test-splunk-stack1-deployer"},
114113
{MetaName: "*v1.StatefulSet-test-splunk-stack1-search-head"},
@@ -135,8 +134,8 @@ func TestApplySearchHeadCluster(t *testing.T) {
135134
listmockCall := []spltest.MockFuncCall{
136135
{ListOpts: listOpts}}
137136

138-
createCalls := map[string][]spltest.MockFuncCall{"Get": funcCalls, "Create": {funcCalls[0], funcCalls[3], funcCalls[4], funcCalls[5], funcCalls[8], funcCalls[10], funcCalls[12], funcCalls[16], funcCalls[17]}, "Update": {funcCalls[0]}, "List": {listmockCall[0], listmockCall[0]}}
139-
updateCalls := map[string][]spltest.MockFuncCall{"Get": createFuncCalls, "Update": {createFuncCalls[5], createFuncCalls[9]}, "List": {listmockCall[0], listmockCall[0]}}
137+
createCalls := map[string][]spltest.MockFuncCall{"Get": funcCalls, "Create": {funcCalls[0], funcCalls[3], funcCalls[4], funcCalls[5], funcCalls[8], funcCalls[10], funcCalls[11], funcCalls[15], funcCalls[16]}, "Update": {funcCalls[0]}, "List": {listmockCall[0], listmockCall[0]}}
138+
updateCalls := map[string][]spltest.MockFuncCall{"Get": createFuncCalls, "Update": {createFuncCalls[5], createFuncCalls[11]}, "List": {listmockCall[0], listmockCall[0]}}
140139
statefulSet := enterpriseApi.SearchHeadCluster{
141140
TypeMeta: metav1.TypeMeta{
142141
Kind: "SearchHeadCluster",

0 commit comments

Comments
 (0)