Skip to content
Open
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
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OPERATOR_SDK_VERSION=v1.39.0
REVIEWERS=vivekr-splunk,rlieberman-splunk,patrykw-splunk,Igor-splunk,kasiakoziol,kubabuczak
OPERATOR_SDK_VERSION=v1.42.0
REVIEWERS=vivekr-splunk,rlieberman-splunk,patrykw-splunk,Igor-splunk,kasiakoziol,kubabuczak,gabrielm-splunk,minjieqiu,qingw-splunk
GO_VERSION=1.25.5
AWSCLI_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.8.6.zip
KUBECTL_VERSION=v1.29.1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/int-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- develop
- main
- feature**
- CSPL-3964_Upgrade-operator-sdk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to remove this line before merging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will approve once this is removed. Looks good otherwise!

jobs:
build-operator-image:
runs-on: ubuntu-latest
Expand Down
116 changes: 116 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
version: "2"
run:
allow-parallel-runners: true
timeout: 10m
linters:
default: none
enable:
- copyloopvar
- ginkgolinter
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- unconvert
- unused
settings:
gocyclo:
min-complexity: 50
goconst:
min-len: 3
min-occurrences: 10
exclusions:
generated: lax
rules:
- linters:
- goconst
path: _test\.go$
- linters:
- gocyclo
path: _test\.go$
- linters:
- unparam
path: _test\.go$
- linters:
- prealloc
path: _test\.go$
- linters:
- ineffassign
path: _test\.go$
- linters:
- ginkgolinter
path: _test\.go$
- linters:
- misspell
path: _test\.go$
- linters:
- unconvert
path: _test\.go$
- linters:
- goconst
- gocyclo
- unparam
- prealloc
- ineffassign
- unused
- ginkgolinter
- staticcheck
- misspell
- unconvert
path: test/
# Exclude ST1019 (duplicate imports) - project uses aliased imports intentionally
- linters:
- staticcheck
text: "ST1019"
# Exclude SA4022 (address of variable cannot be nil) - false positive for spec checks
- linters:
- staticcheck
text: "SA4022"
# Exclude ST1023 (should omit type from declaration) - style preference
- linters:
- staticcheck
text: "ST1023"
# Exclude QF1001/QF1003/QF1008/QF1011 - quickfix suggestions, not errors
- linters:
- staticcheck
text: "QF100"
- linters:
- staticcheck
text: "QF1011"
# Exclude S1021 (should merge variable declaration) - style preference
- linters:
- staticcheck
text: "S1021"
# Exclude ST1005 (error strings should not be capitalized) - existing codebase style
- linters:
- staticcheck
text: "ST1005"
# Exclude SA1019 (deprecated) - will be addressed separately
- linters:
- staticcheck
text: "SA1019"
# Exclude SA4006 (value never used) in test files
- linters:
- staticcheck
text: "SA4006"
path: _test\.go$
# Exclude SA1029 (context key type) in test files
- linters:
- staticcheck
text: "SA1029"
path: _test\.go$
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
47 changes: 44 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ BUNDLE_IMG ?= ${IMAGE_TAG_BASE}-bundle:v${VERSION}
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.34.0
# Automatically derive the version from go.mod
ENVTEST_VERSION := $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
ENVTEST_K8S_VERSION := $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')

ignore-not-found ?= True

Expand Down Expand Up @@ -135,7 +137,7 @@ scheck: ## Run static check against code
vet: setup/ginkgo ## Run go vet against code.
go vet ./...

test: manifests generate fmt vet envtest ## Run tests.
test: manifests generate fmt vet setup-envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use ${ENVTEST_K8S_VERSION} --bin-dir $(LOCALBIN) -p path)" ginkgo --junit-report=unit_test.xml --output-dir=`pwd` -vv --trace --keep-going --timeout=3h --cover --covermode=count --coverprofile=coverage.out ./pkg/splunk/common ./pkg/splunk/enterprise ./pkg/splunk/client ./pkg/splunk/util ./internal/controller ./pkg/splunk/splkcontroller


Expand Down Expand Up @@ -224,6 +226,7 @@ $(LOCALBIN):
## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.18.0
GOLANGCI_LINT_VERSION ?= v2.1.0

CONTROLLER_GEN = $(LOCALBIN)/controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
Expand All @@ -241,6 +244,44 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

.PHONY: setup-envtest
setup-envtest: envtest ## Set up ENVTEST binaries for the correct version
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
echo "Error setting up envtest"; exit 1; }

GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

# go-install-tool will 'go install' any package with custom target and target binary name
# $1 - target path with name of binary
# $2 - package url which can be installed
# $3 - specific version of package
define go-install-tool
@[ -f "$(1)-$(3)" ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
rm -f $(1) || true ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv $(1) $(1)-$(3) ;\
} ;\
ln -sf $(1)-$(3) $(1)
endef

## Generate bundle manifests and metadata, then validate generated files.
## In addition, copy the newly generated crd files to helm crds.
.PHONY: bundle
Expand Down Expand Up @@ -272,7 +313,7 @@ ifeq (,$(shell which opm 2>/dev/null))
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.24.2/$${OS}-$${ARCH}-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.55.0/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
Expand Down
4 changes: 2 additions & 2 deletions api/v4/clustermanager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type ClusterManagerStatus struct {
// Telemetry App installation flag
TelAppInstalled bool `json:"telAppInstalled"`

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

Expand All @@ -90,7 +90,7 @@ type BundlePushInfo struct {
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.replicas",description="Desired number of indexer peers"
// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Current number of ready indexer peers"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of cluster manager"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type ClusterManager struct {
metav1.TypeMeta `json:",inline"`
Expand Down
8 changes: 4 additions & 4 deletions api/v4/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const (
// PhaseTerminating means a custom resource is in the process of being removed
PhaseTerminating Phase = "Terminating"

// PhaseError means an error occured with custom resource management
// PhaseError means an error occurred with custom resource management
PhaseError Phase = "Error"
)

Expand Down Expand Up @@ -318,7 +318,7 @@ type VolumeSpec struct {
Region string `json:"region"`
}

// VolumeAndTypeSpec used to add any custom varaibles for volume implementation
// VolumeAndTypeSpec used to add any custom variables for volume implementation
type VolumeAndTypeSpec struct {
VolumeSpec `json:",inline"`
}
Expand Down Expand Up @@ -375,7 +375,7 @@ type AppSourceDefaultSpec struct {

// PremiumAppsProps represents properties for premium apps such as ES
type PremiumAppsProps struct {
// Type: enterpriseSecurity for now, can accomodate itsi etc.. later
// Type: enterpriseSecurity for now, can accommodate itsi etc.. later
// +optional
Type string `json:"type,omitempty"`

Expand Down Expand Up @@ -483,7 +483,7 @@ type AppSrcDeployInfo struct {
type BundlePushStageType int

const (
// BundlePushUninitialized indicates bundle push never happend
// BundlePushUninitialized indicates bundle push never happened
BundlePushUninitialized BundlePushStageType = iota
// BundlePushPending waiting for all the apps to be copied to the Pod
BundlePushPending
Expand Down
4 changes: 2 additions & 2 deletions api/v4/indexercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type IndexerClusterStatus struct {
// status of each indexer cluster peer
Peers []IndexerClusterMemberStatus `json:"peers"`

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

Expand All @@ -126,7 +126,7 @@ type IndexerClusterStatus struct {
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.replicas",description="Desired number of indexer peers"
// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Current number of ready indexer peers"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of indexer cluster"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type IndexerCluster struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions api/v4/licensemanager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type LicenseManagerStatus struct {
// Telemetry App installation flag
TelAppInstalled bool `json:"telAppInstalled"`

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

Expand All @@ -65,7 +65,7 @@ type LicenseManagerStatus struct {
// +kubebuilder:resource:path=licensemanagers,scope=Namespaced,shortName=lmanager
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Status of license manager"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of license manager"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type LicenseManager struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions api/v4/monitoringconsole_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type MonitoringConsoleStatus struct {
// App Framework status
AppContext AppDeploymentContext `json:"appContext,omitempty"`

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

Expand All @@ -73,7 +73,7 @@ type MonitoringConsoleStatus struct {
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.replicas",description="Desired number of monitoring console members"
// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Current number of ready monitoring console members"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of monitoring console"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type MonitoringConsole struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions api/v4/searchheadcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type SearchHeadClusterStatus struct {
// Telemetry App installation flag
TelAppInstalled bool `json:"telAppInstalled"`

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

UpgradePhase UpgradePhase `json:"upgradePhase"`
Expand Down Expand Up @@ -154,7 +154,7 @@ const (
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.replicas",description="Desired number of search head cluster members"
// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Current number of ready search head cluster members"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of search head cluster"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type SearchHeadCluster struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions api/v4/standalone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type StandaloneStatus struct {
// Telemetry App installation flag
TelAppInstalled bool `json:"telAppInstalled"`

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

Expand All @@ -89,7 +89,7 @@ type StandaloneStatus struct {
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.replicas",description="Number of desired standalone instances"
// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Current number of ready standalone instances"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of standalone resource"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxillary message describing CR status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status"
// +kubebuilder:storageversion
type Standalone struct {
metav1.TypeMeta `json:",inline"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
creationTimestamp: null
labels:
name: splunk-operator
app.kubernetes.io/name: splunk-operator
name: clustermanagers.enterprise.splunk.com
spec:
group: enterprise.splunk.com
Expand Down
1 change: 1 addition & 0 deletions bundle/manifests/enterprise.splunk.com_clustermasters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
creationTimestamp: null
labels:
name: splunk-operator
app.kubernetes.io/name: splunk-operator
name: clustermasters.enterprise.splunk.com
spec:
group: enterprise.splunk.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
creationTimestamp: null
labels:
name: splunk-operator
app.kubernetes.io/name: splunk-operator
name: indexerclusters.enterprise.splunk.com
spec:
group: enterprise.splunk.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
creationTimestamp: null
labels:
name: splunk-operator
app.kubernetes.io/name: splunk-operator
name: licensemanagers.enterprise.splunk.com
spec:
group: enterprise.splunk.com
Expand Down
1 change: 1 addition & 0 deletions bundle/manifests/enterprise.splunk.com_licensemasters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
creationTimestamp: null
labels:
name: splunk-operator
app.kubernetes.io/name: splunk-operator
name: licensemasters.enterprise.splunk.com
spec:
group: enterprise.splunk.com
Expand Down
Loading
Loading