Skip to content

Conversation

@jmsplunk
Copy link
Collaborator

@jmsplunk jmsplunk commented Jan 14, 2026

Description

  • Create the KVService CR in existing splunk CRs if not there
  • Update the ownerReference if the KVService CR already exists
  • Delete the KVService CR when the last owner gets deleted

Key Changes

  • Add the KVService CR creation/deletion logic in util.go
  • Use the defined functions in every existing v4 CRs
  • Add unit tests in util_test.go

Testing and Verification

# Step 1: Create Standalone. Check KVService CR and ownerreference
# Step 2: Create LicenseManager. Check KVService CR and ownerreference
# Step 3: Delete Standalone CR - KVService Remains and ownerreference should only contains license manager
# Step 4: Delete LicenseManager CR - KVService Deleted
Step1
root@ip-10-236-5-61:~/splunk-operator# kubectl apply -n splunk-operator -f - <<EOF
apiVersion: enterprise.splunk.com/v4
kind: Standalone
metadata:
  name: test-kvstore
spec:
  replicas: 1
EOF
standalone.enterprise.splunk.com/test-kvstore created
  
 root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
Standalone
Step2
root@ip-10-236-5-61:~/splunk-operator# kubectl apply -n splunk-operator -f - <<EOF-f - <<EOF
apiVersion: enterprise.splunk.com/v4
kind: LicenseManager
metadata:
  name: test-lm
spec: {}
EOF
licensemanager.enterprise.splunk.com/test-lm created

 root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
Standalone LicenseManager
Step 3
root@ip-10-236kubectl delete standalone test-kvstore -n splunk-operatorvstore -n splunk-operator
standalone.enterprise.splunk.com "test-kvstore" deleted from splunk-operator namespace
  
root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
LicenseManager
Step4 
root@ip-10-236-5-61:~/splkubectl delete licensemanager test-lm -n splunk-operatorplunk-operator
licensemanager.enterprise.splunk.com "test-lm" deleted from splunk-operator namespace
root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice -n splunk-operator
No resources found in splunk-operator namespace.

Related Issues

Jira tickets, GitHub issues, Support tickets...

PR Checklist

  • Code changes adhere to the project's coding standards.
  • Relevant unit and integration tests are included.
  • Documentation has been updated accordingly.
  • All tests pass locally.
  • The PR description follows the project's guidelines.

@jmsplunk jmsplunk self-assigned this Jan 16, 2026
@jmsplunk jmsplunk requested a review from sgontla January 16, 2026 07:11
@jmsplunk jmsplunk marked this pull request as ready for review January 16, 2026 07:12
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.

1 participant