Skip to content

Commit db02bfd

Browse files
committed
CSPL-4022 Fix update behaviour
1 parent 10a4fc0 commit db02bfd

File tree

11 files changed

+183
-145
lines changed

11 files changed

+183
-145
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ metadata:
66
namespace: {{ default .Release.Namespace .Values.busConfiguration.namespaceOverride }}
77
{{- with .Values.busConfiguration.additionalLabels }}
88
labels:
9-
{{ toYaml . | nindent 4 }}
9+
{{ toYaml . | nindent 4 }}
1010
{{- end }}
1111
{{- with .Values.busConfiguration.additionalAnnotations }}
1212
annotations:
13-
{{ toYaml . | nindent 4 }}
13+
{{ toYaml . | nindent 4 }}
1414
{{- end }}
1515
spec:
16-
type: {{ .type | quote }}
17-
{{- with .sqs }}
16+
type: {{ .Values.busConfiguration.type | quote }}
17+
{{- with .Values.busConfiguration.sqs }}
1818
sqs:
1919
{{- if .queueName }}
2020
queueName: {{ .queueName | quote }}
@@ -34,4 +34,5 @@ spec:
3434
{{- if .deadLetterQueueName }}
3535
deadLetterQueueName: {{ .deadLetterQueueName | quote }}
3636
{{- end }}
37+
{{- end }}
3738
{{- end }}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,12 @@ items:
163163
{{ toYaml . | indent 6 }}
164164
{{- end }}
165165
{{- end }}
166-
{{- if $.Values.indexerCluster.busConfigurationRef }}
167166
{{- with $.Values.indexerCluster.busConfigurationRef }}
168167
busConfigurationRef:
169-
name: {{ $.Values.indexerCluster.busConfigurationRef.name }}
170-
{{- if $.Values.indexerCluster.busConfigurationRef.namespace }}
171-
namespace: {{ $.Values.indexerCluster.busConfigurationRef.namespace }}
172-
{{- end }}
168+
name: {{ .name }}
169+
{{- if .namespace }}
170+
namespace: {{ .namespace }}
173171
{{- end }}
172+
{{- end }}
174173
{{- end }}
175174
{{- end }}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,11 @@ spec:
9595
topologySpreadConstraints:
9696
{{- toYaml . | nindent 4 }}
9797
{{- end }}
98-
{{- with $.Values.ingestorCluster.busConfigurationRef }}
99-
busConfigurationRef:
100-
name: {{ $.Values.ingestorCluster.busConfigurationRef.name }}
101-
{{- if $.Values.ingestorCluster.busConfigurationRef.namespace }}
102-
namespace: {{ $.Values.ingestorCluster.busConfigurationRef.namespace }}
103-
{{- end }}
98+
{{- with $.Values.ingestorCluster.busConfigurationRef }}
99+
busConfigurationRef:
100+
name: {{ $.Values.ingestorCluster.busConfigurationRef.name }}
101+
{{- if $.Values.ingestorCluster.busConfigurationRef.namespace }}
102+
namespace: {{ $.Values.ingestorCluster.busConfigurationRef.namespace }}
104103
{{- end }}
105104
{{- end }}
106105
{{- with .Values.ingestorCluster.extraEnv }}

internal/controller/indexercluster_controller.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
corev1 "k8s.io/api/core/v1"
3232
k8serrors "k8s.io/apimachinery/pkg/api/errors"
3333
"k8s.io/apimachinery/pkg/runtime"
34+
"k8s.io/apimachinery/pkg/types"
3435
ctrl "sigs.k8s.io/controller-runtime"
3536
"sigs.k8s.io/controller-runtime/pkg/client"
3637
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -171,6 +172,34 @@ func (r *IndexerClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
171172
mgr.GetRESTMapper(),
172173
&enterpriseApi.IndexerCluster{},
173174
)).
175+
Watches(&enterpriseApi.BusConfiguration{},
176+
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request {
177+
bc, ok := obj.(*enterpriseApi.BusConfiguration)
178+
if !ok {
179+
return nil
180+
}
181+
var list enterpriseApi.IndexerClusterList
182+
if err := r.Client.List(ctx, &list); err != nil {
183+
return nil
184+
}
185+
var reqs []reconcile.Request
186+
for _, ic := range list.Items {
187+
ns := ic.Spec.BusConfigurationRef.Namespace
188+
if ns == "" {
189+
ns = ic.Namespace
190+
}
191+
if ic.Spec.BusConfigurationRef.Name == bc.Name && ns == bc.Namespace {
192+
reqs = append(reqs, reconcile.Request{
193+
NamespacedName: types.NamespacedName{
194+
Name: ic.Name,
195+
Namespace: ic.Namespace,
196+
},
197+
})
198+
}
199+
}
200+
return reqs
201+
}),
202+
).
174203
WithOptions(controller.Options{
175204
MaxConcurrentReconciles: enterpriseApi.TotalWorker,
176205
}).

internal/controller/ingestorcluster_controller.go

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
corev1 "k8s.io/api/core/v1"
2525
k8serrors "k8s.io/apimachinery/pkg/api/errors"
2626
"k8s.io/apimachinery/pkg/runtime"
27+
"k8s.io/apimachinery/pkg/types"
2728
ctrl "sigs.k8s.io/controller-runtime"
2829
"sigs.k8s.io/controller-runtime/pkg/client"
2930
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -141,11 +142,33 @@ func (r *IngestorClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
141142
&enterpriseApi.IngestorCluster{},
142143
)).
143144
Watches(&enterpriseApi.BusConfiguration{},
144-
handler.EnqueueRequestForOwner(
145-
mgr.GetScheme(),
146-
mgr.GetRESTMapper(),
147-
&enterpriseApi.IngestorCluster{},
148-
)).
145+
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request {
146+
bc, ok := obj.(*enterpriseApi.BusConfiguration)
147+
if !ok {
148+
return nil
149+
}
150+
var list enterpriseApi.IngestorClusterList
151+
if err := r.Client.List(ctx, &list); err != nil {
152+
return nil
153+
}
154+
var reqs []reconcile.Request
155+
for _, ic := range list.Items {
156+
ns := ic.Spec.BusConfigurationRef.Namespace
157+
if ns == "" {
158+
ns = ic.Namespace
159+
}
160+
if ic.Spec.BusConfigurationRef.Name == bc.Name && ns == bc.Namespace {
161+
reqs = append(reqs, reconcile.Request{
162+
NamespacedName: types.NamespacedName{
163+
Name: ic.Name,
164+
Namespace: ic.Namespace,
165+
},
166+
})
167+
}
168+
}
169+
return reqs
170+
}),
171+
).
149172
WithOptions(controller.Options{
150173
MaxConcurrentReconciles: enterpriseApi.TotalWorker,
151174
}).

kuttl/tests/helm/index-and-ingest-separation/splunk_index_ingest_sep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ splunk-operator:
55
persistentVolumeClaim:
66
storageClassName: gp2
77

8-
busConfiguration::
8+
busConfiguration:
99
enabled: true
1010
name: bus-config
1111
type: sqs_smartbus

pkg/splunk/enterprise/indexercluster.go

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"context"
2020
"errors"
2121
"fmt"
22+
"reflect"
2223
"regexp"
2324
"sort"
2425
"strconv"
@@ -66,24 +67,8 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
6667
// Update the CR Status
6768
defer updateCRStatus(ctx, client, cr, &err)
6869

69-
// Bus config
70-
busConfig := enterpriseApi.BusConfiguration{}
71-
if cr.Spec.BusConfigurationRef.Name != "" {
72-
ns := cr.GetNamespace()
73-
if cr.Spec.BusConfigurationRef.Namespace != "" {
74-
ns = cr.Spec.BusConfigurationRef.Namespace
75-
}
76-
err = client.Get(context.Background(), types.NamespacedName{
77-
Name: cr.Spec.BusConfigurationRef.Name,
78-
Namespace: ns,
79-
}, &busConfig)
80-
if err != nil {
81-
return result, err
82-
}
83-
}
84-
8570
// validate and updates defaults for CR
86-
err = validateIndexerClusterSpec(ctx, client, cr, &busConfig)
71+
err = validateIndexerClusterSpec(ctx, client, cr)
8772
if err != nil {
8873
eventPublisher.Warning(ctx, "validateIndexerClusterSpec", fmt.Sprintf("validate indexercluster spec failed %s", err.Error()))
8974
scopedLog.Error(err, "Failed to validate indexercluster spec")
@@ -92,6 +77,9 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
9277

9378
// updates status after function completes
9479
cr.Status.ClusterManagerPhase = enterpriseApi.PhaseError
80+
if cr.Status.Replicas < cr.Spec.Replicas {
81+
cr.Status.BusConfiguration = enterpriseApi.BusConfigurationSpec{}
82+
}
9583
cr.Status.Replicas = cr.Spec.Replicas
9684
cr.Status.Selector = fmt.Sprintf("app.kubernetes.io/instance=splunk-%s-indexer", cr.GetName())
9785
if cr.Status.Peers == nil {
@@ -257,14 +245,36 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
257245

258246
// no need to requeue if everything is ready
259247
if cr.Status.Phase == enterpriseApi.PhaseReady {
248+
// Bus config
249+
busConfig := enterpriseApi.BusConfiguration{}
260250
if cr.Spec.BusConfigurationRef.Name != "" {
261-
err = mgr.handlePullBusChange(ctx, cr, busConfig, client)
251+
ns := cr.GetNamespace()
252+
if cr.Spec.BusConfigurationRef.Namespace != "" {
253+
ns = cr.Spec.BusConfigurationRef.Namespace
254+
}
255+
err = client.Get(context.Background(), types.NamespacedName{
256+
Name: cr.Spec.BusConfigurationRef.Name,
257+
Namespace: ns,
258+
}, &busConfig)
262259
if err != nil {
263-
scopedLog.Error(err, "Failed to update conf file for Bus/Pipeline config change after pod creation")
264260
return result, err
265261
}
266262
}
267-
cr.Status.BusConfiguration = busConfig.Spec
263+
264+
// If bus config is updated
265+
if cr.Spec.BusConfigurationRef.Name != "" {
266+
if !reflect.DeepEqual(cr.Status.BusConfiguration, busConfig.Spec) {
267+
mgr := newIndexerClusterPodManager(scopedLog, cr, namespaceScopedSecret, splclient.NewSplunkClient)
268+
269+
err = mgr.handlePullBusChange(ctx, cr, busConfig, client)
270+
if err != nil {
271+
scopedLog.Error(err, "Failed to update conf file for Bus/Pipeline config change after pod creation")
272+
return result, err
273+
}
274+
275+
cr.Status.BusConfiguration = busConfig.Spec
276+
}
277+
}
268278

269279
//update MC
270280
//Retrieve monitoring console ref from CM Spec
@@ -345,31 +355,18 @@ func ApplyIndexerCluster(ctx context.Context, client splcommon.ControllerClient,
345355
eventPublisher, _ := newK8EventPublisher(client, cr)
346356
cr.Kind = "IndexerCluster"
347357

348-
// Bus config
349-
busConfig := enterpriseApi.BusConfiguration{}
350-
if cr.Spec.BusConfigurationRef.Name != "" {
351-
ns := cr.GetNamespace()
352-
if cr.Spec.BusConfigurationRef.Namespace != "" {
353-
ns = cr.Spec.BusConfigurationRef.Namespace
354-
}
355-
err := client.Get(context.Background(), types.NamespacedName{
356-
Name: cr.Spec.BusConfigurationRef.Name,
357-
Namespace: ns,
358-
}, &busConfig)
359-
if err != nil {
360-
return result, err
361-
}
362-
}
363-
364358
// validate and updates defaults for CR
365-
err := validateIndexerClusterSpec(ctx, client, cr, &busConfig)
359+
err := validateIndexerClusterSpec(ctx, client, cr)
366360
if err != nil {
367361
return result, err
368362
}
369363

370364
// updates status after function completes
371365
cr.Status.Phase = enterpriseApi.PhaseError
372366
cr.Status.ClusterMasterPhase = enterpriseApi.PhaseError
367+
if cr.Status.Replicas < cr.Spec.Replicas {
368+
cr.Status.BusConfiguration = enterpriseApi.BusConfigurationSpec{}
369+
}
373370
cr.Status.Replicas = cr.Spec.Replicas
374371
cr.Status.Selector = fmt.Sprintf("app.kubernetes.io/instance=splunk-%s-indexer", cr.GetName())
375372
if cr.Status.Peers == nil {
@@ -538,29 +535,37 @@ func ApplyIndexerCluster(ctx context.Context, client splcommon.ControllerClient,
538535

539536
// no need to requeue if everything is ready
540537
if cr.Status.Phase == enterpriseApi.PhaseReady {
538+
// Bus config
539+
busConfig := enterpriseApi.BusConfiguration{}
541540
if cr.Spec.BusConfigurationRef.Name != "" {
542-
busConfig := enterpriseApi.BusConfiguration{}
543541
ns := cr.GetNamespace()
544542
if cr.Spec.BusConfigurationRef.Namespace != "" {
545543
ns = cr.Spec.BusConfigurationRef.Namespace
546544
}
547-
err := client.Get(context.Background(), types.NamespacedName{
545+
err = client.Get(context.Background(), types.NamespacedName{
548546
Name: cr.Spec.BusConfigurationRef.Name,
549547
Namespace: ns,
550548
}, &busConfig)
551549
if err != nil {
552550
return result, err
553551
}
552+
}
554553

555-
err = mgr.handlePullBusChange(ctx, cr, busConfig, client)
556-
if err != nil {
557-
scopedLog.Error(err, "Failed to update conf file for Bus/Pipeline config change after pod creation")
558-
return result, err
554+
// If bus config is updated
555+
if cr.Spec.BusConfigurationRef.Name != "" {
556+
if !reflect.DeepEqual(cr.Status.BusConfiguration, busConfig.Spec) {
557+
mgr := newIndexerClusterPodManager(scopedLog, cr, namespaceScopedSecret, splclient.NewSplunkClient)
558+
559+
err = mgr.handlePullBusChange(ctx, cr, busConfig, client)
560+
if err != nil {
561+
scopedLog.Error(err, "Failed to update conf file for Bus/Pipeline config change after pod creation")
562+
return result, err
563+
}
564+
565+
cr.Status.BusConfiguration = busConfig.Spec
559566
}
560567
}
561568

562-
cr.Status.BusConfiguration = busConfig.Spec
563-
564569
//update MC
565570
//Retrieve monitoring console ref from CM Spec
566571
cmMonitoringConsoleConfigRef, err := RetrieveCMSpec(ctx, client, cr)
@@ -1126,7 +1131,7 @@ func getIndexerStatefulSet(ctx context.Context, client splcommon.ControllerClien
11261131
}
11271132

11281133
// validateIndexerClusterSpec checks validity and makes default updates to a IndexerClusterSpec, and returns error if something is wrong.
1129-
func validateIndexerClusterSpec(ctx context.Context, c splcommon.ControllerClient, cr *enterpriseApi.IndexerCluster, busConfig *enterpriseApi.BusConfiguration) error {
1134+
func validateIndexerClusterSpec(ctx context.Context, c splcommon.ControllerClient, cr *enterpriseApi.IndexerCluster) error {
11301135
// We cannot have 0 replicas in IndexerCluster spec, since this refers to number of indexers in an indexer cluster
11311136
if cr.Spec.Replicas == 0 {
11321137
cr.Spec.Replicas = 1
@@ -1231,7 +1236,7 @@ func (mgr *indexerClusterPodManager) handlePullBusChange(ctx context.Context, ne
12311236
// Only update config for pods that exist
12321237
readyReplicas := newCR.Status.ReadyReplicas
12331238

1234-
// List all pods for this IngestorCluster StatefulSet
1239+
// List all pods for this IndexerCluster StatefulSet
12351240
var updateErr error
12361241
for n := 0; n < int(readyReplicas); n++ {
12371242
memberName := GetSplunkStatefulsetPodName(SplunkIndexer, newCR.GetName(), int32(n))
@@ -1245,10 +1250,10 @@ func (mgr *indexerClusterPodManager) handlePullBusChange(ctx context.Context, ne
12451250
afterDelete := false
12461251
if (busConfig.Spec.SQS.QueueName != "" && newCR.Status.BusConfiguration.SQS.QueueName != "" && busConfig.Spec.SQS.QueueName != newCR.Status.BusConfiguration.SQS.QueueName) ||
12471252
(busConfig.Spec.Type != "" && newCR.Status.BusConfiguration.Type != "" && busConfig.Spec.Type != newCR.Status.BusConfiguration.Type) {
1248-
if err := splunkClient.DeleteConfFileProperty("outputs", fmt.Sprintf("remote_queue:%s", busConfig.Spec.SQS.QueueName)); err != nil {
1253+
if err := splunkClient.DeleteConfFileProperty("outputs", fmt.Sprintf("remote_queue:%s", newCR.Status.BusConfiguration.SQS.QueueName)); err != nil {
12491254
updateErr = err
12501255
}
1251-
if err := splunkClient.DeleteConfFileProperty("inputs", fmt.Sprintf("remote_queue:%s", busConfig.Spec.SQS.QueueName)); err != nil {
1256+
if err := splunkClient.DeleteConfFileProperty("inputs", fmt.Sprintf("remote_queue:%s", newCR.Status.BusConfiguration.SQS.QueueName)); err != nil {
12521257
updateErr = err
12531258
}
12541259
afterDelete = true

pkg/splunk/enterprise/indexercluster_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ func TestGetIndexerStatefulSet(t *testing.T) {
13881388
cr.Spec.ClusterManagerRef.Name = "manager1"
13891389
test := func(want string) {
13901390
f := func() (interface{}, error) {
1391-
if err := validateIndexerClusterSpec(ctx, c, &cr, &busConfig); err != nil {
1391+
if err := validateIndexerClusterSpec(ctx, c, &cr); err != nil {
13921392
t.Errorf("validateIndexerClusterSpec() returned error: %v", err)
13931393
}
13941394
return getIndexerStatefulSet(ctx, c, &cr)
@@ -1434,7 +1434,7 @@ func TestGetIndexerStatefulSet(t *testing.T) {
14341434
test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer","app.kubernetes.io/test-extra-label":"test-extra-label-value"},"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer","app.kubernetes.io/test-extra-label":"test-extra-label-value"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"user-defined","containerPort":32000,"protocol":"UDP"}],"env":[{"name":"TEST_ENV_VAR","value":"test_value"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_GENERAL_TERMS","value":"--accept-sgt-current-at-splunk-com"},{"name":"SPLUNK_SKIP_CLUSTER_BUNDLE_PUSH","value":"true"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent","securityContext":{"capabilities":{"add":["NET_BIND_SERVICE"],"drop":["ALL"]},"privileged":false,"runAsUser":41812,"runAsNonRoot":true,"allowPrivilegeEscalation":false,"seccompProfile":{"type":"RuntimeDefault"}}}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy":"OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer","app.kubernetes.io/test-extra-label":"test-extra-label-value"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer","app.kubernetes.io/test-extra-label":"test-extra-label-value"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}`)
14351435

14361436
cr.Spec.ClusterManagerRef.Namespace = "other"
1437-
if err := validateIndexerClusterSpec(ctx, c, &cr, &busConfig); err == nil {
1437+
if err := validateIndexerClusterSpec(ctx, c, &cr); err == nil {
14381438
t.Errorf("validateIndexerClusterSpec() error expected on multisite IndexerCluster referencing a cluster manager located in a different namespace")
14391439
}
14401440
}

0 commit comments

Comments
 (0)