Skip to content

Commit 6f08c09

Browse files
committed
Addressing PR comments
1 parent e32487f commit 6f08c09

8 files changed

Lines changed: 88 additions & 27 deletions

File tree

api/v4/ingestorcluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type IngestorClusterSpec struct {
3636
CommonSplunkSpec `json:",inline"`
3737

3838
// Number of ingestor pods
39-
// +kubebuilder:validation:Minimum=3
40-
// +kubebuilder:default=3
39+
// +kubebuilder:validation:Minimum=1
40+
// +kubebuilder:default=1
4141
Replicas int32 `json:"replicas"`
4242

4343
// Splunk Enterprise app repository that specifies remote app location and scope for Splunk app management

api/v4/objectstorage_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ type ObjectStorageStatus struct {
7272
// ObjectStorage is the Schema for a Splunk Enterprise object storage
7373
// +k8s:openapi-gen=true
7474
// +kubebuilder:subresource:status
75-
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
7675
// +kubebuilder:resource:path=objectstorages,scope=Namespaced,shortName=os
7776
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Status of object storage"
7877
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of object storage resource"

api/v4/queue_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ type QueueStatus struct {
8989
// Queue is the Schema for a Splunk Enterprise queue
9090
// +k8s:openapi-gen=true
9191
// +kubebuilder:subresource:status
92-
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
9392
// +kubebuilder:resource:path=queues,scope=Namespaced,shortName=queue
9493
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Status of queue"
9594
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of queue resource"

docs/IndexIngestionSeparation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ spec:
6767

6868
# ObjectStorage
6969

70-
ObjectStorage is introduced to store large message (messages that exceed the size of messages that can be stored in SQS) store information to be shared among IngestorCluster and IndexerCluster.
70+
ObjectStorage is introduced to store large messages (messages that exceed the size of messages that can be stored in SQS) to be shared among IngestorCluster and IndexerCluster.
7171

7272
## Spec
7373

@@ -269,7 +269,7 @@ To be able to configure ingestion and indexing resources correctly in a secure m
269269

270270
## Example
271271

272-
The example presented below configures the ingestor-sa service account by using esctl utility. It sets up the service account for cluster-name cluster in region us-west-2 with AmazonS3FullAccess and AmazonSQSFullAccess access policies.
272+
The example presented below configures the ingestor-sa service account by using eksctl utility. It sets up the service account for cluster-name cluster in region us-west-2 with AmazonS3FullAccess and AmazonSQSFullAccess access policies.
273273

274274
```
275275
eksctl create iamserviceaccount \
@@ -452,7 +452,7 @@ Application installation is supported for Ingestor Cluster instances. However, a
452452

453453
Therefore, to be able to enforce Splunk restart for each of the Ingestor Cluster pods, it is recommended to add/update IngestorCluster CR annotations/labels and apply the new configuration which will trigger the rolling restart of Splunk pods for Ingestor Cluster.
454454

455-
We are under the investigation on how to make it fully automated. What is more, ideally, update of annotations and labels should not trigger pod restart at all and we are investigating on how to fix this behaviour eventually.
455+
Ideally, update of annotations and labels should not trigger pod restart at all and it is under the investigation on how to stop this from happening and handle restart automatically.
456456

457457
# Example
458458

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ require (
77
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0
88
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
99
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1
10-
github.com/aws/aws-sdk-go-v2 v1.36.6
10+
github.com/aws/aws-sdk-go-v2 v1.41.1
1111
github.com/aws/aws-sdk-go-v2/config v1.29.18
1212
github.com/aws/aws-sdk-go-v2/credentials v1.17.71
1313
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.85
1414
github.com/aws/aws-sdk-go-v2/service/s3 v1.84.1
15+
github.com/aws/aws-sdk-go-v2/service/sqs v1.42.21
1516
github.com/go-logr/logr v1.4.3
1617
github.com/google/go-cmp v0.7.0
1718
github.com/google/uuid v1.6.0
@@ -45,8 +46,8 @@ require (
4546
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
4647
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 // indirect
4748
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33 // indirect
48-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.37 // indirect
49-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.37 // indirect
49+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
50+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
5051
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
5152
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.37 // indirect
5253
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.4 // indirect
@@ -56,7 +57,7 @@ require (
5657
github.com/aws/aws-sdk-go-v2/service/sso v1.25.6 // indirect
5758
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.4 // indirect
5859
github.com/aws/aws-sdk-go-v2/service/sts v1.34.1 // indirect
59-
github.com/aws/smithy-go v1.22.4 // indirect
60+
github.com/aws/smithy-go v1.24.0 // indirect
6061
github.com/bahlo/generic-list-go v0.2.0 // indirect
6162
github.com/beorn7/perks v1.0.1 // indirect
6263
github.com/blang/semver/v4 v4.0.0 // indirect

go.sum

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8
2828
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
2929
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
3030
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
31-
github.com/aws/aws-sdk-go-v2 v1.36.6 h1:zJqGjVbRdTPojeCGWn5IR5pbJwSQSBh5RWFTQcEQGdU=
32-
github.com/aws/aws-sdk-go-v2 v1.36.6/go.mod h1:EYrzvCCN9CMUTa5+6lf6MM4tq3Zjp8UhSGR/cBsjai0=
31+
github.com/aws/aws-sdk-go-v2 v1.41.1 h1:ABlyEARCDLN034NhxlRUSZr4l71mh+T5KAeGh6cerhU=
32+
github.com/aws/aws-sdk-go-v2 v1.41.1/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0=
3333
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 h1:12SpdwU8Djs+YGklkinSSlcrPyj3H4VifVsKf78KbwA=
3434
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11/go.mod h1:dd+Lkp6YmMryke+qxW/VnKyhMBDTYP41Q2Bb+6gNZgY=
3535
github.com/aws/aws-sdk-go-v2/config v1.29.18 h1:x4T1GRPnqKV8HMJOMtNktbpQMl3bIsfx8KbqmveUO2I=
@@ -40,10 +40,10 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33 h1:D9ixiWSG4lyUBL2DDNK924
4040
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33/go.mod h1:caS/m4DI+cij2paz3rtProRBI4s/+TCiWoaWZuQ9010=
4141
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.85 h1:AfpstoiaenxGSCUheWiicgZE5XXS5Fi4CcQ4PA/x+Qw=
4242
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.85/go.mod h1:HxiF0Fd6WHWjdjOffLkCauq7JqzWqMMq0iUVLS7cPQc=
43-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.37 h1:osMWfm/sC/L4tvEdQ65Gri5ZZDCUpuYJZbTTDrsn4I0=
44-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.37/go.mod h1:ZV2/1fbjOPr4G4v38G3Ww5TBT4+hmsK45s/rxu1fGy0=
45-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.37 h1:v+X21AvTb2wZ+ycg1gx+orkB/9U6L7AOp93R7qYxsxM=
46-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.37/go.mod h1:G0uM1kyssELxmJ2VZEfG0q2npObR3BAkF3c1VsfVnfs=
43+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 h1:xOLELNKGp2vsiteLsvLPwxC+mYmO6OZ8PYgiuPJzF8U=
44+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17/go.mod h1:5M5CI3D12dNOtH3/mk6minaRwI2/37ifCURZISxA/IQ=
45+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 h1:WWLqlh79iO48yLkj1v3ISRNiv+3KdQoZ6JWyfcsyQik=
46+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17/go.mod h1:EhG22vHRrvF8oXSTYStZhJc1aUgKtnJe+aOiFEV90cM=
4747
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo=
4848
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
4949
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.37 h1:XTZZ0I3SZUHAtBLBU6395ad+VOblE0DwQP6MuaNeics=
@@ -58,14 +58,16 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.18 h1:OS2e0SKqsU2Li
5858
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.18/go.mod h1:+Yrk+MDGzlNGxCXieljNeWpoZTCQUQVL+Jk9hGGJ8qM=
5959
github.com/aws/aws-sdk-go-v2/service/s3 v1.84.1 h1:RkHXU9jP0DptGy7qKI8CBGsUJruWz0v5IgwBa2DwWcU=
6060
github.com/aws/aws-sdk-go-v2/service/s3 v1.84.1/go.mod h1:3xAOf7tdKF+qbb+XpU+EPhNXAdun3Lu1RcDrj8KC24I=
61+
github.com/aws/aws-sdk-go-v2/service/sqs v1.42.21 h1:Oa0IhwDLVrcBHDlNo1aosG4CxO4HyvzDV5xUWqWcBc0=
62+
github.com/aws/aws-sdk-go-v2/service/sqs v1.42.21/go.mod h1:t98Ssq+qtXKXl2SFtaSkuT6X42FSM//fnO6sfq5RqGM=
6163
github.com/aws/aws-sdk-go-v2/service/sso v1.25.6 h1:rGtWqkQbPk7Bkwuv3NzpE/scwwL9sC1Ul3tn9x83DUI=
6264
github.com/aws/aws-sdk-go-v2/service/sso v1.25.6/go.mod h1:u4ku9OLv4TO4bCPdxf4fA1upaMaJmP9ZijGk3AAOC6Q=
6365
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.4 h1:OV/pxyXh+eMA0TExHEC4jyWdumLxNbzz1P0zJoezkJc=
6466
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.4/go.mod h1:8Mm5VGYwtm+r305FfPSuc+aFkrypeylGYhFim6XEPoc=
6567
github.com/aws/aws-sdk-go-v2/service/sts v1.34.1 h1:aUrLQwJfZtwv3/ZNG2xRtEen+NqI3iesuacjP51Mv1s=
6668
github.com/aws/aws-sdk-go-v2/service/sts v1.34.1/go.mod h1:3wFBZKoWnX3r+Sm7in79i54fBmNfwhdNdQuscCw7QIk=
67-
github.com/aws/smithy-go v1.22.4 h1:uqXzVZNuNexwc/xrh6Tb56u89WDlJY6HS+KC0S4QSjw=
68-
github.com/aws/smithy-go v1.22.4/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
69+
github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk=
70+
github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
6971
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
7072
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
7173
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=

pkg/splunk/enterprise/indexercluster.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
262262
}
263263
if queue.Spec.Provider == "sqs" {
264264
if queue.Spec.SQS.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
265-
queue.Spec.SQS.Endpoint = fmt.Sprintf("https://sqs.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
265+
ep, err := resolveSQSEndpoint(ctx, queue.Spec.SQS.AuthRegion)
266+
if err != nil {
267+
return result, err
268+
}
269+
queue.Spec.SQS.Endpoint = ep
266270
}
267271
}
268272

@@ -283,7 +287,11 @@ func ApplyIndexerClusterManager(ctx context.Context, client splcommon.Controller
283287
}
284288
if os.Spec.Provider == "s3" {
285289
if os.Spec.S3.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
286-
os.Spec.S3.Endpoint = fmt.Sprintf("https://s3.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
290+
ep, err := resolveS3Endpoint(ctx, queue.Spec.SQS.AuthRegion)
291+
if err != nil {
292+
return result, err
293+
}
294+
os.Spec.S3.Endpoint = ep
287295
}
288296
}
289297

@@ -607,7 +615,11 @@ func ApplyIndexerCluster(ctx context.Context, client splcommon.ControllerClient,
607615
}
608616
if queue.Spec.Provider == "sqs" {
609617
if queue.Spec.SQS.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
610-
queue.Spec.SQS.Endpoint = fmt.Sprintf("https://sqs.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
618+
ep, err := resolveSQSEndpoint(ctx, queue.Spec.SQS.AuthRegion)
619+
if err != nil {
620+
return result, err
621+
}
622+
queue.Spec.SQS.Endpoint = ep
611623
}
612624
}
613625

@@ -628,7 +640,11 @@ func ApplyIndexerCluster(ctx context.Context, client splcommon.ControllerClient,
628640
}
629641
if os.Spec.Provider == "s3" {
630642
if os.Spec.S3.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
631-
os.Spec.S3.Endpoint = fmt.Sprintf("https://s3.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
643+
ep, err := resolveS3Endpoint(ctx, queue.Spec.SQS.AuthRegion)
644+
if err != nil {
645+
return result, err
646+
}
647+
os.Spec.S3.Endpoint = ep
632648
}
633649
}
634650

pkg/splunk/enterprise/ingestorcluster.go

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import (
2323
"strings"
2424
"time"
2525

26+
"github.com/aws/aws-sdk-go-v2/config"
27+
"github.com/aws/aws-sdk-go-v2/service/s3"
28+
"github.com/aws/aws-sdk-go-v2/service/sqs"
2629
"github.com/go-logr/logr"
2730
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2831
splclient "github.com/splunk/splunk-operator/pkg/splunk/client"
@@ -228,7 +231,11 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
228231
}
229232
if queue.Spec.Provider == "sqs" {
230233
if queue.Spec.SQS.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
231-
queue.Spec.SQS.Endpoint = fmt.Sprintf("https://sqs.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
234+
ep, err := resolveSQSEndpoint(ctx, queue.Spec.SQS.AuthRegion)
235+
if err != nil {
236+
return result, err
237+
}
238+
queue.Spec.SQS.Endpoint = ep
232239
}
233240
}
234241

@@ -249,7 +256,11 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
249256
}
250257
if os.Spec.Provider == "s3" {
251258
if os.Spec.S3.Endpoint == "" && queue.Spec.SQS.AuthRegion != "" {
252-
os.Spec.S3.Endpoint = fmt.Sprintf("https://s3.%s.amazonaws.com", queue.Spec.SQS.AuthRegion)
259+
ep, err := resolveS3Endpoint(ctx, queue.Spec.SQS.AuthRegion)
260+
if err != nil {
261+
return result, err
262+
}
263+
os.Spec.S3.Endpoint = ep
253264
}
254265
}
255266

@@ -357,8 +368,8 @@ func (mgr *ingestorClusterPodManager) getClient(ctx context.Context, n int32) *s
357368
// validateIngestorClusterSpec checks validity and makes default updates to a IngestorClusterSpec and returns error if something is wrong
358369
func validateIngestorClusterSpec(ctx context.Context, c splcommon.ControllerClient, cr *enterpriseApi.IngestorCluster) error {
359370
// We cannot have 0 replicas in IngestorCluster spec since this refers to number of ingestion pods in the ingestor cluster
360-
if cr.Spec.Replicas < 3 {
361-
cr.Spec.Replicas = 3
371+
if cr.Spec.Replicas < 1 {
372+
cr.Spec.Replicas = 1
362373
}
363374

364375
if !reflect.DeepEqual(cr.Status.AppContext.AppFrameworkConfig, cr.Spec.AppFrameworkConfig) {
@@ -512,3 +523,36 @@ func getQueueAndObjectStorageInputsForIngestorConfFiles(queue *enterpriseApi.Que
512523

513524
return
514525
}
526+
527+
func resolveS3Endpoint(ctx context.Context, region string) (string, error) {
528+
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
529+
if err != nil {
530+
return "", err
531+
}
532+
533+
client := s3.NewFromConfig(cfg)
534+
params := s3.EndpointParameters{Region: &region}
535+
536+
ep, err := client.Options().EndpointResolverV2.ResolveEndpoint(ctx, params)
537+
if err != nil {
538+
return "", err
539+
}
540+
// Full endpoint URL as string:
541+
return ep.URI.String(), nil
542+
}
543+
544+
func resolveSQSEndpoint(ctx context.Context, region string) (string, error) {
545+
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
546+
if err != nil {
547+
return "", err
548+
}
549+
550+
client := sqs.NewFromConfig(cfg)
551+
params := sqs.EndpointParameters{Region: &region}
552+
553+
ep, err := client.Options().EndpointResolverV2.ResolveEndpoint(ctx, params)
554+
if err != nil {
555+
return "", err
556+
}
557+
return ep.URI.String(), nil
558+
}

0 commit comments

Comments
 (0)