Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,13 @@ resources:
kind: IngestorCluster
path: github.com/splunk/splunk-operator/api/v4
version: v4
- api:
crdVersion: v1
namespaced: true
controller: true
domain: splunk.com
group: enterprise
kind: BusConfiguration
path: github.com/splunk/splunk-operator/api/v4
version: v4
version: "3"
137 changes: 137 additions & 0 deletions api/v4/busconfiguration_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
Copyright 2025.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v4

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

const (
// BusConfigurationPausedAnnotation is the annotation that pauses the reconciliation (triggers
// an immediate requeue)
BusConfigurationPausedAnnotation = "busconfiguration.enterprise.splunk.com/paused"
)

// BusConfigurationSpec defines the desired state of BusConfiguration
type BusConfigurationSpec struct {
Type string `json:"type"`

SQS SQSSpec `json:"sqs"`
}

type SQSSpec struct {
QueueName string `json:"queueName"`

AuthRegion string `json:"authRegion"`

Endpoint string `json:"endpoint"`

LargeMessageStoreEndpoint string `json:"largeMessageStoreEndpoint"`

LargeMessageStorePath string `json:"largeMessageStorePath"`

DeadLetterQueueName string `json:"deadLetterQueueName"`
}

// BusConfigurationStatus defines the observed state of BusConfiguration.
type BusConfigurationStatus struct {
// Phase of the bus configuration
Phase Phase `json:"phase"`

// Resource revision tracker
ResourceRevMap map[string]string `json:"resourceRevMap"`

// Auxillary message describing CR status
Message string `json:"message"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// BusConfiguration is the Schema for a Splunk Enterprise bus configuration
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:resource:path=busconfigurations,scope=Namespaced,shortName=bus
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Status of bus configuration"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of bus configuration resource"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:storageversion

// BusConfiguration is the Schema for the busconfigurations API
type BusConfiguration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty,omitzero"`

Spec BusConfigurationSpec `json:"spec"`
Status BusConfigurationStatus `json:"status,omitempty,omitzero"`
}

// DeepCopyObject implements runtime.Object
func (in *BusConfiguration) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

// +kubebuilder:object:root=true

// BusConfigurationList contains a list of BusConfiguration
type BusConfigurationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BusConfiguration `json:"items"`
}

func init() {
SchemeBuilder.Register(&BusConfiguration{}, &BusConfigurationList{})
}

// NewEvent creates a new event associated with the object and ready
// to be published to Kubernetes API
func (bc *BusConfiguration) NewEvent(eventType, reason, message string) corev1.Event {
t := metav1.Now()
return corev1.Event{
ObjectMeta: metav1.ObjectMeta{
GenerateName: reason + "-",
Namespace: bc.ObjectMeta.Namespace,
},
InvolvedObject: corev1.ObjectReference{
Kind: "BusConfiguration",
Namespace: bc.Namespace,
Name: bc.Name,
UID: bc.UID,
APIVersion: GroupVersion.String(),
},
Reason: reason,
Message: message,
Source: corev1.EventSource{
Component: "splunk-busconfiguration-controller",
},
FirstTimestamp: t,
LastTimestamp: t,
Count: 1,
Type: eventType,
ReportingController: "enterprise.splunk.com/busconfiguration-controller",
}
}
14 changes: 5 additions & 9 deletions api/v4/indexercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ const (
type IndexerClusterSpec struct {
CommonSplunkSpec `json:",inline"`

PipelineConfig PipelineConfigSpec `json:"pipelineConfig,omitempty"`

PullBus PushBusSpec `json:"pullBus,omitempty"`
// Bus configuration reference
BusConfigurationRef corev1.ObjectReference `json:"busConfigurationRef,omitempty"`

// Number of search head pods; a search head cluster will be created if > 1
Replicas int32 `json:"replicas"`
Expand Down Expand Up @@ -113,14 +112,11 @@ type IndexerClusterStatus struct {
// status of each indexer cluster peer
Peers []IndexerClusterMemberStatus `json:"peers"`

// Pipeline configuration status
PipelineConfig PipelineConfigSpec `json:"pipelineConfig,omitempty"`

// Pull Bus status
PullBus PushBusSpec `json:"pullBus,omitempty"`

// Auxillary message describing CR status
Message string `json:"message"`

// Bus configuration
BusConfiguration BusConfigurationSpec `json:"busConfiguration,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
58 changes: 4 additions & 54 deletions api/v4/ingestorcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,55 +42,8 @@ type IngestorClusterSpec struct {
// Splunk Enterprise app repository that specifies remote app location and scope for Splunk app management
AppFrameworkConfig AppFrameworkSpec `json:"appRepo,omitempty"`

// Push Bus spec
PushBus PushBusSpec `json:"pushBus"`

// Pipeline configuration
PipelineConfig PipelineConfigSpec `json:"pipelineConfig"`
}

// Helper types
// Only SQS as of now
type PushBusSpec struct {
Type string `json:"type"`

SQS SQSSpec `json:"sqs"`
}

type SQSSpec struct {
QueueName string `json:"queueName"`

AuthRegion string `json:"authRegion"`

Endpoint string `json:"endpoint"`

LargeMessageStoreEndpoint string `json:"largeMessageStoreEndpoint"`

LargeMessageStorePath string `json:"largeMessageStorePath"`

DeadLetterQueueName string `json:"deadLetterQueueName"`

MaxRetriesPerPart int `json:"maxRetriesPerPart"`

RetryPolicy string `json:"retryPolicy"`

SendInterval string `json:"sendInterval"`

EncodingFormat string `json:"encodingFormat"`
}

type PipelineConfigSpec struct {
RemoteQueueRuleset bool `json:"remoteQueueRuleset"`

RuleSet bool `json:"ruleSet"`

RemoteQueueTyping bool `json:"remoteQueueTyping"`

RemoteQueueOutput bool `json:"remoteQueueOutput"`

Typing bool `json:"typing"`

IndexerPipe bool `json:"indexerPipe"`
// Bus configuration reference
BusConfigurationRef corev1.ObjectReference `json:"busConfigurationRef"`
}

// IngestorClusterStatus defines the observed state of Ingestor Cluster
Expand Down Expand Up @@ -119,11 +72,8 @@ type IngestorClusterStatus struct {
// Auxillary message describing CR status
Message string `json:"message"`

// Pipeline configuration status
PipelineConfig PipelineConfigSpec `json:"pipelineConfig"`

// Push Bus status
PushBus PushBusSpec `json:"pushBus"`
// Bus configuration
BusConfiguration BusConfigurationSpec `json:"busConfiguration,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Loading
Loading