Skip to content

Conversation

Igor-splunk
Copy link
Collaborator

@Igor-splunk Igor-splunk commented Apr 14, 2025

v1.33 migration
v1.34 migration
v1.36 migration
v1.38 migration
v1.39 migration

Changes related to the OperatorSDK upgrade:

  • Perform upgrade from OperatorSDK v1.31.0 to v1.39
  • Adjust Operator structure (folders, file names etc)
  • Update Golang version from 1.23.0 to 1.24.2
  • Reimplement deprecated functionspredicate.GenerationChangedPredicate{} and predicate.AnnotationChangedPredicate{}, for predicate

Other changes

  • Fix SPLUNK_ENTERPRISE_IMAGE var value
  • Fix tests' stability

@coveralls
Copy link
Collaborator

coveralls commented Apr 14, 2025

Pull Request Test Coverage Report for Build 15969470039

Details

  • 238 of 242 (98.35%) changed or added relevant lines in 13 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.07%) to 86.711%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/splunk/enterprise/upgrade.go 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/splunk/enterprise/afwscheduler.go 1 92.96%
Totals Coverage Status
Change from base Build 15887396749: 0.07%
Covered Lines: 10629
Relevant Lines: 12258

💛 - Coveralls

@Igor-splunk Igor-splunk changed the title Draft:CSPL-3675 Draft:CSPL-3675 Update Operator-SDK to v1.39 Apr 15, 2025
igor.grzankowski added 2 commits April 16, 2025 14:31
cmd/main.go Outdated
@@ -123,56 +125,56 @@ func main() {
os.Exit(1)
}

if err = (&controllers.ClusterMasterReconciler{
if err = (&controller2.ClusterMasterReconciler{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change this to splunk-controller instead.

err = ctrl.Watch(
source.Kind(mgr.GetCache(), instance, &handler.TypedEnqueueRequestForObject[splcommon.MetaObject]{}),
)
//err = ctrl.Watch(&source.Kind{Type: instance}, &handler.EnqueueRequestForObject{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove commented line if not needed.

@@ -5,6 +5,7 @@ on:
- develop
- main
- feature**
- CSPL-3675-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.

Please remember to remove it once verified.

handler.EnqueueRequestForOwner(
mgr.GetScheme(),
mgr.GetRESTMapper(),
&appsv1.StatefulSet{},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we include handler.OnlyControllerOwner() here and below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This one im not sure about 100% @vivekr-splunk Could You take a look?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed for now but if we want to split the operator in the future we should probably take a look at that

return !e.DeleteStateUnknown
},
}
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can directly return without declaring a var err, Same below.

if !stringInSlice(newObj.Name, []string{"clustermasters.enterprise.splunk.com",
// Process only specific CRD names
if !stringInSlice(newObj.Name, []string{
"clustermasters.enterprise.splunk.com",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about clustermanagers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't there before, should it even be there? @vivekr-splunk

@Igor-splunk Igor-splunk changed the title Draft:CSPL-3675 Update Operator-SDK to v1.39 CSPL-3675 Update Operator-SDK to v1.39 Jun 17, 2025
Copy link
Collaborator

@kasiakoziol kasiakoziol left a comment

Choose a reason for hiding this comment

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

Please remove branch from integ tests pipeline on merge

@kasiakoziol kasiakoziol force-pushed the CSPL-3675-operator-sdk branch from 2a20504 to aabe029 Compare June 25, 2025 09:16
@kasiakoziol kasiakoziol force-pushed the CSPL-3675-operator-sdk branch from e813abe to 6547244 Compare June 26, 2025 14:20
@kasiakoziol kasiakoziol requested a review from Copilot June 27, 2025 10:55
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the Operator SDK to v1.39 and updates related APIs, generated code, and CRDs to match new SDK requirements.

  • Update RESTClientForGVK calls to include an http.Client parameter
  • Replace deprecated MetricsBindAddress with the new server.Options API
  • Switch from ResourceRequirements to VolumeResourceRequirements for PVCs (requires verification)
  • Rename the controller package imports to splkcontroller across code and tests
  • Bump go.mod and regenerate CRDs with x-kubernetes-list-type: atomic and additional fields

Reviewed Changes

Copilot reviewed 91 out of 98 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/testenv/verificationutils.go Added stabilization sleep and StabilizationDuration constant (missing import)
test/testenv/util.go Introduced DumpGetSecrets and changed PVC resources type
pkg/splunk/enterprise/configuration.go Changed PVC resources type
test/testenv/testenv.go Updated manager Metrics options
go.mod Bumped Go version and updated SDK and dependency versions
Comments suppressed due to low confidence (4)

test/testenv/util.go:740

  • [nitpick] The comment says "list of pods" but this function is fetching secrets. Update the comment to accurately describe that it lists secrets.
// DumpGetSecrets prints and returns list of pods in the namespace

test/testenv/verificationutils.go:36

  • The time package is not imported, causing a compile error. Add import "time" at the top of the file.
var StabilizationDuration = time.Second * 20

test/testenv/util.go:527

  • There is no corev1.VolumeResourceRequirements type in Kubernetes API; it should remain corev1.ResourceRequirements to define PVC resource requests.
			Resources: corev1.VolumeResourceRequirements{

pkg/splunk/enterprise/configuration.go:142

  • Incorrect use of corev1.VolumeResourceRequirements—this type does not exist. Use corev1.ResourceRequirements for PVC specs.
				Resources: corev1.VolumeResourceRequirements{


output, err := exec.Command("kubectl", "get", "secrets", "-n", ns).Output()
if err != nil {
return nil
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

Returning nil on error may lead to nil-slice operations downstream. Consider returning an empty slice or logging the error before returning.

Suggested change
return nil
logf.Log.Error(err, "Failed to execute command", "command", "kubectl get secrets -n "+ns)
return []string{}

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

@patrykw-splunk patrykw-splunk left a comment

Choose a reason for hiding this comment

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

LGTM!

@Igor-splunk Igor-splunk merged commit 6c4484d into develop Jun 30, 2025
27 checks passed
@Igor-splunk Igor-splunk deleted the CSPL-3675-operator-sdk branch June 30, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants